B. Blue Green a software delivery tutorial
Vol. I § Zero-downtime series § A series for junior developers
Zero-downtime delivery · 6 / 10 ·

The playbook only touches the idle slot

The lab playbook does not stop the live slot. It reads state.json, picks the opposite of live, and renders compose for that slot only.

Six taught steps

  1. Read state. The first deploy pretends the other slot is live so the first step stays deterministic.
  2. Check the target port. If another process holds it, stop.
  3. Pull the image and start the idle slot.
  4. Run the health check.
  5. Patch the Caddy route.
  6. Stop the old slot and write the new state.
Slot playground · idle-deploy
readerCaddy :8080blue :18080 · upgreen :18081 · down
Blue is serving. Green is empty.
  1. Blue is serving. Green is empty.
  2. The playbook pulls the image onto the idle slot. Blue still answers.
  3. Green is healthy and still hidden from readers.
diff · compose
services:
  titikterang:
    image: registry.titikterang.local:5000/titikterang:v1.2.3
    ports:
      - "8080:3000"
services:
  titikterang-green:
    image: registry.titikterang.local:5000/titikterang:v1.2.4-dev
    ports:
      - "127.0.0.1:18081:3000"
explainer · compose
Explanation

This is the green slot. Caddy may still point at blue until the check passes.

The playbook sketch lives in examples/titikterang/ansible.

Reader notes

Chapter discussion appears once Giscus is connected to the site repository.