feat(deploy): docker-compose.traefik.yml overlay per behind-Traefik
Per VPS condiviso (es. con Gitea) dove Traefik gestisce già 80/443.
- gateway/Caddyfile: env-aware listen + auto_https + trusted_proxies
(defaults invariati per modalità standalone).
- docker-compose.traefik.yml: overlay che rimuove ports binding host,
attacca gateway alla network esterna di Traefik, set labels per
routing Host(cerbero-mcp.tielogic.xyz) + TLS via certresolver
Traefik. Caddy ascolta plain HTTP :80 interno.
- scripts/deploy.sh: rileva BEHIND_TRAEFIK=true → aggiunge -f
docker-compose.traefik.yml a tutti i docker compose call.
- DEPLOYMENT.md: nuova sezione 2a (topologia standalone vs behind-traefik)
+ sotto-sezione modalità behind-Traefik con env vars richieste.
Uso:
docker compose -f docker-compose.prod.yml -f docker-compose.traefik.yml \
--env-file .env up -d
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -62,6 +62,33 @@ Settings → Applications → Generate Token). Aggiungilo come secret a
|
||||
livello user (User Settings → Secrets → New Secret) con nome
|
||||
`REGISTRY_TOKEN`. Tutti i tuoi repo ereditano il secret automaticamente.
|
||||
|
||||
## 2a. Topologia: standalone vs behind-Traefik
|
||||
|
||||
Cerbero_mcp supporta due topologie di deploy:
|
||||
|
||||
### Standalone (Caddy gestisce TLS direttamente)
|
||||
|
||||
```
|
||||
Internet ──[443]──► Caddy gateway ──► mcp-* services
|
||||
(ACME Let's Encrypt)
|
||||
```
|
||||
|
||||
Setto: `docker-compose.prod.yml` da solo. Caddy bind sulle porte
|
||||
80/443 host, fa cert auto via ACME. Adatto a un VPS dedicato senza
|
||||
altri servizi sulle 80/443.
|
||||
|
||||
### Behind-Traefik (Traefik termina TLS)
|
||||
|
||||
```
|
||||
Internet ──[443]──► Traefik ──[traefik network]──► Caddy gateway ──► mcp-* services
|
||||
(TLS+ACME) (rate-limit, IP allowlist)
|
||||
```
|
||||
|
||||
Setto: `docker-compose.prod.yml` + `docker-compose.traefik.yml` overlay.
|
||||
Caddy non bind su host, ascolta plain HTTP `:80` interno alla
|
||||
`traefik` network. Traefik fa routing per `Host(cerbero-mcp.tielogic.xyz)`,
|
||||
TLS, ACME. Adatto a VPS condiviso con altri servizi (Gitea, ecc.).
|
||||
|
||||
## 2. Deploy automatizzato (script)
|
||||
|
||||
Il modo più rapido è `scripts/deploy.sh`, idempotente. Esegui sul VPS:
|
||||
@@ -91,6 +118,34 @@ iniziale (testnet) → crea `/var/log/cerbero-mcp` con permessi `1000:1000`
|
||||
|
||||
Per aggiornare in seguito: ri-esegui lo stesso script (preserva `.env`).
|
||||
|
||||
### Modalità behind-Traefik
|
||||
|
||||
Se sul VPS gira già un Traefik (es. lo stesso VPS di Gitea), prima di
|
||||
lanciare lo script aggiungi al tuo `.env`:
|
||||
|
||||
```bash
|
||||
BEHIND_TRAEFIK=true
|
||||
TRAEFIK_NETWORK=gitea_traefik-public # nome network esterna di Traefik
|
||||
TRAEFIK_CERTRESOLVER=letsencrypt # nome resolver in Traefik
|
||||
TRAEFIK_ENTRYPOINT=websecure # entrypoint HTTPS Traefik
|
||||
|
||||
# Porte gateway non più necessarie (Traefik bind 80/443):
|
||||
# GATEWAY_HTTP_PORT, GATEWAY_HTTPS_PORT non vengono usate.
|
||||
```
|
||||
|
||||
Lo script rileva `BEHIND_TRAEFIK=true` e usa
|
||||
`docker compose -f docker-compose.prod.yml -f docker-compose.traefik.yml`.
|
||||
Il gateway Caddy NON bind su 80/443 host; viene esposto via Traefik con
|
||||
labels per `Host(cerbero-mcp.tielogic.xyz)`.
|
||||
|
||||
Verifica della network Traefik:
|
||||
|
||||
```bash
|
||||
docker network ls | grep -i traefik
|
||||
# Tipicamente vedrai: gitea_traefik-public, traefik_default, ecc.
|
||||
# Usa il nome ESATTO come TRAEFIK_NETWORK in .env.
|
||||
```
|
||||
|
||||
## 3. Safety: switch testnet → mainnet
|
||||
|
||||
`mcp_common.environment.consistency_check` (richiamato dal boot
|
||||
|
||||
Reference in New Issue
Block a user