Fix: HealthCheck Script will Fail if the ENV GITLAB_HTTPS set True

This commit is contained in:
AlpsTsui 2022-02-26 11:13:19 +08:00
parent 137376feb7
commit def7ef5fea

View File

@ -1641,9 +1641,13 @@ update_ssh_listen_port() {
generate_healthcheck_script() {
# configure healthcheck script
## https://docs.gitlab.com/ee/user/admin_area/monitoring/health_check.html
local HEALTHCHECK_PROTOCOL="http"
if [[ "${GITLAB_HTTPS}" == true ]]; then
HEALTHCHECK_PROTOCOL="${HEALTHCHECK_PROTOCOL}s"
fi
cat > /usr/local/sbin/healthcheck <<EOF
#!/bin/bash
url=http://localhost${GITLAB_RELATIVE_URL_ROOT}/-/liveness
url=${HEALTHCHECK_PROTOCOL}://localhost${GITLAB_RELATIVE_URL_ROOT}/-/liveness
options=( '--insecure' '--location' '--silent' )
curl "\${options[@]}" \$url
[[ "\$(curl \${options[@]} -o /dev/null -I -w '%{http_code}' \$url)" == "200" ]]