Safe Deployments, Feature Flags, and Rollbacks

A deployment changes code or configuration in a live environment. Rolling deployments gradually replace instances; blue-green deployments switch traffic between two environments; canary deployments expose a small percentage of traffic to a new version before expansion.

Safe rollout requires compatibility across mixed versions. Database changes often follow expand-and-contract: add a backward-compatible field or table, deploy code that supports both shapes, backfill data, switch reads/writes, then remove obsolete structures after verification.

Feature flags separate release from activation but need ownership, expiration, and cleanup. A rollback may not reverse a schema migration or external side effect. Define health gates, automatic rollback criteria, and a tested manual recovery path before a risky release.

Key Takeaways
  • Roll out gradually and measure health at each step.
  • Design schema migrations for mixed-version operation.
  • Rollback plans must account for data and external side effects.