Skip to content
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

healthcheck not works #2591

Closed
Srobin2020S opened this issue Jun 18, 2022 · 3 comments
Closed

healthcheck not works #2591

Srobin2020S opened this issue Jun 18, 2022 · 3 comments

Comments

@Srobin2020S
Copy link

Srobin2020S commented Jun 18, 2022

If use in docker-compose
healthcheck:
test: ["CMD", "/usr/local/sbin/healthcheck"]
interval: 5m
timeout: 10s
retries: 3
start_period: 5m

and container always starting

Fix: need change to http protocol in line:
url=http://localhost/-/liveness

@hongeinh
Copy link

Have you tried to set the start_period to be a bit longer ? I faced the same issue when i set the start_period too soon.
Got the health check to work when i changed the start_period to 15m

@Re4zOon
Copy link

Re4zOon commented Jun 28, 2022

Hi,

The URL is fine.
Its automatically generated here:

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=${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" ]]
EOF
chmod +x /usr/local/sbin/healthcheck
}

It uses http (unless you set the gitlab_https to true) and uses the URL you meantioned:
url=${HEALTHCHECK_PROTOCOL}://localhost${GITLAB_RELATIVE_URL_ROOT}/-/liveness

There is nothing to fix here, check your logs why it doesn't respond with http 200 (thats the only thing the healthcheck does) after 20 minutes (5 min start + 3*5 min check).

@Srobin2020S
Copy link
Author

Hi,
I changed GITLAB_HTTPS=false and have status "healthy"

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

No branches or pull requests

3 participants