# render with https://www.websequencediagrams.com/
Participant User
Participant Deployment System as dep
Participant Application as app
Participant Load Balancer as lb
Participant Canary as canary
Participant App Servers as as
User -> dep: login
User -> dep: start deployment
dep -> app: pre-deployment
note over app: run pre-deploy hooks
dep -> app: Checkpoint:\nCreate Release Tag\n"$version"
app -> canary: transfer
dep -> lb: depool canary
dep -> canary: trigger deployment of $version
note over canary: set active=$version
note over canary: run tests
canary -> dep: test results
alt test pass
dep -> lb: re-pool canary
dep -> User: Report success
else test fail
dep -> canary: reset active version
dep -> User: Report failure
end
loop for each target $server
app -> as: transfer
dep -> lb: depool $server
note over as: set active=$version
note over as: run tests
as -> dep: test results
dep -> dep: calculate failure rate
dep -> dep: if failure > threshold,\nrollback and abort
dep -> lb: repool $server
dep -> User: report progress
end
dep -> User: done