Backups and restore
The optional backup service backs up everything that can’t be rebuilt, once a day, encrypted before it leaves the container.
What a backup holds
Section titled “What a backup holds”- The databases: the platform’s (hosts, scenarios, runs), identity’s (people, roles, the audit trail), the HSM simulator’s, the vault’s, the capture proxy’s (capture points and captures, the baselines replays compare with), and the assistant’s (the AI policies and the audit of every AI request).
- The stateful issuers’ live balances, kept on the message bus: the only state held nowhere else. Everything else on the bus is rebuilt from the databases when the services start.
- Not the message log: it’s a rolling record of simulated traffic.
- Not the master keys, by design.
Each backup is one file, encrypted with age to a public key you give it. The machine holds no key that can decrypt it.
Turn it on
Section titled “Turn it on”Make an age key pair on a machine you trust, and keep the private key there, never on the Platform’s machine: it’s the only way to read a backup.
age-keygen -o backup-age-key.txt # prints the public keyIn .env:
BACKUP_AGE_RECIPIENT=age1... # the public keyBACKUP_UTC=02:30 # when it runs each day (UTC)BACKUP_KEEP_LOCAL=3 # how many to keep on the machine# An off-site copy, to any S3-compatible bucket:R2_ENDPOINT=https://...R2_BUCKET=...R2_ACCESS_KEY_ID=...R2_SECRET_ACCESS_KEY=...Start it with docker compose --profile backup up -d. Give the bucket’s key access to that one bucket only, and let the bucket’s own rules delete old backups. A failed backup is logged and tried again 30 minutes later; the message bus out of reach fails it too, rather than writing one without the balances.
Check a backup
Section titled “Check a backup”Safe at any time: it restores into scratch databases, prints their row counts and drops them, then checks the issuers’ balances.
docker compose --profile backup run --rm -v ~/restore-key:/keys:ro backup \ restore.sh check /backups/platform-YYYYMMDDTHHMMSSZ.tar.age /keys/backup-age-key.txtRestore
Section titled “Restore”This replaces the live data.
-
Stop every service but the database and the bus, so nothing writes meanwhile:
docker compose stop $(docker compose config --services | grep -vxE 'db|nats') -
Run the command above with
restoreinstead ofcheck. -
Start everything again with
docker compose up -d. Hosts are brought in line with the restored database, and each stateful issuer loads its balances from the backup. -
Remove the private key from the machine:
shred -u ~/restore-key/*.
Restoring the HSM simulator’s and the vault’s databases needs the master keys that sealed them: they refuse to start with any others. A backup kept in the bucket is downloaded with any S3 client first.