diff --git a/abra b/abra index f918ba6..8852970 100755 --- a/abra +++ b/abra @@ -802,10 +802,16 @@ ensure_stack_deployed() { local -a UNHEALTHY # mapping local -a HEALTHY # mapping + local -a UNKNOWN # mapping services=$(docker stack services "${STACK_NAME}" --format "{{.ID}}" | tr '\n' ' ') debug "Detected the following service IDs: $(echo $services)" + without_health_checks = $(docker inspect --format) + + # TODO: this tells you if shit is missing + docker inspect --format "{{ json .State }}" traefik_app.1.rnpar574ozsn6oi2ouo5s84jn | jq "try(.Health.Status // \"missing\")" + while [ ! "${#HEALTHY[@]}" -eq "$(( ${#SERVICES[@]} + 1 ))" ]; do debug "Number of services expected to be healthy: $(( ${#SERVICES[@]} + 1 ))" debug "Number of services actually healthy: ${#HEALTHY[@]}" diff --git a/tests/apps/works/compose.yml b/tests/apps/works/compose.yml index af454eb..8a3e189 100644 --- a/tests/apps/works/compose.yml +++ b/tests/apps/works/compose.yml @@ -1,7 +1,13 @@ --- +# 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 +# the `make symlink` target then this will be loaded into a "fake" app on your +# local machine which you can deploy with `abra`. + version: "3.8" services: - r1: + r1_should_work: image: redis:alpine deploy: update_config: @@ -17,7 +23,8 @@ services: retries: 3 start_period: 1s timeout: 3s - r2: + + r2_broken_health_check: image: redis:alpine deploy: update_config: @@ -29,8 +36,31 @@ services: max_attempts: 3 healthcheck: test: foobar - # test: redis-cli ping interval: 2s retries: 3 start_period: 1s timeout: 3s + + r3_no_health_check: + image: redis:alpine + deploy: + update_config: + failure_action: rollback + order: start-first + rollback_config: + order: start-first + restart_policy: + max_attempts: 3 + + r4_disabled_health_check: + image: redis:alpine + deploy: + update_config: + failure_action: rollback + order: start-first + rollback_config: + order: start-first + restart_policy: + max_attempts: 3 + healthcheck: + disable: true