This commit is contained in:
parent
9ee73d75ea
commit
4593451dab
10
abra
10
abra
@ -794,7 +794,6 @@ output_version_summary() {
|
||||
}
|
||||
|
||||
ensure_stack_deployed() {
|
||||
local -a UNHEALTHY # mapping
|
||||
local -a HEALTHY # mapping
|
||||
local -a MISSING # mapping
|
||||
|
||||
@ -806,13 +805,11 @@ ensure_stack_deployed() {
|
||||
healthcheck=$(docker inspect --format "{{ json .State }}" "$service" | jq "try(.Health.Status // \"missing\")")
|
||||
name=$(docker inspect --format '{{ index .Config.Labels "com.docker.swarm.service.name" }}' "$service")
|
||||
|
||||
if [[ ${UNHEALTHY[*]} =~ ${name} ]] || [[ ${MISSING[*]} =~ ${name} ]]; then
|
||||
debug "Already reported $name as failing/missing healthcheck, skipping..."
|
||||
if [[ ${MISSING[*]} =~ ${name} ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ "$healthcheck" == *"missing"* ]] && [[ ! "${MISSING[*]}" =~ $name ]]; then
|
||||
debug "$name has no healthcheck, skipping..."
|
||||
MISSING+=("$name")
|
||||
continue
|
||||
fi
|
||||
@ -822,9 +819,7 @@ ensure_stack_deployed() {
|
||||
exitcode="$(echo $logs | $JQ '.[-1] | .ExitCode')"
|
||||
warning "Healthcheck for new instance of $name is failing (exit code: $exitcode)"
|
||||
warning "$(echo $logs | $JQ -r '.[-1] | .Output')"
|
||||
debug "Placing $name in UNHEALTHY mapping..."
|
||||
UNHEALTHY+=("$name")
|
||||
continue
|
||||
error "healthcheck for $name is failing, this deployment did not succeed :("
|
||||
fi
|
||||
|
||||
if [[ "$healthcheck" == *"healthy"* ]] && [[ ! "${HEALTHY[*]}" =~ $name ]]; then
|
||||
@ -835,6 +830,7 @@ ensure_stack_deployed() {
|
||||
done
|
||||
sleep 1
|
||||
done
|
||||
success "All services up! Deployment succeeded!"
|
||||
}
|
||||
|
||||
ensure_domain_deployed() {
|
||||
|
@ -1,4 +1,5 @@
|
||||
---
|
||||
|
||||
# The goal of this compose file is to have a testing ground for understanding
|
||||
# what cases we need to handle to get stable deployments. For that, we need to
|
||||
# work with healthchecks and deploy configurations quite closely. If you run
|
||||
@ -64,3 +65,20 @@ services:
|
||||
max_attempts: 3
|
||||
healthcheck:
|
||||
disable: true
|
||||
|
||||
r5_should_also_work:
|
||||
image: redis:alpine
|
||||
deploy:
|
||||
update_config:
|
||||
failure_action: rollback
|
||||
order: start-first
|
||||
rollback_config:
|
||||
order: start-first
|
||||
restart_policy:
|
||||
max_attempts: 1
|
||||
healthcheck:
|
||||
test: redis-cli ping
|
||||
interval: 2s
|
||||
retries: 3
|
||||
start_period: 1s
|
||||
timeout: 3s
|
||||
|
Reference in New Issue
Block a user