-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add healthcheck for divviup-api to compose.yaml #1097
Conversation
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
I think the CI error here must be a permissions issue on the repositories. |
I know what it is -- we need to grant |
There we go -- now I'm really glad to have added this test. I want to add a test for |
.github/workflows/docker.yml
Outdated
# 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could simplify this by replacing the default if: success()
condition on the last step, and getting rid of continue-on-error: true
. See https://docs.github.com/en/actions/learn-github-actions/expressions#example-of-failure-with-conditions.
# 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 | |
- name: Inspect containers | |
if: ${{ failure() && steps.compose.outcome != 'success' }} | |
run: | | |
docker compose ps | |
for NAME in `docker compose ps --format json | jq -r '.Name'`; do | |
docker inspect $NAME | |
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, cool, I wasn't aware of this advance in the state of the art of encoding program logic as YAML
A few more changes here:
|
Turns out we can't easily test Docker Compose on macOS because those action runners don't and won't install Docker (actions/runner-images#2150). There are workarounds, but TBH I've hit my quota of jumping through hoops to ship code to Macs for the month, and in any case, I feel OK trusting that the macOS Docker will be able to boot a Linux VM and run our container. |
.github/workflows/docker.yml
Outdated
os: [ubuntu-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I think this is missing shell: bash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'll try that but also I think the Docker in Windows images won't work:
image operating system "linux" cannot be used on this platform: operating system is not supported
Adds a simple healthcheck on the
divviup-api
service incompose.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