DevOps

Make a production deploy reversible

Kamruz
Kamruz
Oct 14, 2026
5 min read
Make a production deploy reversible

A production deployment is not reversible merely because the platform offers a rollback button. That button may restore an earlier application revision while leaving new database state, changed configuration, running jobs, and external effects untouched. A recovery plan must define what remains compatible and what requires reconciliation.

Use an illustrative account feature that adds a new status value and a background notification. The release can fail in its UI, storage handling, or worker behavior. The team wants a safe path back to the previous user experience. No platform-specific rollback guarantee is assumed. The plan should be concrete enough that another authorized operator can execute it without guessing which artifact or configuration belongs to the previous version.

Identify the recovery unit

Record the deployable artifact, configuration revision, migration state, and worker version. Use immutable identities where available. A tag named previous is ambiguous if it can be overwritten. Ensure the older artifact is retained and accessible before beginning the release.

Include static assets and public clients when they affect compatibility. A browser can keep an old bundle while the server runs new code. A worker may consume messages created by the new application after the server is rolled back. Define which components must change together and which tolerate mixed versions. This inventory is the foundation of recovery; without it, a rollback command is only a partial action whose consequences are unclear.

Check data compatibility before deployment

Compare old and new readers and writers against the schema transition. An additive field with a safe default may be compatible. Removing a required column or changing the meaning of an existing value may not be. Verify the old version against representative new records in an isolated environment.

Prefer an expand, transition, contract sequence for risky schema changes. Introduce compatible structure first, move readers and writers later, and remove old support after evidence shows it is unused. Do not combine irreversible cleanup with the first feature release unless there is a compelling requirement and a recovery plan. A database backup can be part of that plan, but restoring it may discard legitimate writes that occurred after the backup, which requires deliberate reconciliation.

Define observable stop conditions

Write what would cause the rollout to pause or reverse. Use relevant error rates, critical user journeys, queue age, and dependency symptoms. Avoid a vague instruction to watch the dashboard. For the account feature, verify sign-in, account status interpretation, and notification processing separately.

Set the observation period based on how the feature is exercised. A delayed notification may not reveal failure immediately after deployment. Include a synthetic account that takes the new path without affecting customers. Record the baseline and the expected change in diagnostics. A stop condition should be meaningful enough to justify recovery while avoiding unnecessary reversals from unrelated background noise. Assign someone the authority and responsibility to act on it.

Write the ordered rollback procedure

Specify how to stop new exposure, what to do with accepted jobs, which artifact and configuration to restore, and what to verify afterward. If workers must pause, make that step explicit. If the old application can read new data but not create new statuses, explain how the new writes stop before the old version resumes traffic.

A practical artifact is a numbered runbook with command references, required access, expected result, and failure handling. Keep secrets out of the document. Include a way to verify the recovered artifact identity and application state. Do not rely on someone remembering a provider console setting from the last incident. A runbook is useful when it reduces decision ambiguity under pressure, not when it merely names a deployment tool.

Account for side effects and in-flight work

Emails already sent, files already exposed, and payments already accepted cannot be undone by restoring code. Record which effects need reconciliation and who owns that process. Ensure retries do not repeat consequential actions during recovery. Keep business operation identity stable across versions where the workflow requires it.

In-flight requests can finish after traffic routing changes. Jobs can continue under an older worker lease. Decide whether they drain, pause, or fail visibly. A request accepted by the new path must not vanish because the old UI lacks a status screen. Preserve enough compatibility to show its outcome. See background job state design when rollback crosses asynchronous work.

Rehearse the path in isolation

Deploy the old version, create synthetic records, deploy the new version, exercise the new behavior, then execute the recovery procedure. Inspect data and jobs after the old version returns. Include a failure during rollout rather than only reverting a fully successful release. Mixed states are often where the real incompatibility appears.

Record actual recovery steps and gaps. A rehearsal can reveal a missing artifact, an undocumented secret revision, or old code failing on a new enum. Fix those findings before production rollout. Be clear about scope: an isolated rehearsal proves compatibility and procedural steps within that environment; it does not prove production recovery duration or external provider reversibility. Avoid turning unmeasured recovery expectations into promises.

Decide when repair forward is safer

Rollback can be the wrong response after incompatible writes or irreversible effects. Define the boundary after which the team pauses exposure and repairs forward. A narrow patch may preserve legitimate data better than restoring a backup. The choice depends on the invariant at risk, not on a universal preference for rollback.

Keep both options reviewable. Name the conditions for rollback, the conditions for forward repair, and the evidence needed to decide. Remove temporary compatibility in a later release with its own checks. The cost of reversibility is often additional code and operational preparation. That cost is justified when it materially reduces release risk, but it should have a maintenance owner rather than lingering as unexplained legacy behavior.

Use AI to audit the runbook

Provide the artifact inventory, compatibility matrix, migration plan, and recovery sequence. Ask an assistant to identify missing components and unsafe ordering. Require it to distinguish documented platform capabilities from assumed behavior. It should never claim the runbook was rehearsed unless an actual rehearsal result is supplied.

Ask for specific verification actions after each recovery step: artifact identity, schema compatibility, accepted job status, and critical user journey. Review proposed commands before executing them against production. AI can make a runbook clearer and find forgotten workers, but recovery authority and consequential actions remain with the established operational process. A useful final release note records what was verified, what remains irreversible, and who owns remaining reconciliation.

Sources

Kubernetes Deployment documentation describes revision and rollout behavior for that platform.

PostgreSQL backup documentation supplies a primary reference for dump-based backup and restore considerations. The recovery runbook structure is illustrative.

About the Author

Kamruz

Kamruz

Full Stack Developer

A passionate developer who loves creating modern web applications and sharing knowledge with the community.

More About Me

Related Articles