Backup & restore
Postgres dumps, S3 sync, and tenant-level restores.
Last updated 2026-05-05
CRMcy runs nightly logical backups of every tenant database via pg_dump plus a synchronous WAL-archive stream to S3 for point-in-time recovery (PITR). MinIO buckets sync to an off-region S3 (configurable target) on the same schedule. Backups are encrypted with the tenant master key before upload; restoring requires the key to decrypt.
The infra/scripts/backup-tenants.sh script runs as a cron job inside the cron-scheduler container; check its schedule with docker exec crmcy_cron crontab -l. Backups land in s3://${S3_BUCKET_BACKUPS}/tenants/<slug>/<yyyy-mm-dd>.sql.gz.enc.
Restore a single tenant
infra/scripts/restore-tenant.sh --slug acme --date 2026-05-04This script provisions a fresh empty tenant database, decrypts and restores the backup, then runs verification queries (row counts vs the backup manifest).
Disaster recovery RTO / RPO targets
- RPO: 5 minutes (WAL archive cadence).
- RTO: 30 minutes for a single tenant, 4 hours for the entire stack.
See the source at infra/scripts/backup-tenants.sh and infra/scripts/restore-tenant.sh.