To speed up deployments, we'll remove the healthcheck step. This adds some risk to deployments for non-web roles - if they don't have a Docker healthcheck configured then the only check we do is if the container is running. If there is a bad image we might see the container running before it exits and deploy it. Previously the healthcheck step would have avoided this by ensuring a web container could boot and serve traffic first. To mitigate this, we'll add a deployment barrier. Until one of the primary role containers passes its healthcheck, we'll keep the barrier up and avoid stopping the containers on the non-primary roles. It the primary role container fails its healthcheck, we'll close the barrier and shut down the new containers on the waiting roles. We also have a new integration test to check we correctly handle a a broken image. This highlighted that SSHKit's default runner will stop at the first error it encounters. We'll now have a custom runner that waits for all threads to finish allowing them to clean up.
46 lines
889 B
YAML
46 lines
889 B
YAML
service: app
|
|
image: app
|
|
servers:
|
|
- vm1
|
|
- vm2: [ tag1, tag2 ]
|
|
env:
|
|
clear:
|
|
CLEAR_TOKEN: 4321
|
|
CLEAR_TAG: ""
|
|
HOST_TOKEN: "${HOST_TOKEN}"
|
|
secret:
|
|
- SECRET_TOKEN
|
|
tags:
|
|
tag1:
|
|
CLEAR_TAG: tagged
|
|
tag2:
|
|
secret:
|
|
- SECRET_TAG
|
|
asset_path: /usr/share/nginx/html/versions
|
|
|
|
registry:
|
|
server: registry:4443
|
|
username: root
|
|
password: root
|
|
builder:
|
|
multiarch: false
|
|
args:
|
|
COMMIT_SHA: <%= `git rev-parse HEAD` %>
|
|
healthcheck:
|
|
cmd: wget -qO- http://localhost > /dev/null || exit 1
|
|
max_attempts: 3
|
|
traefik:
|
|
args:
|
|
accesslog: true
|
|
accesslog.format: json
|
|
image: registry:4443/traefik:v2.10
|
|
accessories:
|
|
busybox:
|
|
service: custom-busybox
|
|
image: registry:4443/busybox:1.36.0
|
|
cmd: sh -c 'echo "Starting busybox..."; trap exit term; while true; do sleep 1; done'
|
|
roles:
|
|
- web
|
|
stop_wait_time: 1
|
|
readiness_delay: 0
|