games_app/deploy/vps-gateway/docker-compose.yml
2026-06-29 15:01:23 +02:00

87 lines
2.3 KiB
YAML

# Passerelle reverse-proxy VPS — cohabitation Salon + Prediqo
# Aucune modification du dépôt Salon requise.
# Sur le VPS : arrêter « docker compose stop nginx » dans Salon avant de démarrer.
services:
nginx:
image: nginx:1.27-alpine
container_name: vps_gateway_nginx
restart: unless-stopped
ports:
- "80:80"
- "443:443"
environment:
CERT_PRIMARY_DOMAIN: ${CERT_PRIMARY_DOMAIN}
SALON_DOMAIN1: ${SALON_DOMAIN1}
SALON_DOMAIN2: ${SALON_DOMAIN2}
PREDIQO_DOMAIN: ${PREDIQO_DOMAIN}
volumes:
- letsencrypt:/etc/letsencrypt
- certbot-www:/var/www/certbot
- ./nginx/salon.conf.template:/etc/nginx/templates/salon.conf.template:ro
- ./nginx/prediqo.conf.template:/etc/nginx/templates/prediqo.conf.template:ro
command: >
/bin/sh -c "LAST='';
(while :; do
CUR=$$(cat /var/www/certbot/.cert-renewed 2>/dev/null || true);
if [ -n \"$$CUR\" ] && [ \"$$CUR\" != \"$$LAST\" ]; then
nginx -s reload || true;
LAST=\"$$CUR\";
fi;
sleep 60;
done) &
exec /docker-entrypoint.sh nginx -g 'daemon off;'"
networks:
- vps-edge
- salon-net
certbot-expand:
image: certbot/certbot:v2.11.0
profiles: ["init"]
volumes:
- letsencrypt:/etc/letsencrypt
- certbot-www:/var/www/certbot
command: >-
certonly --webroot -w /var/www/certbot --expand
--email ${CERTBOT_EMAIL}
-d ${SALON_DOMAIN1}
-d ${SALON_DOMAIN2}
-d ${PREDIQO_DOMAIN}
--agree-tos --no-eff-email --non-interactive
networks:
- salon-net
certbot-renew:
image: certbot/certbot:v2.11.0
restart: unless-stopped
volumes:
- letsencrypt:/etc/letsencrypt
- certbot-www:/var/www/certbot
entrypoint: /bin/sh
command: >
-c "trap exit TERM;
while :; do
certbot renew --webroot -w /var/www/certbot
--deploy-hook 'date +%s > /var/www/certbot/.cert-renewed'
--quiet;
sleep 12h;
done"
networks:
- salon-net
networks:
vps-edge:
external: true
name: vps-edge
salon-net:
external: true
name: ${SALON_DOCKER_NETWORK}
volumes:
letsencrypt:
external: true
name: ${SALON_LETSENCRYPT_VOLUME}
certbot-www:
external: true
name: ${SALON_CERTBOT_WWW_VOLUME}