Zero-downtime delivery · 10 / 10 ·
Rollback moves the switch back
Even a perfect deploy someday needs to be undone. The good news: in this architecture, rollback is not a separate mechanism you have to write from scratch. It is an ordinary deploy that happens to target an old version.
The old slot still holds v1.2.3. The playbook patches Caddy back to that port, then writes state.json.
- Green is live, but the new version is wrong.
- Caddy returns to blue. The old version is still in state.json.
Drain mode shows in-flight requests finishing their work before the old slot stops.
- New traffic goes to green. Blue still finishes old requests.
- Old requests finished. Blue is stopped.
Quick recap
- Rollback is a normal deploy with an old tag; the path, the health check, and the switch are identical.
- Drain gives in-flight requests time to finish before the old slot stops.
- The precondition for rollback: the old image still exists in the registry.
rollback_availableandstate.json.bakalways tell you the real state of things.
If a new release fails its health check, you never reach this chapter. The health gate already kept readers on the old version.