This commit is contained in:
parent
9ee73d75ea
commit
4593451dab
10
abra
10
abra
@ -794,7 +794,6 @@ output_version_summary() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ensure_stack_deployed() {
|
ensure_stack_deployed() {
|
||||||
local -a UNHEALTHY # mapping
|
|
||||||
local -a HEALTHY # mapping
|
local -a HEALTHY # mapping
|
||||||
local -a MISSING # mapping
|
local -a MISSING # mapping
|
||||||
|
|
||||||
@ -806,13 +805,11 @@ ensure_stack_deployed() {
|
|||||||
healthcheck=$(docker inspect --format "{{ json .State }}" "$service" | jq "try(.Health.Status // \"missing\")")
|
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")
|
name=$(docker inspect --format '{{ index .Config.Labels "com.docker.swarm.service.name" }}' "$service")
|
||||||
|
|
||||||
if [[ ${UNHEALTHY[*]} =~ ${name} ]] || [[ ${MISSING[*]} =~ ${name} ]]; then
|
if [[ ${MISSING[*]} =~ ${name} ]]; then
|
||||||
debug "Already reported $name as failing/missing healthcheck, skipping..."
|
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$healthcheck" == *"missing"* ]] && [[ ! "${MISSING[*]}" =~ $name ]]; then
|
if [[ "$healthcheck" == *"missing"* ]] && [[ ! "${MISSING[*]}" =~ $name ]]; then
|
||||||
debug "$name has no healthcheck, skipping..."
|
|
||||||
MISSING+=("$name")
|
MISSING+=("$name")
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@ -822,9 +819,7 @@ ensure_stack_deployed() {
|
|||||||
exitcode="$(echo $logs | $JQ '.[-1] | .ExitCode')"
|
exitcode="$(echo $logs | $JQ '.[-1] | .ExitCode')"
|
||||||
warning "Healthcheck for new instance of $name is failing (exit code: $exitcode)"
|
warning "Healthcheck for new instance of $name is failing (exit code: $exitcode)"
|
||||||
warning "$(echo $logs | $JQ -r '.[-1] | .Output')"
|
warning "$(echo $logs | $JQ -r '.[-1] | .Output')"
|
||||||
debug "Placing $name in UNHEALTHY mapping..."
|
error "healthcheck for $name is failing, this deployment did not succeed :("
|
||||||
UNHEALTHY+=("$name")
|
|
||||||
continue
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$healthcheck" == *"healthy"* ]] && [[ ! "${HEALTHY[*]}" =~ $name ]]; then
|
if [[ "$healthcheck" == *"healthy"* ]] && [[ ! "${HEALTHY[*]}" =~ $name ]]; then
|
||||||
@ -835,6 +830,7 @@ ensure_stack_deployed() {
|
|||||||
done
|
done
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
success "All services up! Deployment succeeded!"
|
||||||
}
|
}
|
||||||
|
|
||||||
ensure_domain_deployed() {
|
ensure_domain_deployed() {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
# The goal of this compose file is to have a testing ground for understanding
|
# 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
|
# 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
|
# work with healthchecks and deploy configurations quite closely. If you run
|
||||||
@ -64,3 +65,20 @@ services:
|
|||||||
max_attempts: 3
|
max_attempts: 3
|
||||||
healthcheck:
|
healthcheck:
|
||||||
disable: true
|
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