fix(infra): simplify PostgreSQL backup to pg_dumpall + pg_basebackup

pgBackRest as Docker sidecar was overly complex (needs shared WAL
directory, stanza management, special entrypoint). Replace with a
simpler, proven approach using native PostgreSQL tools:

Backup container (postgres:16-alpine):
- Hourly: pg_dumpall | gzip (all databases as SQL, ~2 day retention)
- Daily 03:00: pg_basebackup -Ft -z (physical backup, 30 day retention)
- Auto-cleanup of old backups
- Storage: /Volumes/ManaData/backups/postgres/

Also: Remove pgbackrest.conf, simplify postgresql.conf (remove WAL
archiving config, keep performance tuning + replication for basebackup)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-03-24 11:39:20 +01:00
parent d3ae3841d9
commit fcd7c82ce4
4 changed files with 114 additions and 169 deletions

View file

@ -1,23 +1,19 @@
# PostgreSQL Configuration for WAL Archiving + pgBackRest
# Append to default postgresql.conf
# PostgreSQL Performance Tuning for Mac Mini (16GB RAM)
# Shared with ~70 other containers, so conservative settings
# WAL Archiving (required for Point-in-Time Recovery)
wal_level = replica
archive_mode = on
archive_command = 'pgbackrest --stanza=mana archive-push %p'
archive_timeout = 60
# WAL Settings (tuned for 16GB Mac Mini)
max_wal_senders = 3
max_wal_size = 1GB
min_wal_size = 80MB
# Performance (tuned for 16GB RAM, shared with other services)
# Performance
shared_buffers = 512MB
effective_cache_size = 2GB
work_mem = 16MB
maintenance_work_mem = 128MB
# WAL Settings
max_wal_size = 1GB
min_wal_size = 80MB
# Replication (for pg_basebackup)
max_wal_senders = 3
# Logging
log_min_duration_statement = 1000
log_checkpoints = on