Backups
What to back up so a site can be restored.
Cardinal has no backup command yet. A site lives in three places, and a restore needs all three from the same point in time.
| What | Where | Why |
|---|---|---|
| Postgres | The postgres volume, or your database server | Every site's schema, one per site, plus the platform schema |
| S3 bucket | CARDINAL_S3_BUCKET | File bytes, stored under <tenant id>/<sha256> |
CARDINAL_MASTER_KEY | .env, or .cardinal/secrets.exs in a dev workspace | Unseals each site's data key |
The master key encrypts each site's data key, which in turn encrypts stored secrets such as SMTP passwords and bot tokens. Data restored without its key keeps working, but every stored secret is unreadable. Password hashes and API secrets still work.
Database dumps
Use pg_dump on the whole database, not one schema. A site's sealed data key and its tenant id live in the platform schema, and encrypted values are tied to that tenant id.
docker compose -f docker-compose.prod.yml exec postgres \
pg_dump -U cardinal -Fc cardinal > cardinal-$(date +%F).dumpFiles
Deleted Records' files stay in the bucket for at least 24 hours before the daily sweep removes them. A bucket with versioning gives you a longer window.