Safe Deployments
Zero-Downtime Deployment Guide
Design zero-downtime application releases with readiness gates, connection draining, backward-compatible data changes and observable rollback. This reference is written for developers who need practical validation behavior, reviewable rules and safe examples rather than copied snippets with no explanation.
Recommended workflow
| Step | Why it matters |
|---|---|
| Make state compatible | Use expand-contract schemas and version-tolerant messages before replacing application instances. |
| Gate readiness | Route traffic only after startup, dependency and warm-up checks pass. |
| Drain old instances | Stop new work while allowing bounded requests, jobs and connections to finish. |
| Verify mixed-version behavior | Observe errors, latency and data correctness while both versions are active. |
Starter snippet
compatible schema -> new instances ready -> drain old traffic -> verify -> retire old versionReview checks
- Set a finite termination grace period.
- Make background jobs idempotent.
- Preserve rollback-compatible configuration.
- Test long-lived connections and queues.
Common mistakes
- Using process started as readiness.
- Terminating old workers during active jobs.
- Deploying incompatible producers and consumers together.
Validation should help users correct input while protecting systems from bad data. Keep syntax checks, product policy, security review and deliverability checks separate.
Related Formalint references
Continue with Database Migration Rollback, Blue-Green Deployment Checklist, Application Health Check Guide.