InfraCityOpen editor

Zero-downtime deploys

Run the new version beside the old one, shift traffic a little at a time, and keep the way back open.

Zero-downtime deploys, drawn as an isometric city

The CityScript

This is all there is to it. Change it in the editor and the city redraws.

%% Z · Zero-downtime deploys
%% Blue serves everyone. Green is started beside it, takes 5% as a canary, then everything; blue stays for a rollback.
city 48x32

district stacks "Two versions side by side" 18,3..45,17

building registry warehouse at 3,5 "Image registry"
  floor registry.f "Images"
    room registry.v2 storage "shop v2" port=5000
building router tower at 4,13 "Traffic router"
  floor router.f "Routing"
    room router.weights config "Weights 95 / 5"
    room router.proxy proxy "Router" port=443
building blue factory in stacks "Blue, v1"
  floor blue.f "Live"
    room blue.web service "web v1" port=3000
    room blue.db database "Shared database" port=5432
building green factory in stacks "Green, v2"
  floor green.f "Candidate"
    room green.web service "web v2" port=3000
    room green.metrics worker "Canary analysis"

pipeline rollout "Canary rollout" registry -> [deploy-green] -> [canary-5] -> [analyse] -> [shift-50] -> [shift-100] -> green
  step registry "A new version is ready"
  step green "It runs next to the old one and takes more traffic, step by step"
  run deploy-green "kubectl apply -f green/"
  run canary-5 "kubectl argo rollouts set weight shop 5"
  run analyse "kubectl argo rollouts status shop --timeout 10m"
  run shift-50 "kubectl argo rollouts set weight shop 50"
  run shift-100 "kubectl argo rollouts promote shop --full"
pipeline rollback "Rollback" router -> [flip-weights] -> blue
  step router "Something is wrong with the new version"
  step blue "Traffic goes back to the old version"
  run flip-weights "kubectl argo rollouts abort shop"
link router.proxy -> blue.web "95% of traffic" variant=emphasis
link router.proxy -> green.web "5% canary" variant=dashed
link router.weights -> router.proxy "weights"
link green.metrics -> router.weights "promote or abort"
link blue.web -> blue.db "SQL"
link green.web -> blue.db "SQL"