Aggiunge proxy edge con pagina di cortesia e rilascio a downtime minimo.

NPM punta a nginx locale su :3000 che resta attivo durante il restart Rails; nuovo script release_production.sh esegue migrate, build e deploy in ordine.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-13 09:31:36 +02:00
parent 208664848e
commit 949a0a01fb
6 changed files with 316 additions and 21 deletions

View File

@@ -63,6 +63,10 @@ Il flusso video **non passa da Rails**: telefono → RTMP :1935 → MediaMTX →
## Nginx Proxy Manager (HTTPS)
1. **Proxy Host** → Forward Hostname: `http://192.168.1.146:3000` (dominio principale `www.matchlivetv.it`, redirect apex `matchlivetv.it``www`)
La porta **3000** è servita dal container **`edge`** (nginx locale), non da Rails direttamente.
Durante i rilasci Rails viene mostrata una **pagina di cortesia** invece del 502 bianco di NPM.
2. **Websockets:** ON (obbligatorio per `/cable`)
3. **Custom location HLS** (spettatori):
- Location: `/hls`
@@ -154,17 +158,10 @@ curl -X POST http://192.168.1.146:3000/api/v1/auth/login \
Dalla macchina di sviluppo:
```bash
# Tar + scp (rsync non installato sul server)
tar -C /path/to/MatchLiveTV/src -czf /tmp/matchlivetv-deploy.tar.gz \
--exclude='./native/android/build' --exclude='./backend/log' --exclude='./.git' .
scp /tmp/matchlivetv-deploy.tar.gz eminux@192.168.1.146:~/
ssh eminux@192.168.1.146 'tar -xzf ~/matchlivetv-deploy.tar.gz -C ~/matchlivetv'
# Sul server
cd ~/matchlivetv/infra && docker compose -f docker-compose.prod.yml up -d --build
bash scripts/deploy/release_production.sh
```
Script: [`scripts/deploy/sync_to_server.sh`](../../scripts/deploy/sync_to_server.sh) (richiede rsync sul server).
Oppure sync manuale: [`scripts/deploy/sync_to_server.sh`](../../scripts/deploy/sync_to_server.sh), poi sul server `bash scripts/deploy/release_production.sh --local`.
---