Initial local backup snapshot

This commit is contained in:
Selecta Keke 2026-06-24 00:02:55 -03:00
commit acd9e14ba5
367 changed files with 118038 additions and 0 deletions

View file

@ -0,0 +1,33 @@
# Sécurité / session
JWT_SECRET=local-dev-change-me
# Compte administrateur principal
ADMIN_EMAIL=selectakeke973@gmail.com
# Bootstrap / amorçage admin
BOOTSTRAP_ADMIN_EMAIL=selectakeke973@gmail.com
BOOTSTRAP_ADMIN_PASSWORD=totototo
BOOTSTRAP_ADMIN_NAME=selectakeke973
BOOTSTRAP_USERS=[{"email":"william.meri@gmail.com","password":"totototo","name":"william.meri","role":"admin"}]
# URL d'application
APP_BASE_URL=https://preprod.portail-association973.com
# SMTP / emails
SMTP_PROVIDER=
SMTP_HOST=
SMTP_PORT=
SMTP_USER=
SMTP_PASS=
SMTP_FROM=
SMTP_SECURE=
SMTP_REQUIRE_TLS=
# Intégrations métier
ENTREPRISE_API_TOKEN=
# OAuth
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
FACEBOOK_APP_ID=
FACEBOOK_APP_SECRET=

View file

@ -0,0 +1,67 @@
## Préproduction portail-associations
Cette préproduction tourne sur le même VPS que la production, mais avec :
- un dossier séparé : `/home/ubuntu/portail-associations-preprod`
- une application séparée : port `3001`
- une base MySQL séparée : port `3308`
- des volumes Docker séparés
URL préproduction recommandée :
- `https://preprod.portail-association973.com`
### Déploiement
Commande recommandée depuis le poste local :
```bash
./scripts/deploy-vps.sh preprod
```
Si un déploiement manuel est nécessaire :
1. Copier le projet dans `/home/ubuntu/portail-associations-preprod`
2. Copier `deployments/preprod/.env.example` en `.env`
3. Renseigner d'abord les variables d'accès et d'amorçage admin :
- `JWT_SECRET`
- `ADMIN_EMAIL`
- `BOOTSTRAP_ADMIN_EMAIL`
- `BOOTSTRAP_ADMIN_PASSWORD`
- `BOOTSTRAP_ADMIN_NAME`
- `BOOTSTRAP_USERS`
4. Ajuster ensuite si besoin les secrets OAuth, SMTP et `APP_BASE_URL`
5. Lancer :
```bash
docker compose --env-file .env -f deployments/preprod/docker-compose.yml up -d --build
```
### Variables attendues en préproduction
Le fichier `.env` de préproduction doit au minimum couvrir les familles suivantes :
- sécurité et session :
- `JWT_SECRET`
- compte administrateur principal :
- `ADMIN_EMAIL`
- amorçage bootstrap / comptes initiaux :
- `BOOTSTRAP_ADMIN_EMAIL`
- `BOOTSTRAP_ADMIN_PASSWORD`
- `BOOTSTRAP_ADMIN_NAME`
- `BOOTSTRAP_USERS`
- URL et intégrations :
- `APP_BASE_URL`
- variables OAuth : `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET`, `FACEBOOK_APP_ID`, `FACEBOOK_APP_SECRET`
- variables SMTP : `SMTP_PROVIDER`, `SMTP_HOST`, `SMTP_PORT`, `SMTP_USER`, `SMTP_PASS`, `SMTP_FROM`, `SMTP_SECURE`, `SMTP_REQUIRE_TLS`
- `ENTREPRISE_API_TOKEN`
Le fichier modèle fourni pour cette cible reste :
- `deployments/preprod/.env.example`
### Base de données
La base `portail_associations_preprod` doit être initialisée puis alimentée par un dump de la production si l'on veut tester avec des données réalistes.

View file

@ -0,0 +1,72 @@
services:
app:
build:
context: ../..
container_name: portail-associations-preprod-app
init: true
depends_on:
db:
condition: service_healthy
environment:
NODE_ENV: production
PORT: 3000
DATABASE_URL: mysql://portail_preprod:portail_preprod_password@db:3306/portail_associations_preprod
JWT_SECRET: ${JWT_SECRET}
ADMIN_EMAIL: ${ADMIN_EMAIL}
BOOTSTRAP_ADMIN_EMAIL: ${BOOTSTRAP_ADMIN_EMAIL}
BOOTSTRAP_ADMIN_PASSWORD: ${BOOTSTRAP_ADMIN_PASSWORD}
BOOTSTRAP_ADMIN_NAME: ${BOOTSTRAP_ADMIN_NAME}
BOOTSTRAP_USERS: ${BOOTSTRAP_USERS}
SMTP_PROVIDER: ${SMTP_PROVIDER:-}
SMTP_HOST: ${SMTP_HOST:-}
SMTP_PORT: ${SMTP_PORT:-}
SMTP_USER: ${SMTP_USER:-}
SMTP_PASS: ${SMTP_PASS:-}
SMTP_FROM: ${SMTP_FROM:-}
SMTP_SECURE: ${SMTP_SECURE:-}
SMTP_REQUIRE_TLS: ${SMTP_REQUIRE_TLS:-}
APP_BASE_URL: ${APP_BASE_URL}
APP_READY_DELAY_MS: ${APP_READY_DELAY_MS:-8000}
GRACEFUL_SHUTDOWN_TIMEOUT_MS: ${GRACEFUL_SHUTDOWN_TIMEOUT_MS:-20000}
MAINTENANCE_FLAG_PATH: ${MAINTENANCE_FLAG_PATH:-/app/uploads/system/maintenance.flag}
ENTREPRISE_API_TOKEN: ${ENTREPRISE_API_TOKEN:-}
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID:-}
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET:-}
FACEBOOK_APP_ID: ${FACEBOOK_APP_ID:-}
FACEBOOK_APP_SECRET: ${FACEBOOK_APP_SECRET:-}
ports:
- "3001:3000"
volumes:
- portail_associations_preprod_uploads:/app/uploads
command: sh -c "pnpm exec drizzle-kit migrate && exec pnpm start"
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://127.0.0.1:3000/health/ready | grep '\"ok\":true' >/dev/null"]
interval: 10s
timeout: 4s
retries: 12
start_period: 25s
stop_grace_period: 25s
restart: unless-stopped
db:
image: mysql:8.4
container_name: portail-associations-preprod-db
environment:
MYSQL_DATABASE: portail_associations_preprod
MYSQL_USER: portail_preprod
MYSQL_PASSWORD: portail_preprod_password
MYSQL_ROOT_PASSWORD: root_preprod_password
ports:
- "3308:3306"
volumes:
- portail_associations_preprod_mysql:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "portail_preprod", "-pportail_preprod_password"]
interval: 5s
timeout: 5s
retries: 20
restart: unless-stopped
volumes:
portail_associations_preprod_mysql:
portail_associations_preprod_uploads: