fix(backup): reimport the postgres dump on restore (restore was a no-op)
All checks were successful
cc-ci/testme cc-ci: success
All checks were successful
cc-ci/testme cc-ci: success
The recipe dumped the DB on backup but shipped NO backupbot.restore.post-hook, and archived the whole live PGDATA dir — so a restore extracted files under the running postgres without reloading them, silently keeping the un-restored (live) state. A restored backup therefore lost all data written since the snapshot. Switch to the coop-cloud /pg_backup.sh convention (as matrix-synapse): backup = pg_dump|gzip -> backup.sql; restore = terminate connections, FORCE-drop, recreate, reimport the dump deterministically. Archive just backup.sql, not the whole PGDATA dir.
This commit is contained in:
13
compose.yml
13
compose.yml
@ -58,9 +58,13 @@ services:
|
||||
deploy:
|
||||
labels:
|
||||
backupbot.backup: "true"
|
||||
backupbot.backup.pre-hook: "PGPASSWORD=$$(cat $${POSTGRES_PASSWORD_FILE}) pg_dump -U $${POSTGRES_USER} $${POSTGRES_DB} > /var/lib/postgresql/data/postgres-backup.sql"
|
||||
backupbot.backup.post-hook: "rm -rf /var/lib/postgresql/data/postgres-backup.sql"
|
||||
backupbot.backup.path: "/var/lib/postgresql/data/"
|
||||
backupbot.backup.pre-hook: "/pg_backup.sh backup"
|
||||
backupbot.backup.volumes.postgres_data.path: "backup.sql"
|
||||
backupbot.restore.post-hook: "/pg_backup.sh restore"
|
||||
configs:
|
||||
- source: pg_backup
|
||||
target: /pg_backup.sh
|
||||
mode: 0555
|
||||
|
||||
|
||||
secrets:
|
||||
@ -69,6 +73,9 @@ secrets:
|
||||
name: ${STACK_NAME}_postgres_password_${SECRET_POSTGRES_PASSWORD_VERSION}
|
||||
|
||||
configs:
|
||||
pg_backup:
|
||||
name: ${STACK_NAME}_pg_backup_${PG_BACKUP_VERSION}
|
||||
file: pg_backup.sh
|
||||
abra_mattermost_entrypoint:
|
||||
name: ${STACK_NAME}_entrypoint_${ABRA_MATTERMOST_ENTRYPOINT_VERSION}
|
||||
file: ./entrypoint.sh
|
||||
|
||||
Reference in New Issue
Block a user