After configuring VPS health3

This commit is contained in:
Your Name 2026-11-01 18:22:18 +02:00
parent 988ac096ea
commit a9e5693867
2 changed files with 20 additions and 5 deletions

View File

@ -222,6 +222,10 @@ services:
postgres: postgres:
condition: service_healthy condition: service_healthy
required: false required: false
# Reach Prometheus on monitoring-net (exporters stay off the public internet; no published ports).
networks:
- prediqo-net
- monitoring-net
environment: environment:
<<: *backend-env <<: *backend-env
PORT: 4000 PORT: 4000
@ -523,6 +527,12 @@ services:
networks: networks:
- monitoring-net - monitoring-net
- prediqo-net - prediqo-net
healthcheck:
test: ['CMD', 'wget', '-qO-', 'http://127.0.0.1:9090/-/healthy']
interval: 15s
timeout: 5s
retries: 5
start_period: 20s
mem_limit: 512m mem_limit: 512m
cpus: 0.50 cpus: 0.50
# Intentionally no ports: — not reachable from the public internet # Intentionally no ports: — not reachable from the public internet
@ -576,9 +586,10 @@ networks:
prediqo-net: prediqo-net:
driver: bridge driver: bridge
monitoring-net: monitoring-net:
# No host/gateway egress — exporters stay unreachable from the public internet # Dedicated bridge for exporters ↔ Prometheus. No published ports on those
# services (security). Do NOT set internal:true — it breaks dual-homed
# Prometheus reachability from crypto_wallet_api on prediqo-net.
driver: bridge driver: bridge
internal: true
volumes: volumes:
postgres_data: postgres_data:

View File

@ -43,15 +43,19 @@ const {query}=require('./dist/db/connection');
```bash ```bash
cd ~/projects_repository/games-project cd ~/projects_repository/games-project
git pull git pull
sudo npm run monitoring:up # profile monitoring sudo npm run monitoring:up
sudo npm run phase-b:up:https # rebuild backend + web # Recreate API so it joins monitoring-net (required once after this networking fix)
sudo docker compose up -d --force-recreate backend
sudo npm run phase-b:up:https
curl -sS https://tloto.net/health curl -sS https://tloto.net/health
``` ```
Vérifier qu’aucun port monitoring n’est public : Vérifier la stack monitoring + connectivité backend → Prometheus :
```bash ```bash
sudo docker compose --profile monitoring ps sudo docker compose --profile monitoring ps
sudo docker compose logs --tail=40 prometheus
sudo docker exec crypto_wallet_api node -e "fetch('http://prometheus:9090/-/healthy').then(r=>r.text()).then(console.log).catch(e=>{console.error(e);process.exit(1)})"
sudo ss -tlnp | grep -E '9090|9100|8080' || echo "OK: ports monitoring non exposés" sudo ss -tlnp | grep -E '9090|9100|8080' || echo "OK: ports monitoring non exposés"
``` ```