After configuring the domain name1

This commit is contained in:
Your Name 2026-10-31 19:42:34 +02:00
parent 9b7a196323
commit 4b669222f0
7 changed files with 78 additions and 50 deletions

View File

@ -106,8 +106,10 @@ PREDIQO_HTTP_PORT=9080
PREDIQO_HTTPS_PORT=9443
CERTBOT_EMAIL=your-email@example.com
CERTBOT_DOMAIN1=prediqo.redirectme.net
APP_PUBLIC_URL=http://prediqo.redirectme.net:9080
CERTBOT_DOMAIN1=tloto.net
# Second name on the same certificate (www). Used by ssl:dns-init --expand.
CERTBOT_DOMAIN2=www.tloto.net
APP_PUBLIC_URL=https://tloto.net:9443
INITIAL_SETUP_TOKEN=your-random-setup-token-min-32-chars
# Emergency Super Admin 2FA reset (CLI / Docker only — not an HTTP API). Min 32 chars; distinct from JWT/setup tokens.
# Generate: node -e "console.log(require('crypto').randomBytes(48).toString('hex'))"

View File

@ -1,27 +1,39 @@
# Passerelle HTTPS partagée — uniquement dans le projet Prediqo.
# Route business-mgt + prediqo sans modifier le dépôt Salon.
# Passerelle HTTPS partagée (80/443) — Salon + Tloto sans ports dans l’URL.
#
# Prérequis sur le VPS :
# 1. Stack Salon déjà déployée (backend + frontend tournent)
# 2. Arrêter UNIQUEMENT le conteneur nginx Salon (libère 80/443) :
# cd Salon_management_Project && docker compose stop nginx
# 3. docker network create vps-edge
# 4. npm run coexist:up (depuis games_app)
# 5. npm run gateway:up (cette passerelle)
# Prérequis VPS :
# 1. Identifier qui tient 80/443 : sudo ss -tlnp | grep -E ':80|:443'
# 2. Arrêter UNIQUEMENT ce nginx (ex. Salon) pour libérer 80/443
# 3. Arrêter prediqo_nginx_https ( Prediqo ne publie plus 9080/9443 )
# 4. docker network create vps-edge
# 5. Adapter les noms ci-dessous (docker network ls / docker volume ls)
# 6. docker compose up -d (depuis ce dossier)
#
# Volumes Let's Encrypt : réutilise ceux du Salon (docker volume ls).
# Réseau Salon : docker network ls | grep app-net
# Puis dans games-project/.env :
# APP_PUBLIC_URL=https://tloto.net
# CORS_ORIGINS=https://tloto.net,https://www.tloto.net
# VITE_API_BASE_URL=https://tloto.net
# VITE_WS_URL=wss://tloto.net/ws/v1/games/candle-predict
# et rebuild : docker compose --profile https-dns up -d --build prediqo-web
# (ou laisser https-dns down et ne garder que backend/web/redis/ws/engine/worker)
CERTBOT_EMAIL=admin@example.com
CERTBOT_EMAIL=admin@tloto.net
# Domaine principal du certificat Salon (dossier sous live/)
CERT_PRIMARY_DOMAIN=business-mgt.redirectme.net
SALON_DOMAIN1=business-mgt.redirectme.net
SALON_DOMAIN2=bright-salon.redirectme.net
PREDIQO_DOMAIN=prediqo.redirectme.net
# Nom du réseau Docker du projet Salon (adapter si besoin)
PREDIQO_DOMAIN=tloto.net
PREDIQO_DOMAIN_WWW=www.tloto.net
# Nom du dossier sous /etc/letsencrypt/live/ (cert DNS tloto)
PREDIQO_CERT_NAME=tloto.net
# Réseaux Docker (adapter aux noms réels du VPS)
SALON_DOCKER_NETWORK=salon_management_project_app-net
PREDIQO_DOCKER_NETWORK=games-project_prediqo-net
# Volumes Docker existants du Salon (préfixe = nom du dossier compose)
# Volumes Let's Encrypt
SALON_LETSENCRYPT_VOLUME=salon_management_project_letsencrypt
SALON_CERTBOT_WWW_VOLUME=salon_management_project_certbot-www
PREDIQO_LETSENCRYPT_VOLUME=games-project_letsencrypt

View File

@ -1,6 +1,16 @@
# Passerelle reverse-proxy VPS — cohabitation Salon + Prediqo
# Passerelle reverse-proxy VPS — cohabitation Salon + Tloto (Prediqo)
# Un seul nginx écoute 80/443 ; le routage se fait par nom de domaine (SNI).
#
# Sur le VPS :
# 1. Arrêter le nginx qui occupe déjà 80/443 (ex. Salon) :
# cd Salon_... && docker compose stop nginx
# 2. Arrêter le nginx Prediqo (:9080/:9443) — les API/web restent up :
# cd games-project && docker stop prediqo_nginx_https
# 3. docker network create vps-edge # si absent
# 4. Configurer .env (ce dossier) puis :
# docker compose up -d
#
# 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:
@ -13,11 +23,16 @@ services:
environment:
CERT_PRIMARY_DOMAIN: ${CERT_PRIMARY_DOMAIN}
SALON_DOMAIN1: ${SALON_DOMAIN1}
SALON_DOMAIN2: ${SALON_DOMAIN2}
SALON_DOMAIN2: ${SALON_DOMAIN2:-}
PREDIQO_DOMAIN: ${PREDIQO_DOMAIN}
PREDIQO_DOMAIN_WWW: ${PREDIQO_DOMAIN_WWW:-www.${PREDIQO_DOMAIN}}
PREDIQO_CERT_NAME: ${PREDIQO_CERT_NAME:-${PREDIQO_DOMAIN}}
volumes:
# Certificats Salon (HTTP-01 / volume existant)
- letsencrypt:/etc/letsencrypt
- certbot-www:/var/www/certbot
# Certificat Tloto déjà obtenu (DNS) dans le projet games-project
- prediqo-letsencrypt:/etc/letsencrypt-prediqo:ro
- ./nginx/salon.conf.template:/etc/nginx/templates/salon.conf.template:ro
- ./nginx/prediqo.conf.template:/etc/nginx/templates/prediqo.conf.template:ro
command: >
@ -34,22 +49,7 @@ services:
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
- prediqo-net
certbot-renew:
image: certbot/certbot:v2.11.0
@ -67,7 +67,7 @@ services:
sleep 12h;
done"
networks:
- salon-net
- vps-edge
networks:
vps-edge:
@ -76,6 +76,9 @@ networks:
salon-net:
external: true
name: ${SALON_DOCKER_NETWORK}
prediqo-net:
external: true
name: ${PREDIQO_DOCKER_NETWORK}
volumes:
letsencrypt:
@ -84,3 +87,6 @@ volumes:
certbot-www:
external: true
name: ${SALON_CERTBOT_WWW_VOLUME}
prediqo-letsencrypt:
external: true
name: ${PREDIQO_LETSENCRYPT_VOLUME}

View File

@ -1,10 +1,11 @@
# Tloto / Prediqo — HTTPS sur 443 (URL publique sans port : https://${PREDIQO_DOMAIN})
server {
listen 443 ssl;
http2 on;
server_name ${PREDIQO_DOMAIN};
server_name ${PREDIQO_DOMAIN} ${PREDIQO_DOMAIN_WWW};
ssl_certificate /etc/letsencrypt/live/${CERT_PRIMARY_DOMAIN}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/${CERT_PRIMARY_DOMAIN}/privkey.pem;
ssl_certificate /etc/letsencrypt-prediqo/live/${PREDIQO_CERT_NAME}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt-prediqo/live/${PREDIQO_CERT_NAME}/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
@ -16,7 +17,7 @@ server {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Proto https;
proxy_buffering off;
proxy_request_buffering off;
proxy_connect_timeout 60s;
@ -30,7 +31,7 @@ server {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Proto https;
client_max_body_size 200m;
client_body_timeout 1800s;
proxy_connect_timeout 60s;
@ -45,7 +46,7 @@ server {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Proto https;
proxy_connect_timeout 60s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
@ -57,7 +58,7 @@ server {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Proto https;
}
location /ws/ {
@ -68,7 +69,7 @@ server {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Proto https;
proxy_read_timeout 86400;
}
@ -78,6 +79,6 @@ server {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Proto https;
}
}

View File

@ -1,6 +1,7 @@
# HTTP : ACME + redirection HTTPS (Salon + Tloto)
server {
listen 80;
server_name ${SALON_DOMAIN1} ${SALON_DOMAIN2} ${PREDIQO_DOMAIN};
server_name ${SALON_DOMAIN1} ${SALON_DOMAIN2} ${PREDIQO_DOMAIN} ${PREDIQO_DOMAIN_WWW};
location /.well-known/acme-challenge/ {
root /var/www/certbot;
@ -11,6 +12,7 @@ server {
}
}
# Salon — HTTPS
server {
listen 443 ssl;
http2 on;

View File

@ -363,6 +363,7 @@ services:
environment:
CERTBOT_DOMAIN: ${CERTBOT_DOMAIN1}
CERTBOT_DOMAIN1: ${CERTBOT_DOMAIN1}
CERTBOT_DOMAIN2: ${CERTBOT_DOMAIN2:-www.${CERTBOT_DOMAIN1}}
PREDIQO_HTTPS_PORT: ${PREDIQO_HTTPS_PORT:-9443}
volumes:
- letsencrypt:/etc/letsencrypt
@ -383,7 +384,8 @@ services:
- prediqo-net
# Let's Encrypt gratuit — validation DNS (sans utiliser le port 80 du VPS).
# Interactif : certbot affiche l'enregistrement TXT à créer chez redirectme.net.
# Interactif : Certbot affiche un TXT par domaine (apex + www).
# .env : CERTBOT_DOMAIN1=tloto.net CERTBOT_DOMAIN2=www.tloto.net
certbot-dns-init:
image: certbot/certbot:v2.11.0
profiles: ["dns-init"]
@ -393,7 +395,10 @@ services:
certonly --manual
--preferred-challenges dns
--email ${CERTBOT_EMAIL}
--cert-name ${CERTBOT_DOMAIN1}
-d ${CERTBOT_DOMAIN1}
-d ${CERTBOT_DOMAIN2:-www.${CERTBOT_DOMAIN1}}
--expand
--agree-tos --no-eff-email
--manual-public-ip-logging-ok
networks:

View File

@ -1,7 +1,7 @@
# HTTP → redirection vers HTTPS sur le port public dédié (ex. 9443).
server {
listen 80;
server_name ${CERTBOT_DOMAIN1};
server_name ${CERTBOT_DOMAIN1} ${CERTBOT_DOMAIN2};
resolver 127.0.0.11 valid=30s ipv6=off;
location /.well-known/acme-challenge/ {
@ -17,7 +17,7 @@ server {
server {
listen 443 ssl;
http2 on;
server_name ${CERTBOT_DOMAIN1};
server_name ${CERTBOT_DOMAIN1} ${CERTBOT_DOMAIN2};
resolver 127.0.0.11 valid=30s ipv6=off;
ssl_certificate /etc/letsencrypt/live/${CERTBOT_DOMAIN}/fullchain.pem;