DOCS/todo-landing-deploy.md
Thomas Fransolet a5a8ecdb20 Documentation interne MyInfoMate / Unov
Import initial de la documentation : statut, roadmap, plans V1/V2,
specs verticales (creche, sport), audits securite, plan de test,
analyse concurrentielle et maquettes de design.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-11 11:17:01 +02:00

73 lines
2.4 KiB
Markdown

# Déploiement landing page + sécurisation prod
## Contexte
Suite à l'incident du 8 avril 2026 (recréation involontaire de Mongo lors d'un `docker-compose up -d`),
ne plus jamais toucher au `docker-compose.yml` principal pour ajouter un nouveau service.
## À faire
### 1. Créer `docker-compose-landing.yml` dans `manager-service`
Fichier dédié uniquement à la landing, sans toucher au compose principal :
```yaml
version: "3.3"
services:
myinfomate-landing:
container_name: "myinfomate-landing"
image: registry.unov.be/myinfomate/landing:latest
restart: always
networks:
- web
labels:
- "traefik.enable=true"
- "traefik.http.routers.landing.rule=Host(`myinfomate.be`)"
- "traefik.http.routers.landing.entrypoints=web"
- "traefik.http.routers.landing.middlewares=redirect@file"
- "traefik.http.routers.landing-secured.rule=Host(`myinfomate.be`)"
- "traefik.http.routers.landing-secured.entrypoints=web-secured"
- "traefik.http.routers.landing-secured.tls.certresolver=mytlschallenge"
networks:
web:
external: true
```
### 2. Builder et pusher l'image landing
```bash
cd myinfomate-landing
docker build -t registry.unov.be/myinfomate/landing:latest .
docker push registry.unov.be/myinfomate/landing:latest
```
### 3. Déployer sur le VPS
```bash
docker-compose -f docker-compose-landing.yml up -d
```
### 4. Pointer le DNS myinfomate.be vers l'IP du VPS (OVH)
Ajouter un enregistrement A : `myinfomate.be → IP_VPS`
### 5. Mettre en place un backup Mongo automatique
Le `--out /data/backup` est un chemin **à l'intérieur du conteneur** — le backup disparaît si le conteneur est recréé.
Pour persister sur l'hôte, utiliser `docker cp` après le dump :
```bash
docker exec mongodb mongodump --username admin --password XXXX \
--authenticationDatabase admin --out /data/backup
docker cp mongodb:/data/backup /srv/backups/mongo/$(date +%Y%m%d)
```
À automatiser en cron (ex: tous les jours à 3h) :
```
0 3 * * * docker exec mongodb mongodump --username admin --password XXXX --authenticationDatabase admin --out /data/backup && docker cp mongodb:/data/backup /srv/backups/mongo/$(date +\%Y\%m\%d)
```
## Règles à respecter désormais
- Toujours utiliser `-f` avec docker-compose : `docker-compose -f fichier.yml up -d`
- Ne jamais faire `docker-compose up -d` seul dans le dossier manager-service
- Faire un `mongodump` avant toute manipulation sur le VPS