feat(deploy): webhook auto-deploy Forgejo → VPS Paris (TD-04)
Some checks are pending
CI / quality (push) Waiting to run
Some checks are pending
CI / quality (push) Waiting to run
This commit is contained in:
parent
85c760abee
commit
0ae2db3d8c
6 changed files with 333 additions and 37 deletions
|
|
@ -24,9 +24,9 @@ Utilisateur (navigateur)
|
|||
┌─────────────▼───────────────┐
|
||||
│ BACKEND │
|
||||
│ Hono.js (Node.js) │
|
||||
│ Render (Frankfurt) │
|
||||
│ VPS Paris (systemd + Caddy)│
|
||||
│ — toutes les routes API │
|
||||
│ — WebSocket proxy T2 EO │
|
||||
│ — WebSocket proxy T1/T2 EO │
|
||||
└──────┬──────────────┬───────┘
|
||||
│ │
|
||||
┌──────▼──────┐ ┌────▼────────────────┐
|
||||
|
|
@ -433,17 +433,17 @@ NODE_ENV=production
|
|||
|
||||
## 9. Déploiement
|
||||
|
||||
### Hébergement Git — GitHub
|
||||
### Hébergement Git — Forgejo (auto-hébergé)
|
||||
|
||||
- Plateforme : github.com
|
||||
- Dépôt frontend : `https://github.com/germannoff/expria-frontend`
|
||||
- Dépôt backend : `https://github.com/germannoff/expria-backend`
|
||||
- Note : compte GitHub réactivé le 17 avril 2026 après restriction OFAC levée
|
||||
- Auto-deploy : disponible via Render (connecté à GitHub)
|
||||
- Plateforme : Forgejo (fork Gitea) auto-hébergé sur le VPS Moscou (`157.22.190.91`), exposé via `git.expria.app` (proxifié par un Caddy Moscou).
|
||||
- Dépôt frontend : `https://git.expria.app/hermann/expria-frontend`
|
||||
- Dépôt backend : `https://git.expria.app/hermann/expria-backend`
|
||||
- Push : HTTPS + token Forgejo (branche `main`). Un miroir SSH historique (`ssh://157.22.190.91:2222`) peut exister mais n'est pas la voie de référence.
|
||||
- Note : migration depuis GitHub actée pour s'affranchir des restrictions OFAC et reprendre la main sur l'hébergement Git.
|
||||
|
||||
### Frontend — Cloudflare Pages
|
||||
|
||||
- Source : dépôt GitHub `expria-frontend`
|
||||
- Source : dépôt Forgejo `expria-frontend`
|
||||
- Build command : `npm run build`
|
||||
- Output directory : `dist`
|
||||
- Domaine : `expria.app` (DNS pointé depuis Vercel vers Cloudflare Pages)
|
||||
|
|
@ -455,17 +455,14 @@ npm run build
|
|||
npx wrangler pages deploy dist --project-name=expria
|
||||
```
|
||||
|
||||
### Backend — Render
|
||||
### Backend — VPS Paris (HostVDS)
|
||||
|
||||
- Source : dépôt GitHub `expria-backend`
|
||||
- Type : Web Service (Node.js)
|
||||
- Région : Frankfurt (EU) — proximité utilisateurs Afrique du Nord
|
||||
- Build command : `npm run build`
|
||||
- Start command : `npm start`
|
||||
- Domaine : `api.expria.app` (certificat SSL actif)
|
||||
- URL Render : `https://expria-backend.onrender.com` (alias)
|
||||
- WebSocket : activé nativement sur Render
|
||||
- Déploiement : **automatique à chaque push sur main (GitHub → Render)**
|
||||
- Hébergement : VPS **HostVDS Paris**, IP `95.182.84.3`.
|
||||
- Source : dépôt Forgejo `expria-backend`, checkout dans `/opt/expria/expria-backend`.
|
||||
- Runtime : Node.js (v20.x) géré par **systemd** — unité `expria-backend.service` (`ExecStart=/usr/bin/node dist/index.js`, `Restart=always`). Le process écoute sur `localhost:4000`.
|
||||
- Reverse proxy : **Caddy** (v2) sert `api.expria.app` en TLS (Let's Encrypt forcé, `acme_ca` production) et proxifie vers `localhost:4000`. WebSocket (T1/T2 Live) supporté nativement par Caddy.
|
||||
- Proxy Gemini : **Cloudflare WARP** tourne en mode SOCKS5 (`socks5://127.0.0.1:40000`) sur le VPS ; **seul** le trafic WebSocket Gemini Live y est routé (via `GEMINI_PROXY_URL`, cf. §8) car l'IP du datacenter est bloquée par Google. Supabase, DeepSeek, Stripe et les clients restent en connexion directe.
|
||||
- **Auto-deploy (webhook Forgejo)** : un push sur `main` déclenche un webhook Forgejo vers `deploy.expria.app` (sous-domaine dédié, proxifié par Caddy vers un listener local `127.0.0.1:9000`). Le listener (`deploy/webhook-listener.mjs`, Node stdlib) vérifie la signature **HMAC-SHA256** (`X-Gitea-Signature`) et l'IP source (allowlist `157.22.190.91`), puis lance `deploy/deploy.sh` (git fast-forward → `npm ci` → `npm run build` → `systemctl restart expria-backend`, avec **rollback automatique** si le build ou le health-check échoue). Listener isolé sous l'utilisateur non-root `deploy` (unité `expria-deploy.service`).
|
||||
|
||||
### Base de données — Supabase
|
||||
|
||||
|
|
@ -478,8 +475,9 @@ npx wrangler pages deploy dist --project-name=expria
|
|||
```
|
||||
1. Tester localement (npm run test — tous les tests verts)
|
||||
2. Rejouer le Golden Dataset
|
||||
3. Commit + push sur GitHub (branche main)
|
||||
4. Backend : auto-deploy Render déclenché automatiquement
|
||||
3. Commit + push sur Forgejo (branche main)
|
||||
4. Backend : auto-deploy déclenché par le webhook Forgejo → VPS Paris
|
||||
(git pull → npm ci → build → restart systemd, rollback auto si échec)
|
||||
5. Déployer le frontend : npm run build && npx wrangler pages deploy dist
|
||||
6. Vérifier les URLs de production (expria.app + api.expria.app)
|
||||
7. Rejouer le Smoke Test (Groupe Z du Golden Dataset)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue