chore(docker): smoke test fixes for stack startup and healthz
Three issues surfaced when running 'make init' on the deployment host and were fixed in place: - wakdo_internal network: explicit subnet 192.168.148.0/24 (RFC 1918, in the free 192.168.144-159 gap). The host's Docker daemon has its default address pools saturated by other stacks, so auto-allocation failed. An explicit subnet bypasses the allocator and isolates Wakdo from neighbour churn. - wakdo-cron: init: true added so Docker injects tini as PID 1. Without it, dcron loops on 'setpgid: Operation not permitted' because PID 1 in a container without an init system cannot change process groups for its children. - healthz vhost: served as a static file from /usr/local/apache2/htdocs/ instead of a RewriteRule [R=200] that triggered Apache's ErrorDocument template (and leaked 'internal error' wording into a 200 response). The file lives outside /var/www/html/ which is bind-mounted at runtime and would otherwise mask the COPY.
This commit is contained in:
parent
4edabf20df
commit
d9890cfb5d
4 changed files with 40 additions and 9 deletions
|
|
@ -38,6 +38,18 @@ networks:
|
||||||
# de sortir sur internet (pour telecharger des packages au build et pour
|
# de sortir sur internet (pour telecharger des packages au build et pour
|
||||||
# de potentiels appels API externes futurs). L'isolation vient du fait
|
# de potentiels appels API externes futurs). L'isolation vient du fait
|
||||||
# qu'aucun port hote n'est binde ici.
|
# qu'aucun port hote n'est binde ici.
|
||||||
|
#
|
||||||
|
# Subnet explicite (RFC 1918) : l'auto-allocateur Docker du daemon hote
|
||||||
|
# est sature (15 /16 + 15 /20 deja alloues par d'autres stacks), il ne
|
||||||
|
# peut plus creer de reseau bridge sans subnet explicite. 192.168.148.0/24
|
||||||
|
# est dans le gap libre 192.168.144-159 (256 IP, largement suffisant pour
|
||||||
|
# 4 services), aucune collision avec les /24 acquagest voisins (150/154/
|
||||||
|
# 155/157). Choix defendable : right-sizing + isolation des fluctuations
|
||||||
|
# d'allocation auto sur cet hote mutualise.
|
||||||
|
ipam:
|
||||||
|
driver: default
|
||||||
|
config:
|
||||||
|
- subnet: 192.168.148.0/24
|
||||||
|
|
||||||
# Reseau du reverse proxy (Traefik) pre-existant sur l'hote.
|
# Reseau du reverse proxy (Traefik) pre-existant sur l'hote.
|
||||||
# Son nom est configurable via REVERSE_PROXY_NETWORK dans .env pour
|
# Son nom est configurable via REVERSE_PROXY_NETWORK dans .env pour
|
||||||
|
|
@ -222,6 +234,11 @@ services:
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
container_name: wakdo-cron
|
container_name: wakdo-cron
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
# init: true -> Docker injecte tini comme PID 1. dcron exige un init
|
||||||
|
# parent pour pouvoir setpgid() sur ses jobs (sinon "Operation not
|
||||||
|
# permitted" en boucle car un PID 1 sans init ne peut pas changer les
|
||||||
|
# groupes de processus). Cf. busybox-utils issue tracker.
|
||||||
|
init: true
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
# Credentials BDD pour mysqldump (lecture seule via USER applicatif,
|
# Credentials BDD pour mysqldump (lecture seule via USER applicatif,
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,15 @@ COPY mpm.conf /usr/local/apache2/conf/extra/wakdo-mpm.conf
|
||||||
# bind-mounte en dev. Sans ca, Apache refuse de demarrer.
|
# bind-mounte en dev. Sans ca, Apache refuse de demarrer.
|
||||||
RUN mkdir -p /var/www/html/public
|
RUN mkdir -p /var/www/html/public
|
||||||
|
|
||||||
|
# Fichier statique servi par le vhost healthz (Alias /healthz). Evite
|
||||||
|
# le RewriteRule [R=200] qui declenche le template ErrorDocument d'Apache
|
||||||
|
# et pollue le body de la reponse.
|
||||||
|
# Place dans /usr/local/apache2/htdocs/ et non /var/www/html/ : ce dernier
|
||||||
|
# est bind-monte depuis ./src au runtime (cf. docker-compose.yml), ce qui
|
||||||
|
# masquerait le fichier copie ici. /usr/local/apache2/htdocs/ est un chemin
|
||||||
|
# Apache natif jamais bind-monte.
|
||||||
|
COPY healthz.txt /usr/local/apache2/htdocs/healthz.txt
|
||||||
|
|
||||||
# Healthcheck : vhost par defaut (0.0.0.0:80) doit repondre.
|
# Healthcheck : vhost par defaut (0.0.0.0:80) doit repondre.
|
||||||
# Le endpoint /healthz est defini dans vhost.conf, repond 200 "ok".
|
# Le endpoint /healthz est defini dans vhost.conf, repond 200 "ok".
|
||||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
||||||
|
|
|
||||||
1
docker/apache/healthz.txt
Normal file
1
docker/apache/healthz.txt
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
OK
|
||||||
|
|
@ -16,21 +16,25 @@
|
||||||
|
|
||||||
# === Healthcheck interne Docker (non expose publiquement) ===
|
# === Healthcheck interne Docker (non expose publiquement) ===
|
||||||
# Listen sans ServerName = catch-all. Utilise par le HEALTHCHECK du Dockerfile.
|
# Listen sans ServerName = catch-all. Utilise par le HEALTHCHECK du Dockerfile.
|
||||||
|
# Sert un fichier statique healthz.txt (body = "OK\n") au lieu d'un
|
||||||
|
# RewriteRule [R=200] qui declenchait le template ErrorDocument generique
|
||||||
|
# et faisait apparaitre la mention "internal error" dans le body d'un 200.
|
||||||
|
# Le fichier vit dans /usr/local/apache2/htdocs/ (chemin Apache natif, jamais
|
||||||
|
# bind-monte) et non dans /var/www/html/ qui est ecrase par le bind-mount
|
||||||
|
# ./src au runtime.
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
DocumentRoot "/var/www/html/public"
|
DocumentRoot "/usr/local/apache2/htdocs"
|
||||||
|
|
||||||
<Location /healthz>
|
Alias /healthz /usr/local/apache2/htdocs/healthz.txt
|
||||||
SetHandler none
|
|
||||||
Require all granted
|
|
||||||
</Location>
|
|
||||||
|
|
||||||
Alias /healthz /dev/null
|
<Directory "/usr/local/apache2/htdocs">
|
||||||
<Directory "/var/www/html/public">
|
|
||||||
Require all granted
|
Require all granted
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
RewriteEngine On
|
<Files "healthz.txt">
|
||||||
RewriteRule ^/healthz$ - [R=200,L]
|
# Pas de cache : la sonde doit toujours toucher Apache.
|
||||||
|
Header set Cache-Control "no-store"
|
||||||
|
</Files>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|
||||||
# === Borne client (Bloc 1 - front vanilla HTML/CSS/JS) ===
|
# === Borne client (Bloc 1 - front vanilla HTML/CSS/JS) ===
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue