Rollback strategies
Undoing a bad release quickly.
A rollback plan means a bad release costs minutes instead of hours. Options include redeploying the previous version, turning off a flag or rolling forward with a fix. Data changes are the hard part, so migrations need their own plan.
Why it matters for a product engineer
Every release can go wrong. A rollback plan decides whether a bad release costs minutes or a long night. Code is usually easy to undo. Data is not: a migration that drops a column or rewrites records can make the old version useless. So the plan has to be ready before the release, not invented during the incident.
How to do it
- Before each release, write how you would undo it: redeploy the previous version, turn off a flag, or switch traffic back.
- Make the database change backwards-compatible: add first, migrate, and remove the old parts only in a later release.
- Keep the previous version ready to run, and know the command or button that brings it back.
- Decide in advance which signal triggers a rollback, so nobody debates it during the incident.
- Practise it. A rollback nobody has run will not work the first time.
- Afterwards, find out why the problem passed your checks.
Common mistakes
- No plan until something breaks.
- Migrations that cannot be reversed, shipped together with the code that needs them.
- Rolling forward with a quick fix under pressure, when rolling back would be safer.
- Rollbacks that depend on the system that is failing.
Example
At Mamitsu, every pull request carries its own rollout and rollback plan. Unai Esteibar’s first question about any feature is about database migrations and how to roll back, because that keeps the blast radius small. A referee agent checks the plan before merging. After a merge, an agent watches the logs and rolls back if something breaks. That has happened once. (Mamitsu in In practice)
From a Slack conversation to production
The way back is planned in the first conversation, checked before the merge and used after it when needed.
ReportedUnai Esteibar, on the call
In practice
Real productsResources
2- articleStart here
Blue green deployment ↗
Martin Fowler · 4 minTwo production environments and a switch between them, for releases and rollbacks in seconds.
- bookGo deeper
Release engineering (Site Reliability Engineering, chapter 8) ↗
Google SRE · 15 minHow Google makes builds and releases repeatable, hermetic and self-service.
Tools
1- ToolFreemium
GitHub Actions
CI/CD built into GitHub, for running tests, checks and deployments on every change.