-
Notifications
You must be signed in to change notification settings - Fork 667
Add healthcheck in Dockerfile #812
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
Conversation
Add healthcheck to ensure service availability and verify CURL installation.
Added validation to ensure CURL is installed in the image.
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.
Pull Request Overview
This PR adds a basic HTTP health check to the Dockerfile to improve web server stability by ensuring the container can accept HTTP requests before routing traffic to it.
- Adds validation to confirm curl is available in the final Docker image
- Implements a health check that tests HTTP connectivity on port 8099
- Configures health check with 1-minute intervals and 3-second timeout
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
common/Dockerfile
Outdated
|
|
||
| ENV NODE_ENV production | ||
|
|
||
| # Validation to confirm that CURL is installed in the final image. |
Copilot
AI
Oct 16, 2025
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.
Corrected capitalization of 'CURL' to 'curl'.
| # Validation to confirm that CURL is installed in the final image. | |
| # Validation to confirm that curl is installed in the final image. |
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.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Thanks! |
|
Has this been tested with onboarding? |
|
Unfortunately not. I was just testing if the command ran correctly and I used |
|
I just checked and it works, also made some improvement to make the healthcheck pass faster during startup (1ebfd6f) (otherwise it takes 1 minute before the frontend is accessible) |
The healthcheck is preventing access until it passes?? The race condition (healthcheck happening exactly between the switch from onboarding to Controller -frontend started-) would be nearly impossible to trigger manually. With a good instance, we're talking just a few seconds, but enough that it will undoubtedly trigger many times in real-world scenario. |
Yes. In the case of HA Adoonu. Supervisor does not forward traffic to the add-on, but displays a message that the application is not available. |
It might trigger in real world indeed, but this will only prevent users from accessing the frontend for 1 minute after onboarding (something a user only does typically once). So I think that is acceptable. |
Part of: Koenkk/zigbee2mqtt#28893
This adds a basic health check.
A more complete check (including whether the HTTP server is connected to MQTT) would be useful, but that’ll require server-side changes — so it’s better left for a follow-up.
Even so, this should already improve web server stability, since the Supervisor won’t route traffic to the app until it can accept HTTP requests.