mirror of
https://github.com/sameersbn/docker-gitlab.git
synced 2026-01-25 14:08:09 +00:00
Merge pull request #2338 from kkimurak/support-health-check-for-relative-url
Support healthcheck with relative URL
This commit is contained in:
commit
feb7ed51c4
@ -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