refactor(backup): inline backupbot hooks, drop mysql_backup.sh
All checks were successful
cc-ci/testme cc-ci: success
All checks were successful
cc-ci/testme cc-ci: success
Move the mysqldump/gunzip commands directly into the backupbot.backup.pre-hook / backupbot.restore.post-hook label values on the db service and delete the external mysql_backup.sh + its config mount + MYSQL_BACKUP_VERSION. Matches the inline pattern used by akaunting / engelsystem / forgejo and removes one file from the recipe surface area.
This commit is contained in:
11
compose.yml
11
compose.yml
@ -67,18 +67,14 @@ 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=/mysql_backup.sh backup"
|
||||
- 'backupbot.backup.pre-hook=mysqldump -u root -p"$$(cat /run/secrets/db_password)" --single-transaction --routines --triggers --databases ghost | gzip > /var/lib/mysql/backup.sql.gz'
|
||||
- "backupbot.backup.volumes.mysql.path=backup.sql.gz"
|
||||
- "backupbot.restore.post-hook=/mysql_backup.sh restore"
|
||||
- 'backupbot.restore.post-hook=gunzip -c /var/lib/mysql/backup.sql.gz | mysql -u root -p"$$(cat /run/secrets/db_password)"'
|
||||
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p\"$$(cat /run/secrets/db_password)\""]
|
||||
@ -108,6 +104,3 @@ configs:
|
||||
ghost_entrypoint:
|
||||
name: ${STACK_NAME}_ghost_entrypoint_${GHOST_ENTRYPOINT_VERSION}
|
||||
file: entrypoint.sh
|
||||
mysql_backup:
|
||||
name: ${STACK_NAME}_mysql_backup_${MYSQL_BACKUP_VERSION}
|
||||
file: mysql_backup.sh
|
||||
|
||||
Reference in New Issue
Block a user