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

Docker healthcheck #136

Merged
merged 6 commits into from
Jan 5, 2025
Merged

Docker healthcheck #136

merged 6 commits into from
Jan 5, 2025

Conversation

karlromets
Copy link
Collaborator

@karlromets karlromets commented Jan 4, 2025

Fixes #117

Description:
Running tests now (on dev wsl):

  • Runs global.setup.js, which checks if all containers are healthy, if they are not healthy in 60s, it fails and tests don't run
  • The docker health checks use curl with -f flag to verify successful responses by response code
  • While nginx and frontend health checks pass with just a response, backend now has a dedicated /api/health endpoint which checks each backend component - if one of them is down, it returns 503 instead of 200

Changes made:
e4f5b24 modifies backend dev dockerfile to use caching speeds up build times by 6x
9ddd701 adds /api/health endpoint which checks Websocket and Store readiness
dcbe06d adds timeouts to flaky game board hiding test
944a58e adds docker health check to docker-compose-dev-wsl.yaml
88d5e3c adds global.setup.js to wait for containers healthy status before running tests

Note:
I have only made changes to docker-compose-dev-wsl.yaml since I can't make sure if the regular docker-compose-dev.yaml works after I modify it. I'm hoping @joshzcold you can add it and verify that it works on your machine.

Although there is a go health checks library, I felt this was not needed here, but I copied the response format from their example

image

- Speeds up initial go build times by 6x (from 60s to 10s), faster than front-end
- Add new /api/health endpoint
- Implement health status check (health.go)
- Return appropriate HTTP status codes
- was inconsistent due to being too fast
- Added healthcheck for frontend, backend and proxy
- Backend & frontend initial grace period is set to 60s due to long initial build/install times
- Monitors docker container health status
- Checks frontend, backend, and proxy containers
- Implements retry mechanism (60 attempts, 1s intervals)
- Parses container status using regex
@karlromets karlromets requested a review from joshzcold January 4, 2025 13:55
@karlromets karlromets added the enhancement New feature or request label Jan 5, 2025
karlromets added a commit that referenced this pull request Jan 5, 2025
- port over health check to non-wsl
- have kubernetes use the new /api/health endpoint
  - remove now unused /api/healthcheckz endpoint
- remove unnecessary extra playwright profiles in testing.
@joshzcold joshzcold merged commit 6c83cea into master Jan 5, 2025
@joshzcold joshzcold deleted the feat/health-check branch January 5, 2025 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: launching e2e tests doesn't wait for stack to be up until starting
2 participants