Compare commits

...

4 Commits

Author SHA1 Message Date
Alexandre
dbd33c5bad Merge pull request #2756 from alexbelgium/copilot/avoid-logging-healthchecks
fix: suppress healthcheck log spam in filebrowser quantum addon
2026-06-03 22:58:17 +02:00
Alexandre
c9070c848a Update Dockerfile 2026-06-03 22:57:58 +02:00
Alexandre
6a4996a480 Update Dockerfile 2026-06-03 22:46:50 +02:00
copilot-swe-agent[bot]
042c44f012 fix: suppress healthcheck log spam in filebrowser quantum addon
Add a dedicated nginx health endpoint on 127.0.0.1:3001 with access_log
off that returns 200 at /health. Update HEALTHCHECK to verify both that
the filebrowser process is running (pgrep) and nginx is serving (curl to
health endpoint), avoiding direct HTTP requests to filebrowser that caused
log spam every 5 seconds.
2026-06-03 14:23:39 +00:00
2 changed files with 9 additions and 24 deletions

View File

@@ -115,27 +115,4 @@ LABEL \
# 6 Healthcheck #
#################
# Avoid spamming logs
# hadolint ignore=SC2016
RUN \
# Handle Apache configuration
if [ -d /etc/apache2/sites-available ]; then \
for file in /etc/apache2/sites-*/*.conf; do \
sed -i '/<VirtualHost/a \ \n # Match requests with the custom User-Agent "HealthCheck" \n SetEnvIf User-Agent "HealthCheck" dontlog \n # Exclude matching requests from access logs \n CustomLog ${APACHE_LOG_DIR}/access.log combined env=!dontlog' "$file"; \
done; \
fi && \
\
# Handle Nginx configuration
if [ -f /etc/nginx/nginx.conf ]; then \
awk '/http \{/{print; print "map $http_user_agent $dontlog {\n default 0;\n \"~*HealthCheck\" 1;\n}\naccess_log /var/log/nginx/access.log combined if=$dontlog;"; next}1' /etc/nginx/nginx.conf > /etc/nginx/nginx.conf.new && \
mv /etc/nginx/nginx.conf.new /etc/nginx/nginx.conf; \
fi
ENV HEALTH_PORT="8080" \
HEALTH_URL=""
HEALTHCHECK \
--interval=5s \
--retries=5 \
--start-period=30s \
--timeout=25s \
CMD curl -A "HealthCheck: Docker/1.0" -s -f "http://127.0.0.1:${HEALTH_PORT}${HEALTH_URL}" &>/dev/null || curl -k --fail "https://127.0.0.1:${HEALTH_PORT}${HEALTH_URL}" &>/dev/null || exit 1
# Upstream

View File

@@ -0,0 +1,8 @@
server {
listen 127.0.0.1:3001;
access_log off;
location /health {
return 200 'OK';
}
}