@@ -60,45 +60,46 @@ intro() {
60
60
echo
61
61
echo " Setup and upgrade:"
62
62
echo
63
- echo " ${BOLD} setup${NORMAL} setup new Misago site."
64
- echo " ${BOLD} upgrade${NORMAL} backup , rebuild, migrate and collect static."
63
+ echo " ${BOLD} setup${NORMAL} Setup new Misago site."
64
+ echo " ${BOLD} upgrade${NORMAL} Backup , rebuild, migrate and collect static."
65
65
echo
66
66
echo " Docker management:"
67
67
echo
68
- echo " ${BOLD} start${NORMAL} start all containers."
69
- echo " ${BOLD} stop${NORMAL} stop all containers."
70
- echo " ${BOLD} restart${NORMAL} stop and start all docker containers."
71
- echo " ${BOLD} rebuild${NORMAL} rebuild and restart Misago and celery container containers."
72
- echo " ${BOLD} rebuildall${NORMAL} pull , rebuild and restart all containers."
73
- echo " ${BOLD} stats${NORMAL} see list and stats of running docker containers."
68
+ echo " ${BOLD} start${NORMAL} Start all containers."
69
+ echo " ${BOLD} stop${NORMAL} Stop all containers."
70
+ echo " ${BOLD} restart${NORMAL} Stop and start all docker containers."
71
+ echo " ${BOLD} rebuild${NORMAL} Rebuild and restart Misago and celery container containers."
72
+ echo " ${BOLD} rebuildall${NORMAL} Pull , rebuild and restart all containers."
73
+ echo " ${BOLD} stats${NORMAL} See list and stats of running docker containers."
74
74
echo
75
75
echo " Change configuration:"
76
76
echo
77
- echo " ${BOLD} forumindex${NORMAL} switch forum index between threads and categories."
78
- echo " ${BOLD} email${NORMAL} change email setup."
79
- echo " ${BOLD} hostname${NORMAL} change hostname setup."
80
- echo " ${BOLD} locale${NORMAL} change locale setup."
81
- echo " ${BOLD} timezone${NORMAL} change timezone setup."
82
- echo " ${BOLD} avatargallery${NORMAL} load avatar gallery."
83
- echo " ${BOLD} sentry${NORMAL} enable or disable Sentry (sentry.io) for logging."
84
- echo " ${BOLD} debug${NORMAL} change debug mode."
85
- echo " ${BOLD} secret${NORMAL} reset secret key."
77
+ echo " ${BOLD} forumindex${NORMAL} Switch forum index between threads and categories."
78
+ echo " ${BOLD} email${NORMAL} Change email setup."
79
+ echo " ${BOLD} hostname${NORMAL} Change hostname setup."
80
+ echo " ${BOLD} locale${NORMAL} Change locale setup."
81
+ echo " ${BOLD} timezone${NORMAL} Change timezone setup."
82
+ echo " ${BOLD} avatargallery${NORMAL} Load avatar gallery."
83
+ echo " ${BOLD} sentry${NORMAL} Enable or disable Sentry (sentry.io) for logging."
84
+ echo " ${BOLD} debug${NORMAL} Change debug mode."
85
+ echo " ${BOLD} secret${NORMAL} Reset secret key."
86
86
echo
87
87
echo " Note: you need to rebuild Misago container for changes made with those utils to take effect."
88
88
echo
89
89
echo " Backup:"
90
90
echo
91
- echo " ${BOLD} backup${NORMAL} backup and archive database and media."
92
- echo " ${BOLD} restore BACKUP${NORMAL} restore database and media from BACKUP archive."
91
+ echo " ${BOLD} backup${NORMAL} Backup and archive database and media."
92
+ echo " ${BOLD} restore BACKUP${NORMAL} Restore database and media from BACKUP archive."
93
93
echo
94
94
echo " Utilities:"
95
95
echo
96
- echo " ${BOLD} collectstatic${NORMAL} collect static assets."
97
- echo " ${BOLD} manage.py${NORMAL} runs \" python manage.py\" inside docker."
98
- echo " ${BOLD} bash${NORMAL} starts bash session inside running Misago container."
99
- echo " ${BOLD} run${NORMAL} runs \" docker-compose run --rm misago\" ."
100
- echo " ${BOLD} psql${NORMAL} runs psql connected to database."
101
- echo " ${BOLD} flushredis${NORMAL} flush the redis cache."
96
+ echo " ${BOLD} collectstatic${NORMAL} Collect static assets."
97
+ echo " ${BOLD} manage.py${NORMAL} Runs \" python manage.py\" inside docker."
98
+ echo " ${BOLD} bash${NORMAL} Starts bash session inside running Misago container."
99
+ echo " ${BOLD} run${NORMAL} Runs \" docker-compose run --rm misago\" ."
100
+ echo " ${BOLD} psql${NORMAL} Runs psql connected to database."
101
+ echo " ${BOLD} flushredis${NORMAL} Flush the redis cache."
102
+ echo " ${BOLD} resetcron${NORMAL} Replace host's crontab with default one."
102
103
echo
103
104
}
104
105
@@ -159,7 +160,7 @@ set_crontab() {
159
160
rm -f cron_tmp
160
161
touch cron_tmp
161
162
echo " 30 1 * * * cd $current_path && $docker_compose run --rm misago ./cron" >> cron_tmp
162
- echo " 0 1 * * * cd $current_path && ./appctl daily_backup " >> cron_tmp
163
+ echo " 0 1 * * * cd $current_path && $docker_compose run --rm misago ./.run backup \" auto- \$ (date +%Y%m%d%H%M%S) \" " >> cron_tmp
163
164
echo " 0 1 * * * find $current_path /backups/ -name auto-* -type f -mtime +10 -delete" >> cron_tmp
164
165
echo " " >> cron_tmp
165
166
crontab cron_tmp
@@ -320,30 +321,8 @@ reset_secret_key() {
320
321
# Create new backup
321
322
create_new_backup () {
322
323
require_setup
323
- if [[ $1 ]]; then
324
- backup_type=" $1 "
325
- else
326
- backup_type=" manual"
327
- fi
328
- # create tmp backup dir
329
- backup_dir=" $backup_type -$( date +%Y%m%d%H%M%S) "
330
- mkdir " ./backups/$backup_dir "
331
- # backup database
332
- echo " Backing up database..."
333
- $docker_compose run --rm misago ./.run backup_db $backup_dir
334
- # backup media
335
- echo " Backing up media..."
336
- cp -r ./misago/media " ./backups/$backup_dir /media"
337
- cd ./backups/
338
- # archive backup dir
339
- backup_archive=" $backup_type -$( date +%Y%m%d%H%M%S) .tar.gz"
340
- GZIP=-9
341
- tar -zcf $backup_archive " $backup_dir "
342
- # delete backup dir as its no longer required
343
- rm -rf $backup_dir
344
- cd ..
345
- echo " New backup has been created at backups/$backup_archive "
346
- echo
324
+ backup_name=" manual-$( date +%Y%m%d%H%M%S) "
325
+ $docker_compose run --rm misago ./.run backup $backup_name
347
326
}
348
327
349
328
# Restore from backup
@@ -472,6 +451,8 @@ if [[ $1 ]]; then
472
451
docker_run $@
473
452
elif [[ $1 = " psql" ]]; then
474
453
run_psql
454
+ elif [[ $1 = " resetcron" ]]; then
455
+ set_crontab
475
456
else
476
457
invalid_argument $1
477
458
fi
0 commit comments