Zero-downtime delivery · 2 / 10 ·
Two slots, one of them live
The Titik Terang lab uses two names: blue and green. Both are containers from the same image, with different host ports.
Ports that stay on loopback
- The app inside the container listens on
:3000. - The blue slot maps to
127.0.0.1:18080. - The green slot maps to
127.0.0.1:18081. - Caddy listens on
:8080and picks one of those two ports.
Mapping to 127.0.0.1 keeps the slots local. Public readers only see Caddy.
- Blue is live on :18080. Green sits idle on :18081.
- Green can become live. Only one slot receives traffic.
state.json
This small file remembers which slot is live and which version can be restored. The playbook reads it before it works. Change the live key in the explainer below to see which idle slot it would pick.