fix(backup): proper backup/restore hooks + healthcheck start_period
Some checks failed
cc-ci/testme cc-ci: failure
Some checks failed
cc-ci/testme cc-ci: failure
- Add mysql_backup.sh: mysqldump to backup.sql.gz with proper restore hook (old --tab backup had no restore hook → restored backup silently lost DB data) - Update db backupbot labels: pre-hook → /mysql_backup.sh backup, restore.post-hook → /mysql_backup.sh restore - Fix app healthcheck start_period 1m → 15m (Ghost fresh-DB migration takes ~6-9min on slow hosts; old 1m caused migration lock deadlocks on deploy) - Fix db healthcheck start_period 1m → 15m (InnoDB init on fresh data dir ~6-10min) - Add MYSQL_BACKUP_VERSION=v1 to abra.sh
This commit is contained in:
19
compose.yml
19
compose.yml
@ -57,7 +57,7 @@ services:
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 1m
|
||||
start_period: 15m
|
||||
|
||||
db:
|
||||
image: mysql:8.0
|
||||
@ -67,21 +67,25 @@ services:
|
||||
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db_password
|
||||
secrets:
|
||||
- db_password
|
||||
configs:
|
||||
- source: mysql_backup
|
||||
target: /mysql_backup.sh
|
||||
mode: 0555
|
||||
volumes:
|
||||
- "mysql:/var/lib/mysql"
|
||||
deploy:
|
||||
labels:
|
||||
- "backupbot.backup=true"
|
||||
- "backupbot.backup.pre-hook=mysqldump -u root -p\"$$(cat /run/secrets/db_password)\" ghost --tab /var/lib/mysql-files/"
|
||||
- "backupbot.backup.post-hook=rm -rf /var/lib/mysql-files/*"
|
||||
- "backupbot.backup.path=/var/lib/mysql-files/"
|
||||
- "backupbot.backup.pre-hook=/mysql_backup.sh backup"
|
||||
- "backupbot.backup.volumes.mysql.path=backup.sql.gz"
|
||||
- "backupbot.restore.post-hook=/mysql_backup.sh restore"
|
||||
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p\"$$(cat /run/secrets/db_password)\""]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 1m
|
||||
start_period: 15m
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
@ -103,4 +107,7 @@ secrets:
|
||||
configs:
|
||||
ghost_entrypoint:
|
||||
name: ${STACK_NAME}_ghost_entrypoint_${GHOST_ENTRYPOINT_VERSION}
|
||||
file: entrypoint.sh
|
||||
file: entrypoint.sh
|
||||
mysql_backup:
|
||||
name: ${STACK_NAME}_mysql_backup_${MYSQL_BACKUP_VERSION}
|
||||
file: mysql_backup.sh
|
||||
Reference in New Issue
Block a user