Free ops runbook · Release engineering

Rollback at 2am: the decision, the command, and the blast radius

Checkout started returning 500 at 01:40. The rollback command is one line; the decision is not. A rollback restores code. It does not restore schema, cache, queue offsets, or the config that changed in the same window.

This page is free. It covers how to choose between rollback and fix-forward, how to check that the target still exists, and what to verify after the command returns.

Scope: reviewed from platform documentation, no live reproduction
Verified against the Kubernetes Deployment, Cloudflare Pages and Cloudflare Workers rollback documentation on 2026-11-12. Examples use placeholder names; the commands are read-only until the rollback step itself.
Decide

Rollback is a change, not a reset

Roll back when

The change is isolated, a known-good artifact still exists, the schema is compatible with the old code, and users are actively impacted.

Fix forward when

The rollback reopens a security hole, the migration already wrote data the old code cannot read, or the fix is a one-line config change you can verify in minutes.

The 2am rule

If you cannot state the blast radius in one sentence, do not run the command. Rolling back is a deploy with its own failure modes.

Write it down first

Target revision, expected effect, who is watching, and the abort condition. Two minutes of writing prevents a second incident.

Detect

What is actually running, and what can you go back to?

CommandWhat it tells you
kubectl rollout history deployment/<name>Revisions the controller still retains; the one you want may already be pruned.
kubectl rollout status deployment/<name> --timeout=30sWhether a rollout is still in progress. Rolling back mid-rollout races the controller.
kubectl get deploy <name> -o jsonpath='{..image}'The image actually running, not the tag in git.
kubectl diff -f <manifest>Drift between the repo and the cluster, including config you did not deploy.
wrangler deployments listWorker versions and timestamps available for rollback.
wrangler pages deployment listPages production deployments. Preview deployments are not valid rollback targets.
git log --oneline <last-good>..HEAD -- <path>The change set, including migrations and config, not just application code.
curl -sS -o /dev/null -w '%{http_code} ' https://host/healthThe symptom you are rolling back, measured before and after.
Failure modes

Seven ways a rollback does not roll back

#Failure modeWhat you seeWhat to do
1Code rolls back, the schema does notThe old code starts returning column "..." does not exist or a not-null violation.Use expand/contract migrations, roll back the app first, and keep the previous release compatible with the new schema for one deploy. Test the previous image against the migrated database before you need it.
2The rollback target no longer existserror: unable to find specified revision 3; Pages refuses a preview deployment as a target.Pin and retain several known-good artifacts, record the deployment ID in the incident channel, and never assume "the previous version" is listed.
3Config and secrets are not versioned with the artifactThe old image starts but calls the new upstream, or crashes on a variable the old code never needed.Roll back config with the code. Diff the running environment, not just the image, and keep env changes in the same reviewed change.
4The cache keeps serving the bad assetHTML is old, hashed JS returns 404, or cf-cache-status: HIT on a file you just replaced.Use content-hashed filenames, purge by tag or URL, and verify with a cache-busting request from a second network.
5Stateful side effects do not rewindMessages already consumed, emails sent, payments captured, webhooks delivered.Decide before rolling back. Make handlers idempotent, use an outbox, and check queue lag and dead letters after the rollback.
6Partial rollback across servicesThe API is old and the worker is new; a contract field disappears and the worker retries forever.Version the contract, roll back in reverse dependency order, and watch retries and lag, not only pod status.
7Rollback during an in-flight rolloutThe undo command returns success, but pods keep churning and a new rollout starts from the old template.Wait for the rollout to settle or pause it first (kubectl rollout pause), then undo and watch the status.
Blast radius

The same word means different things per platform

PlatformWhat a rollback doesWhat to watch
Kubernetes DeploymentRolling replacement; old and new pods coexist and the undo waits for readiness.Readiness, restarts, and whether the controller actually moved the template.
Cloudflare WorkersInstant and global. A split deployment collapses to 100% on the version you choose.The version ID, and whether traffic was split before the rollback.
Cloudflare PagesInstant and global for the static build. The HTML and the assets it references must move together.Asset hashes, cache status, and any function or redirects file in the build.
Database migrationAffects every running version at once; the app rollback does not undo it.Whether old code can read the new schema, and whether a down migration really restores data.
Rehearse

Before you need it

Write the exact command

Not "roll back the deploy": the command, the target ID, and the person who owns it. Put it in the runbook next to the deploy steps.

Time it in staging

A Pages rollback is seconds; a Kubernetes undo can take minutes and stall on readiness. Know which one you have.

Keep the artifact

Retention policies delete the thing you need. Pin the image digest or deployment ID you would roll back to.

Verify with a real request

A successful command is not a working site. Hit the failed path and read one log line before declaring recovery.

After

Three checks that close the loop

CheckWhy
The failed request now succeeds, from a second networkYour cache or your laptop can hide the result.
The running version matches the targetA successful command and a moved template are different facts.
Error rate, latency and queue lag are back to baselineRollback can move the failure rather than remove it.
FAQ

Questions from the incident channel

Can we roll back just the config?

If the config changed with the deploy, yes: roll it back explicitly and restart the process that reads it. If the config lives in the same artifact, roll back the artifact.

What if the database migration is one-way?

Then rollback is not the safe move. Prefer a fix-forward patch that keeps the new schema, or restore from a snapshot with the data loss that implies. Decide with the data owner, not alone at 2am.

How many revisions should we keep?

Enough to cover the longest incident plus the slowest deploy: usually the last five to ten, pinned by digest rather than tag. Retention is a policy, not a default.

Does a rollback need a postmortem?

Yes. It is a production change made under pressure, and the next one will be easier if you record what the target was and what did not move with it.

Sources

Primary sources

Going deeper on the change window?

The paid runbooks cover the surrounding changes: production defaults, cache behaviour, certificate rollovers, and the checks that only fail on a real domain.

This page is free, no checkout. Paid runbooks are $9.99 each and covered by the 7-day refund policy at /runbooks/refund.