Skip to content
MSO CloudDocumentation

Disaster recovery

On this page

Who: on-call engineer. Use this when the Postgres primary, the host or the object store is lost and the platform has to be rebuilt from backups. Backup mechanics and the restore drill are in Backup; this page is the recovery order.

Targets and what holds today#

Item Target Today
Data loss window (RPO) 15 minutes Age of the newest dump, up to about 24 hours. Continuous WAL archiving is not configured.
Recovery time (RTO) 1 hour Measured by the restore drill, which grows with database size. The 2026-10-31 dump (1.2 GB) restored in 5 min 34 s into a 2 CPU / 2 GB container.
Scope Postgres, Redis queues, object-store payloads, webhook replay metadata, audit exports Postgres dumps run nightly; the object-store volume is rsynced with them; Redis holds queue state only.

The drill is scripts/ops/verify-restore.sh. It restores the newest dump into a throwaway container and prints RESULT=PASS or RESULT=FAIL.

Triggers#

  • Postgres primary unavailable for more than 5 minutes.
  • The restore drill prints RESULT=FAIL.
  • Region-wide network incident on the write path.
  • Checksum mismatch on an audit export. No scheduled job produces these checksums yet, so this trigger only fires on a manual check.

Recovery sequence#

  1. Freeze mutating traffic: disable the worker consumers, and put mutation-heavy routes in maintenance mode if the queues cannot drain safely.
  2. Pick the newest dump that passed verify-restore.sh, and check it against its .sha256 file before restoring.
  3. Restore it into a shadow target. There is no WAL replay step; accept data loss back to the dump time.
  4. Restore the object-store volume. scripts/dr-snapshot.sh exports the bucket (mc mirror) and the same tool mirrors it back.
  5. Redis: restore queue metadata, rehydrate only pending jobs, and drop the completed-job cache if it blocks the restore.
  6. Point web and worker at the restored targets, then run pnpm db:migrate.
  7. Smoke checks: a signed webhook ingestion, a data export on the sample organization, and a dashboard that renders seeded charts.
  8. Re-enable the workers, then web mutations.

Verify the result#

  • Row counts of orders, order_items, engagement_events, action_commands, fct_order_touch and pred_shopper_clv are within the tolerance of the pre-failure counts.
  • The Action Queue still lists approvals, outcomes and experiment assignments.
  • If the webhook replay backlog is over 15 minutes, replay Bronze raw_events before re-enabling proposals.

Not covered yet#

  • A scheduled restore drill with an alert on failure. Run it by hand weekly and after a schema-shape change.
  • Weekly export-checksum comparison and a monthly drill with web and worker pointed at shadow infrastructure.