fix(backup): back up the postgres database (was unprotected)
Some checks failed
cc-ci/testme cc-ci: failure
Some checks failed
cc-ci/testme cc-ci: failure
The immich recipe declared backupbot.backup only on the app service (whose volumes are all excluded), so the postgres database — all of immich users metadata, albums, people, settings — was NOT backed up at all. Restoring a backup yielded an empty DB. Add a database-service postgres backup mirroring the coop-cloud convention (matrix-synapse, keycloak, ...): a /pg_backup.sh config-mounted hook driven by backupbot pre/restore hooks. backup = pg_dump | gzip -> backup.sql in the postgres volume; restore = terminate immich-server connections, FORCE-drop, recreate, reimport (the VectorChord/pgvecto.rs extensions and all data round-trip cleanly).
This commit is contained in:
15
compose.yml
15
compose.yml
@ -67,6 +67,21 @@ services:
|
||||
- postgres:/var/lib/postgresql/data
|
||||
networks:
|
||||
- backend
|
||||
deploy:
|
||||
labels:
|
||||
backupbot.backup: "${ENABLE_BACKUPS:-true}"
|
||||
backupbot.backup.pre-hook: "/pg_backup.sh backup"
|
||||
backupbot.backup.volumes.postgres.path: "backup.sql"
|
||||
backupbot.restore.post-hook: "/pg_backup.sh restore"
|
||||
configs:
|
||||
- source: pg_backup
|
||||
target: /pg_backup.sh
|
||||
mode: 0555
|
||||
|
||||
configs:
|
||||
pg_backup:
|
||||
name: ${STACK_NAME}_pg_backup_${PG_BACKUP_VERSION}
|
||||
file: pg_backup.sh
|
||||
|
||||
secrets:
|
||||
db_password:
|
||||
|
||||
Reference in New Issue
Block a user