Skip to content

Commit

Permalink
Add healthcheck for divviup-api to compose.yaml
Browse files Browse the repository at this point in the history
Adds a simple healthcheck on the `divviup-api` service in `compose.yaml`
that tickles the health endpoint. Also adds a check to the Docker CI job
that runs Docker compose and waits 120 seconds for it to become healthy.

Part of #1096
  • Loading branch information
tgeoghegan committed Jun 13, 2024
1 parent 5a0be9a commit dcf4d90
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,16 @@ jobs:
build-args: |
GIT_REVISION=${{ steps.git.outputs.GIT_REVISION }}
RUST_FEATURES=${{ matrix.rust-features }}
- name: Compose
id: compose
run: docker compose up --wait --waitfor 120
# continue on error so we can inspect containers in the next step
continue-on-error: true
- name: Inspect containers
if: steps.compose.outcome != 'success'
run: |
docker compose ps
for NAME in `docker compose ps --format json | jq -r '.Name'`; do
docker inspect $NAME
done
exit 1
2 changes: 2 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ services:
image: ${DIVVIUP_API_IMAGE:-us-west2-docker.pkg.dev/janus-artifacts/divviup-api/divviup_api:0.3.9}
ports:
- "8080:8080"
healthcheck:
test: ["CMD", "/bin/sh", "-c", "wget http://0.0.0.0:8080/health -O - >/dev/null"]
environment:
RUST_LOG: info
AUTH_URL: https://auth.example
Expand Down

0 comments on commit dcf4d90

Please sign in to comment.