Rehearsing Mastodon Database Restores with Paused Clients
The latest main‑branch push adds a rehearsal script and supporting tests that let the team verify a database restore while Mastodon clients are stopped, giving confidence that backup integrity is preserved before any production cut‑over.
Change Summary Overview
The commit feat(mastodon): rehearse restores from protected main with clients paused (#2302) modifies four files: openwiki/workloads/inventory.md adds an eight‑line usage note; scripts/ci/mastodon-release-check-test.py gains a new test that rejects running clients; scripts/ci/mastodon-release-check.py imports runpy and adds helper functions; and a new scripts/mastodon-paused-restore.py script (80 lines) automates the rehearsal flow.
What the Evidence Shows
The patch for openwiki/workloads/inventory.md inserts a command nix develop --command python3 -I scripts/mastodon-paused-restore.py that runs the reviewed verifier as a separate Job with the backup mounted read‑only. The test test_rehearsal_rejects_running_client patches the client Deployments to have replicas = 1 and asserts that the helper exits with “stopped”. The updated mastodon-release-check.py adds recovery_failures and recovery_failures functions that evaluate backup‑related errors. The new restore script ties these pieces together, reading the release state, checking that sync is idle and manual, confirming all three client Deployments are stopped, and leaving a receipt valid for 24 hours.
Verification and Next Steps
Running the new script from a clean checkout of protected main will execute the backup identity check, validate that no client pods are running, and produce a receipt that can be inspected for 24 hours. The accompanying test ensures the workflow short‑circuits if any client is unexpectedly running. The team should execute the script in a staging cluster, review the receipt, and only then consider the pattern for production rehearsals.
Platform Engineering Takeaway
This pattern — adding a dedicated rehearsal script, a guard test, and updated release‑check helpers — can be reused for any stateful workload where a backup must be validated before client traffic resumes. A platform team can template the script to read the appropriate CronJob, mount the backup read‑only, and assert pod readiness, then surface the same contract in the feature spec for review.