Make logging reflect reality + do more debugging
See coop-cloud/abra#193.
This commit is contained in:
parent
bb3b324e07
commit
43b4a01f8a
11
abra
11
abra
@ -800,25 +800,29 @@ ensure_stack_deployed() {
|
|||||||
idx=0
|
idx=0
|
||||||
|
|
||||||
IFS=' ' read -r -a SERVICES <<< "$(docker stack services "${STACK_NAME}" --format "{{.ID}}" | tr '\n' ' ')"
|
IFS=' ' read -r -a SERVICES <<< "$(docker stack services "${STACK_NAME}" --format "{{.ID}}" | tr '\n' ' ')"
|
||||||
|
debug "Considering the following service IDs: ${SERVICES} for ${STACK_NAME} deployment"
|
||||||
|
|
||||||
while [ ! $(( ${#HEALTHY[@]} + ${#MISSING[@]} )) -eq ${#SERVICES[@]} ]; do
|
while [ ! $(( ${#HEALTHY[@]} + ${#MISSING[@]} )) -eq ${#SERVICES[@]} ]; do
|
||||||
for service in $(docker ps -f "name=$STACK_NAME" -q); do
|
for service in $(docker ps -f "name=$STACK_NAME" -q); do
|
||||||
|
debug "Polling $service for deployment status"
|
||||||
|
|
||||||
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 [[ ${MISSING[*]} =~ ${name} ]] || [[ ${HEALTHY[*]} =~ ${name} ]]; then
|
if [[ ${MISSING[*]} =~ ${name} ]] || [[ ${HEALTHY[*]} =~ ${name} ]]; then
|
||||||
|
debug "$name already marked as missing healthcheck / healthy status"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$healthcheck" == "\"missing\"" ]] && [[ ! "${MISSING[*]}" =~ $name ]]; then
|
if [[ "$healthcheck" == "\"missing\"" ]] && [[ ! "${MISSING[*]}" =~ $name ]]; then
|
||||||
MISSING+=("$name")
|
MISSING+=("$name")
|
||||||
info "$name has no healthcheck configured, cannot guarantee this service comes up successfully..."
|
debug "No healthcheck configured for $name"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$healthcheck" == "\"healthy\"" ]] && [[ ! "${HEALTHY[*]}" =~ $name ]]; then
|
if [[ "$healthcheck" == "\"healthy\"" ]] && [[ ! "${HEALTHY[*]}" =~ $name ]]; then
|
||||||
HEALTHY+=("$name")
|
HEALTHY+=("$name")
|
||||||
info "$name is healthy!"
|
debug "Marking $name with healthy status"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -837,9 +841,8 @@ ensure_stack_deployed() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
info "Deploying: $(( ${#HEALTHY[@]} + ${#MISSING[@]} ))/${#SERVICES[@]} (timeout: $idx/$TIMEOUT)"
|
debug "Deploying: $(( ${#HEALTHY[@]} + ${#MISSING[@]} ))/${#SERVICES[@]} (timeout: $idx/$TIMEOUT)"
|
||||||
done
|
done
|
||||||
success "All services up! Deployment succeeded!"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ensure_domain_deployed() {
|
ensure_domain_deployed() {
|
||||||
|
Reference in New Issue
Block a user