Skip to content

Commit feb7ed5

Browse files
authored
Merge pull request #2338 from kkimurak/support-health-check-for-relative-url
Support healthcheck with relative URL
2 parents 5fb5579 + 4ccb8ee commit feb7ed5

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

assets/build/install.sh

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -423,17 +423,6 @@ programs=sshd,nginx,mail_room,cron
423423
priority=20
424424
EOF
425425

426-
# configure healthcheck script
427-
## https://docs.gitlab.com/ee/user/admin_area/monitoring/health_check.html
428-
cat > /usr/local/sbin/healthcheck <<EOF
429-
#!/bin/bash
430-
url=http://localhost/-/liveness
431-
options=( '--insecure' '--location' '--silent' )
432-
curl "\${options[@]}" \$url
433-
[[ "\$(curl \${options[@]} -o /dev/null -I -w '%{http_code}' \$url)" == "200" ]]
434-
EOF
435-
chmod +x /usr/local/sbin/healthcheck
436-
437426
# purge build dependencies and cleanup apt
438427
DEBIAN_FRONTEND=noninteractive apt-get purge -y --auto-remove ${BUILD_DEPENDENCIES}
439428
rm -rf /var/lib/apt/lists/*

assets/runtime/functions

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,6 +1523,19 @@ update_ssh_listen_port() {
15231523
sed -i "s|#Port 22|Port ${GITLAB_SSH_LISTEN_PORT}|g" /etc/ssh/sshd_config
15241524
}
15251525

1526+
generate_healthcheck_script() {
1527+
# configure healthcheck script
1528+
## https://docs.gitlab.com/ee/user/admin_area/monitoring/health_check.html
1529+
cat > /usr/local/sbin/healthcheck <<EOF
1530+
#!/bin/bash
1531+
url=http://localhost${GITLAB_RELATIVE_URL_ROOT}/-/liveness
1532+
options=( '--insecure' '--location' '--silent' )
1533+
curl "\${options[@]}" \$url
1534+
[[ "\$(curl \${options[@]} -o /dev/null -I -w '%{http_code}' \$url)" == "200" ]]
1535+
EOF
1536+
chmod +x /usr/local/sbin/healthcheck
1537+
}
1538+
15261539
initialize_system() {
15271540
map_uidgid
15281541
initialize_logdir
@@ -1665,6 +1678,7 @@ configure_gitlab() {
16651678
gitlab_configure_registry
16661679
gitlab_configure_pages
16671680
gitlab_configure_sentry
1681+
generate_healthcheck_script
16681682

16691683
# remove stale gitlab.socket
16701684
rm -rf ${GITLAB_INSTALL_DIR}/tmp/sockets/gitlab.socket

0 commit comments

Comments
 (0)