Rollback runbook
Goal
Give the operator exact commands to get back to the last good version and a clear list of what rollback will not fix.
A good runbook has been walked through against the real deploy setup, not written from memory of how it should work.
When to use
- A release is failing now and the user needs to go back.
- The user wants a rollback plan before a risky release.
- A service has no written recovery path.
- To plan the release steps themselves, use
use_skillwithdeploy-checklist.
Steps
- Find how the service is deployed. Use
rgfor deploy scripts, CI workflows, Helm charts,Procfileandfly.toml, and read them withread_file. - Identify the last known good version: a git tag, an image digest, a release id. Use
run_commandwithgit tag --sort=-creatordateto list tags. - If this is an emergency, stop the spread first: pause the rollout, scale new instances to zero or disable the flag, then plan the full return.
- Write the code rollback commands for this platform. Check the platform docs with
read_urlfor the exact command, since flags differ and change. - Check the schema. Read the latest migrations with
read_fileand decide whether each is reversible. A dropped column or rewritten data is not. - Plan the data path: forward fix, restore from backup, or run a down migration. State the data loss window for each in plain words.
- Check config and secrets: which values changed in this release and where the old values are kept.
- Check dependent systems: other services, cached values, queued jobs and scheduled tasks that already used the new version.
- Write the steps as numbered commands with expected output after each, then a verification block (health, one real flow, error rate).
- Write the decision rule: who calls it, and the time after which the team stops debugging and rolls back.
- Rehearse if possible: run each command with
--dry-runor in staging withrun_command, and note the real elapsed time. - Save it with
create_filenext to the service docs.
Gotchas
- Rolling back code over a migrated schema can crash the old version. Make migrations backward compatible, then rollback is safe.
- An image tag like
stablemay already point at the bad build. Roll back to a digest or an immutable version. - Caches, search indexes and queued messages written by the new version stay behind after rollback.
- A rollback that has never been run usually fails on a step nobody remembered, such as lost registry access.
- Rolling back also rolls back the bug fix someone shipped inside the same release. Check the changelog first.
- Flipping a feature flag is faster than any rollback. Say so when the change sits behind one.
Output
- The runbook as numbered commands with expected results and a verify block.
- A table of what rollback restores and what it does not.
- The time it takes if measured, or marked unmeasured.
