Skip to content

Conversation

@mik-laj
Copy link
Contributor

@mik-laj mik-laj commented Oct 15, 2025

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.

Add healthcheck to ensure service availability and verify CURL installation.
Added validation to ensure CURL is installed in the image.
Copy link

Copilot AI left a 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.


ENV NODE_ENV production

# Validation to confirm that CURL is installed in the final image.
Copy link

Copilot AI Oct 16, 2025

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'.

Suggested change
# Validation to confirm that CURL is installed in the final image.
# Validation to confirm that curl is installed in the final image.

Copilot uses AI. Check for mistakes.
Added validation to ensure curl is installed in the image.
@mik-laj mik-laj requested a review from Copilot October 16, 2025 20:56
Copy link

Copilot AI left a 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.

@Koenkk Koenkk merged commit 0c2c6c4 into zigbee2mqtt:master Oct 17, 2025
11 checks passed
@Koenkk
Copy link
Contributor

Koenkk commented Oct 17, 2025

Thanks!

@Nerivec
Copy link
Contributor

Nerivec commented Oct 21, 2025

Has this been tested with onboarding?
See Koenkk/zigbee2mqtt#29128 (comment)

@mik-laj
Copy link
Contributor Author

mik-laj commented Oct 21, 2025

Unfortunately not. I was just testing if the command ran correctly and I used docker exec for that.

@Koenkk
Copy link
Contributor

Koenkk commented Oct 21, 2025

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)

@Nerivec
Copy link
Contributor

Nerivec commented Oct 22, 2025

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.

@mik-laj
Copy link
Contributor Author

mik-laj commented Oct 22, 2025

The healthcheck is preventing access until it passes??

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.

@Koenkk
Copy link
Contributor

Koenkk commented Oct 22, 2025

With a good instance, we're talking just a few seconds, but enough that it will undoubtedly trigger many times in real-world scenario.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants