-
Notifications
You must be signed in to change notification settings - Fork 792
GUACAMOLE-2086: Add Tomcat HealthCheckValve #1119
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
base: main
Are you sure you want to change the base?
Conversation
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.
The changes look pretty good to me - the only thing that needs to be addressed is that the PR title needs the correct formatting for the Jira prefix:
GUACAMOLE-2086:
|
Fixed, sorry for that |
075340e to
a10f9d8
Compare
| if [ "$HEALTH_CHECK_VALVE_ENABLED" = "true" ]; then | ||
| # Default health check path (/health) | ||
| HEALTH_CHECK_PATH="${HEALTH_CHECK_VALVE_PATH:-/health}" | ||
| # Perform actual health check via curl | ||
| curl --fail --silent --show-error "http://localhost:8080${HEALTH_CHECK_PATH}" || 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.
A couple of concerns about the HEALTH_CHECK_VALVE_PATH variable:
- It looks like it assumes that an absolute path will be provided?
- What happens if the user provides a relative path (no leading /), both here and in the server.xml file?
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.
I assumed an absolute path would be provided since it looks like tomcat only supports absolute paths:
https://github.com/apache/tomcat/blob/eaea7503163e44ba7260c9c7b3af3f4ba387d072/java/org/apache/catalina/valves/HealthCheckValve.java#L82
If the user provides a relative path, the health check won't be reachable and curl will complain: "curl: (3) URL rejected: Port number was not a decimal number between 0 and 65535\n"
Maybe a check can be added when loading the variables to warn the user if the path is not absolute.
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.
Yeah, I would think checking the variable would be the right way to go...
This PR allows to set Tomcat's HealthCheckValve with environment variables. The implementation is taken from the RemoteIpValve script.
EDIT: this is useful so orchestrators (like kubernetes) or docker itself can know if the service is ready to accept connections.
The second commit uses these new variables to configure docker's HEALTHCHECK. This could be removed if it shouldn't be enabled by default.
I'm happy to make any changes necessary. Thanks for reviewing this PR.