mirror of
https://github.com/sameersbn/docker-gitlab.git
synced 2026-01-25 14:08:09 +00:00
Support healthcheck with relative URL
traditional one with relative url always returns 404 (unhealthy).
Now we can use ${GITLAB_RELATIVE_URL_ROOT} variable to set healcheck URL
after moving script generation to runtime,
This commit is contained in:
parent
5fb55795b6
commit
4ccb8eefb5
@ -423,17 +423,6 @@ programs=sshd,nginx,mail_room,cron
|
||||
priority=20
|
||||
EOF
|
||||
|
||||
# configure healthcheck script
|
||||
## https://docs.gitlab.com/ee/user/admin_area/monitoring/health_check.html
|
||||
cat > /usr/local/sbin/healthcheck <<EOF
|
||||
#!/bin/bash
|
||||
url=http://localhost/-/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
|
||||
|
||||
# purge build dependencies and cleanup apt
|
||||
DEBIAN_FRONTEND=noninteractive apt-get purge -y --auto-remove ${BUILD_DEPENDENCIES}
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
@ -1523,6 +1523,19 @@ update_ssh_listen_port() {
|
||||
sed -i "s|#Port 22|Port ${GITLAB_SSH_LISTEN_PORT}|g" /etc/ssh/sshd_config
|
||||
}
|
||||
|
||||
generate_healthcheck_script() {
|
||||
# configure healthcheck script
|
||||
## https://docs.gitlab.com/ee/user/admin_area/monitoring/health_check.html
|
||||
cat > /usr/local/sbin/healthcheck <<EOF
|
||||
#!/bin/bash
|
||||
url=http://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
|
||||
}
|
||||
|
||||
initialize_system() {
|
||||
map_uidgid
|
||||
initialize_logdir
|
||||
@ -1665,6 +1678,7 @@ configure_gitlab() {
|
||||
gitlab_configure_registry
|
||||
gitlab_configure_pages
|
||||
gitlab_configure_sentry
|
||||
generate_healthcheck_script
|
||||
|
||||
# remove stale gitlab.socket
|
||||
rm -rf ${GITLAB_INSTALL_DIR}/tmp/sockets/gitlab.socket
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user