Merge pull request 'fix backup and restore when database was already created' (#5) from p4u1/plausible:fix-backup-restore into main

Reviewed-on: #5
This commit is contained in:
3wordchant 2024-04-06 18:08:54 +00:00
commit 71dfab1129
1 changed files with 4 additions and 3 deletions

View File

@ -55,7 +55,8 @@ services:
backupbot.backup.pre-hook: sh -c 'pg_dump -U "$$POSTGRES_USER" -Fc "$$POSTGRES_DB" | gzip > "/postgres.dump.gz"'
backupbot.backup.path: "/postgres.dump.gz"
backupbot.backup.post-hook: "rm -f /postgres.dump.gz"
backupbot.restore.post-hook: sh -c 'gzip -d /postgres.dump.gz && pg_restore -U "$$POSTGRES_USER" --dbname="$$PLAUSIBLE_DB" < /postgres.dump && rm /postgres.dump'
backupbot.restore: "true"
backupbot.restore.post-hook: sh -c 'gzip -d /postgres.dump.gz && pg_restore --clean -U "$$POSTGRES_USER" --dbname="$$PLAUSIBLE_DB" < /postgres.dump && rm -f /postgres.dump'
plausible_events_db:
image: clickhouse/clickhouse-server:23.4.2.11-alpine
@ -78,8 +79,8 @@ services:
backupbot.backup.pre-hook: clickhouse-backup create events
backupbot.backup.path: "/var/lib/clickhouse/backup/events"
backupbot.backup.post-hook: "rm -rf /var/lib/clickhouse/backup/events"
backupbot.restore.post-hook: clickhouse-backup restore events
backupbot.resoter.post-hook: "rm -rf /var/lib/clickhouse/backup/events"
backupbot.restore: "true"
backupbot.restore.post-hook: clickhouse-backup restore --rm events && rm -rf /var/lib/clickhouse/backup/events"
volumes:
db-data: