Zero-Downtime Deploys With a Two-Line Health Check
Most "zero-downtime deploy" writeups jump straight to blue-green clusters and service meshes. Most teams don't need that. What they need is for the load balancer to stop sending traffic to a process that isn't ready yet.
The setup
- App exposes
GET /healthz, returns 200 only once migrations and warmup are done. - nginx (or whatever's in front) checks it before adding the upstream back to the pool.
- Deploy script waits for a green health check before killing the old process.
until curl -sf http://localhost:8000/healthz; do sleep 1; done
echo "new instance is ready, swapping traffic"
That's it. No orchestration platform required — just don't route to a process before it says it's ready, and don't kill the old one before the new one is.
Where this breaks down
Long-running requests in flight during the swap, and background workers that don't have a health check at all. Both are solvable, but they're a different post.