dmunozv04 commented on code in PR #1119: URL: https://github.com/apache/guacamole-client/pull/1119#discussion_r2422981924
########## guacamole-docker/bin/healthcheck.sh: ########## @@ -0,0 +1,40 @@ +#!/bin/bash -e +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +## +## @fn healthcheck.sh +## +## Performs a health check for the Guacamole container. If HEALTH_CHECK_VALVE_ENABLED +## is set to "true", this script will check the actual health endpoint. Otherwise, +## it will simply return success and log that health checks are disabled. +## + + +# Check if health check valve is enabled +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 Review Comment: 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. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
