- Monorepo backend/ + frontend/ + deploy/ - Backend FastAPI/SQLModel/Alembic/uv qui démarre (health check, config, i18n, base de test PostgreSQL, pytest) - docker-compose de développement (db + backend hot-reload) - Chaîne CI/CD GitHub Actions : lint + tests, build image, push GHCR, déploiement SSH sur le VPS à chaque push main - CLAUDE.md : vocabulaire du domaine, conventions, commandes Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017uUsRg7XzopkCPWimwg9ZM
36 lines
1.3 KiB
Markdown
36 lines
1.3 KiB
Markdown
# Déploiement
|
|
|
|
Le workflow [`.github/workflows/deploy.yml`](../.github/workflows/deploy.yml)
|
|
se déclenche sur **chaque push sur `main`** :
|
|
|
|
1. build de l'image `backend` ;
|
|
2. push sur `ghcr.io/<owner>/<repo>-backend` (tags `latest` et `sha-<commit>`) ;
|
|
3. copie de `deploy/docker-compose.prod.yml` sur le VPS par SSH ;
|
|
4. `docker compose -f docker-compose.prod.yml pull && up -d`.
|
|
|
|
## Secrets GitHub Actions requis
|
|
|
|
| Secret | Description |
|
|
|----------------|----------------------------------------------------------------|
|
|
| `SSH_HOST` | Hôte du VPS |
|
|
| `SSH_USER` | Utilisateur SSH |
|
|
| `SSH_KEY` | Clé privée SSH (format OpenSSH) |
|
|
| `DEPLOY_PATH` | Dossier du projet sur le VPS (ex. `/opt/benevoles`) |
|
|
| `GHCR_TOKEN` | PAT avec scope `read:packages`, pour que le VPS tire l'image |
|
|
|
|
## Préparation du VPS (une fois)
|
|
|
|
```bash
|
|
mkdir -p /opt/benevoles
|
|
cd /opt/benevoles
|
|
cat > .env <<'EOF'
|
|
POSTGRES_USER=benevoles
|
|
POSTGRES_PASSWORD=<mot de passe fort>
|
|
POSTGRES_DB=benevoles
|
|
JWT_SECRET=<secret fort>
|
|
EOF
|
|
```
|
|
|
|
Le workflow dépose `docker-compose.prod.yml` dans ce dossier et l'utilise tel
|
|
quel.
|