Skip to content
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

Merged
merged 10 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,45 @@ jobs:
with:
context: .
push: false
load: true
cache-from: |
type=gha,scope=main-${{ matrix.rust-features }}
type=gha,scope=${{ github.ref_name }}-${{ matrix.rust-features }}
cache-to: type=gha,scope=${{ github.ref_name }}-${{ matrix.rust-features }},mode=max
build-args: |
GIT_REVISION=${{ steps.git.outputs.GIT_REVISION }}
RUST_FEATURES=${{ matrix.rust-features }}
# Test the dev compose, which should use the images built earlier. Technically this is only
# interesting when feature integration-testing is on, but we may as well exercise both.
- name: Compose (dev)
id: compose-dev
run: docker compose -f compose.dev.yaml up --wait --wait-timeout 120
- name: Inspect dev containers
if: ${{ failure() && steps.compose-dev.outcome != 'success' }}
run: |
docker compose ps
for NAME in `docker compose ps --format json | jq -r '.Name'`; do
docker inspect $NAME
done

# Test the non-dev compose, which we use for demo purposes. This pulls images from remote repos,
# so no need to build anything. Additionally we want coverage across multiple operating systems.
# Ideally we'd test on macOS, too, but those runners don't have Docker:
# https://github.com/actions/runner-images/issues/2150
compose:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
Copy link
Collaborator

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

Copy link
Contributor Author

@tgeoghegan tgeoghegan Jun 13, 2024

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

actions/runner#904

steps:
- uses: actions/checkout@v4
- name: Compose
id: compose
run: docker compose up --wait --wait-timeout 120
- 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
4 changes: 3 additions & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ services:
condition: service_started

divviup_api:
image: ${DIVVIUP_API_IMAGE:-us-west2-docker.pkg.dev/divviup-artifacts-public/divviup-api/divviup_api:0.3.12}
image: ${DIVVIUP_API_IMAGE:-us-west2-docker.pkg.dev/divviup-artifacts-public/divviup-api/divviup_api_integration_test:0.3.12}
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
Loading