From a13180b54d0c65b476249ec07b229b105bb5d525 Mon Sep 17 00:00:00 2001
From: Alexandre Lossent <alexandre.lossent@cern.ch>
Date: Fri, 1 Nov 2024 14:22:31 +0100
Subject: [PATCH] Skip vhost folder checks in readiness probe

---
 el9/values.yaml | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/el9/values.yaml b/el9/values.yaml
index 6fb19fd..9da70a3 100644
--- a/el9/values.yaml
+++ b/el9/values.yaml
@@ -138,10 +138,9 @@ containers:
         - |
           function reload_apache_config {
             if [[ -e "${VHOST_READY_FILE}" && (! -e ${RELOAD_TIMESTAMP_FILE} || -n "$(find /etc/httpd/conf.d/vhost -cnewer ${RELOAD_TIMESTAMP_FILE})") ]]; then
-              # TODO: we need a way to monitor and alarm if Apache config is invalid,
-              # as this will require manual investigation and correction.
-              # cf. https://gitlab.cern.ch/webservices/webframeworks-planning/issues/51
-              apachectl -t && \
+              # Run syntax tests for configuration files. `-T` skips checking the vhost root folders on EOS.
+              # The root folder check can take several seconds and doesn't affect validity of the configuration, just prints a warning.
+              httpd -t -T && \
               kill -USR1 $(cat /var/run/httpd.pid) && \
               touch ${RELOAD_TIMESTAMP_FILE}
             fi
@@ -153,7 +152,10 @@ containers:
             test -e "${VHOST_READY_FILE}" -a "${RELOAD_TIMESTAMP_FILE}" -nt "${VHOST_READY_FILE}"
           }
           # Note that we ignore any error reloading config, if config is invalid
-          # then Apache will just keep using the previous config.
+          # then Apache will just (silently) keep using the previous config.
+          # As of Nov 2024 it never happened that we generate an invalid httpd config;
+          # if this becomes a concern then see https://gitlab.cern.ch/webservices/webframeworks-planning/issues/51
+          # for considerations regarding how to monitor and alarm if Apache config is invalid.
           reload_apache_config
           check_vhost_ready && check_web_request
       initialDelaySeconds: 10
-- 
GitLab