Architecture portfolio

ADR 003

Encrypted nightly backups, stored offsite

Accepted1 December 2026Scope: all stateful apps

Context

Seven Postgres databases, the blog's content and uploaded family photos all live on one host. The hosting provider's snapshots sit with the same provider and account as the server itself, so they don't protect against account loss, ransomware or a bad docker volume rm. Some of the data is personal, so backups must stay unreadable wherever they are stored.

Options considered

OptionForAgainst
Provider snapshots onlyOne clickSame failure domain as the server; restores the whole disk, not one app
Object storage (S3, B2) with resticMature, deduplicatedAnother vendor and account; a server compromise also leaks the storage credentials
Encrypt with an age public key, copy to a separate systemThe server can encrypt but never decrypt; the offsite copy is pulled by a separate service that has no access to the serverFull copies rather than incremental; size grows with the data

Decision

  1. At 02:30 IST a backup container runs pg_dump on every app database and archives the blog content and photo volumes (read-only mounts). It writes one file encrypted to an age public key and keeps 7 nights on the server.
  2. At 03:15 a separate workflow downloads the already-encrypted file through a secret URL and stores it as a release in a private repository, keeping 14 nights. The credentials it uses can reach only that one repository.
  3. Any failure triggers a phone alert.
  4. The private key lives offline with the owner, so nothing running on the server can decrypt a backup.

Consequences

Revisit when

At bank scale

Set RPO and RTO per data class, approved by the business. Use continuous WAL archiving, immutable (WORM) storage in a second region, keys in an HSM or KMS with dual control, and quarterly restore tests whose evidence goes to audit. The core idea doesn't change: the system that writes backups must not be able to read or delete them.