Some checks failed
CI / test-and-build (push) Failing after 25s
Co-authored-by: Cursor <cursoragent@cursor.com>
70 lines
2.1 KiB
Markdown
70 lines
2.1 KiB
Markdown
# Gitea + CI/CD + `tloto-deploy` (nouveau VPS)
|
|
|
|
## URLs
|
|
|
|
| Service | URL |
|
|
|---------|-----|
|
|
| Gitea (temporaire IP) | http://191.215.41.53:3000/ |
|
|
| Gitea (après DNS) | https://git.tloto.net/ |
|
|
| Registry local | `127.0.0.1:5000` (non public) |
|
|
| Tloto HTTP smoke | http://191.215.41.53:9080/ |
|
|
|
|
Credentials admin Gitea : `~/gitea-admin-credentials.txt` sur le VPS.
|
|
|
|
## Architecture
|
|
|
|
- **Gitea** : dépôt central + Actions.
|
|
- **act_runner** : CI (build/tests/images) — ne déploie pas la prod directement.
|
|
- **`tloto-deploy`** : seul mécanisme prod (manuel SSH ou workflow `Deploy` via clé SSH restreinte).
|
|
- **Commandes historiques** inchangées : `sudo npm run db:migrate`, `sudo npm run phase-b:up:https`.
|
|
|
|
## Déploiement manuel (SSH)
|
|
|
|
```bash
|
|
ssh deploy@191.215.41.53
|
|
tloto-deploy --ref main --mode http
|
|
# après cutover HTTPS :
|
|
tloto-deploy --ref <sha> --mode https
|
|
tloto-deploy --rollback
|
|
```
|
|
|
|
## Déploiement manuel (Gitea UI)
|
|
|
|
1. Repo → Actions → workflow **Deploy** → Run workflow.
|
|
2. Renseigner `ref` (SHA/branche) et `mode`.
|
|
3. Secrets requis : `DEPLOY_SSH_KEY` (privé `~/gitea-deploy-ssh/id_ed25519`), `DEPLOY_SSH_HOST` (ex. `172.16.0.1`).
|
|
|
|
## CI (automatique)
|
|
|
|
Push/PR sur `main` / `master` / `develop` → workflow **CI** :
|
|
|
|
1. `npm ci` + compile backend
|
|
2. Build images Docker
|
|
3. Push vers registry local `127.0.0.1:5000/tloto-*:<sha12>`
|
|
4. **Pas** de mise en prod
|
|
|
|
## pgAdmin (Windows)
|
|
|
|
Voir `~/pgadmin-db-credentials.txt` sur le VPS. Tunnel SSH uniquement — jamais exposer 5432.
|
|
|
|
```powershell
|
|
ssh -N -L 5433:127.0.0.1:5432 deploy@191.215.41.53
|
|
```
|
|
|
|
## Rollback
|
|
|
|
- Application : `tloto-deploy --rollback` (réactive le `prev_sha`).
|
|
- PostgreSQL : **pas** de rollback automatique ; dumps dans `/var/lib/tloto/backups/` avant migrate si `schema.sql` a changé.
|
|
|
|
## Edge HTTPS `git.tloto.net`
|
|
|
|
Quand le DNS A de `git.tloto.net` pointe vers le VPS :
|
|
|
|
```bash
|
|
cd ~/edge
|
|
# placer fullchain.pem + privkey.pem dans certs/ puis décommenter le bloc 443 dans nginx.conf
|
|
sudo docker compose --profile edge up -d
|
|
# Mettre à jour ~/gitea/.env : GITEA_ROOT_URL=https://git.tloto.net/
|
|
sudo docker compose -f ~/gitea/docker-compose.yml up -d gitea
|
|
```
|