Merge pull request #2338 from kkimurak/support-health-check-for-relative-url

Support healthcheck with relative URL
This commit is contained in:
Sameer Naik 2021-04-09 10:51:45 +05:30 committed by GitHub
commit feb7ed51c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 11 deletions

View File

@ -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/*

View File

@ -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