commit 150c2299063d178a1bbf8c89b9e70ff34c3b0a98 Author: Pierre Date: Mon Aug 24 08:52:58 2026 +0000 Initial commit: Architecture globale + infrastructure diff --git a/architecture.md b/architecture.md new file mode 100644 index 0000000..f70dabf --- /dev/null +++ b/architecture.md @@ -0,0 +1,253 @@ +# SecourIT - Architecture Infrastructure + +Vue d'ensemble de l'infrastructure hébergée sur Proxmox VE. + +## Cartographie globale + +```mermaid +graph TB + subgraph Internet + User[Utilisateurs] + DNS[Infomaniak DNS] + end + + subgraph "OVH KS-2 (51.195.5.147)" + subgraph "Proxmox VE" + subgraph "LXC 100 - nginx-proxy (10.10.10.2)" + NPM[Nginx Proxy Manager] + Secourit[secourit.fr
Site statique] + Wolfsoul[wolfsoulbikers.fr
Site statique] + AJD[ajd.secourit.fr
Site statique] + end + + subgraph "LXC 101 - postgres (10.10.10.10)" + PG[(PostgreSQL 17)] + end + + subgraph "LXC 102 - mariadb (10.10.10.11)" + MDB[(MariaDB)] + end + + subgraph "LXC 103 - dyna-prod (10.10.10.20)" + DynaBack[Dyna Backend
Express :3000] + DynaFront[Dyna Frontend
React/Vite :3001] + end + + subgraph "LXC 104 - gestion-prod (10.10.10.21)" + Gestion[Gestion
Next.js :3005] + end + + subgraph "LXC 105 - jellyfin (10.10.10.22)" + Jellyfin[Jellyfin
Media Server :8096] + end + + subgraph "LXC 106 - csv-prod (10.10.10.23)" + CSVBack[CSV Backend
Express :3002] + CSVFront[CSV Frontend
React/Vite :3003] + end + + subgraph "LXC 107 - web-prod (10.10.10.24)" + Wycz[Wycz
Express :3004] + Portugais[Portugais
Express :3007] + end + + subgraph "LXC 108 - gitea (10.10.10.25)" + Gitea[Gitea
Git Server :3000] + end + + subgraph "LXC 110 - preprod (10.10.10.30)" + DynaPre[Dyna Preprod
:3100 + :3101] + GestionPre[Gestion Preprod
:3105] + end + end + + subgraph "Stockage" + RAID[RAID5 md0
/srv/media
3.6 To] + KDrive[kDrive
Backups] + end + end + + DNS --> NPM + User --> DNS + NPM --> Secourit + NPM --> Wolfsoul + NPM --> AJD + NPM --> DynaFront + NPM --> Gestion + NPM --> Jellyfin + NPM --> CSVFront + NPM --> Wycz + NPM --> Portugais + NPM --> Gitea + NPM --> DynaPre + NPM --> GestionPre + + DynaFront --> DynaBack + DynaBack --> MDB + Gestion --> PG + CSVFront --> CSVBack + CSVBack --> MDB + + DynaPre --> MDB + GestionPre --> PG + + Jellyfin -.->|lecture| RAID + + KDrive -.->|backup| MDB + KDrive -.->|backup| PG +``` + +## Flux réseau + +```mermaid +graph LR + subgraph "WAN (vmbr0)" + WAN[51.195.5.147] + end + + subgraph "NAT/DNAT" + DNAT[DNAT Rules] + end + + subgraph "LAN (localnet 10.10.10.0/24)" + LXC100[10.10.10.2
NPM] + LXC101[10.10.10.10
PostgreSQL] + LXC102[10.10.10.11
MariaDB] + LXC103[10.10.10.20
Dyna] + LXC104[10.10.10.21
Gestion] + LXC105[10.10.10.22
Jellyfin] + LXC106[10.10.10.23
CSV] + LXC107[10.10.10.24
Web] + LXC108[10.10.10.25
Gitea] + LXC110[10.10.10.30
Preprod] + end + + WAN -->|80,443| DNAT + DNAT --> LXC100 + WAN -->|8096| LXC105 + WAN -->|3001| LXC103 + WAN -->|3005| LXC104 +``` + +## Dépendances entre projets + +```mermaid +graph TD + subgraph "Bases de données" + MariaDB[(MariaDB
LXC 102)] + PostgreSQL[(PostgreSQL
LXC 101)] + end + + subgraph "Applications" + Dyna[Dyna
LXC 103] + Gestion[Gestion
LXC 104] + CSV[CSV
LXC 106] + DynaPre[Dyna Preprod
LXC 110] + GestionPre[Gestion Preprod
LXC 110] + end + + subgraph "Infrastructure" + NPM[Nginx Proxy Manager
LXC 100] + Gitea[Gitea
LXC 108] + Backup[Backup Script
Proxmox Host] + end + + Dyna -->|dynasqy| MariaDB + Dyna -->|dynasqy_preprod| MariaDB + CSV -->|csv| MariaDB + CSV -->|csv_preprod| MariaDB + Gestion -->|gestion_secourit| PostgreSQL + Gestion -->|gestion_secourit_preprod| PostgreSQL + DynaPre -->|dynasqy_preprod| MariaDB + GestionPre -->|gestion_secourit_preprod| PostgreSQL + + NPM -.->|SSL + proxy| Dyna + NPM -.->|SSL + proxy| Gestion + NPM -.->|SSL + proxy| CSV + + Backup -.->|dump MariaDB| MariaDB + Backup -.->|dump PostgreSQL| PostgreSQL + Backup -.->|upload| KDrive[kDrive] +``` + +## Domaines et SSL + +```mermaid +graph LR + subgraph "Domaines wildcard" + A[secourit.fr] -->|A record| IP[51.195.5.147] + B[*.secourit.fr] -->|A record| IP + end + + subgraph "Certificats Let's Encrypt" + C1[dyna.secourit.fr] + C2[gestion.secourit.fr] + C3[secourit.fr] + C4[wolfsoulbikers.fr] + C5[ajd.secourit.fr] + C6[tv.secourit.fr] + C7[csv.secourit.fr] + C8[wycz.fr + www] + C9[portugal.secourit.fr] + C10[git.secourit.fr] + C11[dyna-preprod.secourit.fr] + C12[gestion-preprod.secourit.fr] + end +``` + +## Sauvegardes + +```mermaid +graph LR + subgraph "Proxmox Host" + Cron[Cron
Dim 3h00] + Script[/usr/local/bin/
proxmox-backup.sh] + end + + subgraph "Sources" + MariaDB[(MariaDB)] + PG[(PostgreSQL)] + Nginx[/etc/nginx/
sites/] + DynaData[/opt/dyna/
uploads + gallery] + GestionData[/opt/gestion/
app] + GiteaData[/opt/gitea/
data] + PVEConf[/etc/pve/] + end + + subgraph "Destination" + KDrive[kDrive
rclone] + end + + Cron --> Script + Script --> MariaDB + Script --> PG + Script --> Nginx + Script --> DynaData + Script --> GestionData + Script --> GiteaData + Script --> PVEConf + Script --> KDrive + + KDrive -.->|Retention 3| Old[Suppression
anciens backups] +``` + +## Sécurité + +| Mesure | Détail | +|--------|--------| +| SSH | Clé SSH uniquement (pas de mot de passe) | +| fail2ban | Protection brute force SSH | +| SSL | Let's Encrypt sur tous les domaines via NPM | +| Firewall | UFW sur Proxmox host | +| Isolation | Chaque service dans son propre LXC | +| BDD | Utilisateurs dédiés par appli, pas d'accès root | + +## Fichiers clés + +| Fichier | Emplacement | Description | +|---------|-------------|-------------| +| Backup script | `/usr/local/bin/proxmox-backup.sh` | Script hebdomadaire de sauvegarde | +| rclone config | `/root/.config/rclone/rclone.conf` | Config kDrive | +| Backup log | `/var/log/proxmox-backup.log` | Log des sauvegardes | +| NPM config | LXC 100, Docker volume | Nginx Proxy Manager | +| Gitea data | LXC 108, Docker volume | Données Git | diff --git a/infrastructure.md b/infrastructure.md new file mode 100644 index 0000000..0068ec8 --- /dev/null +++ b/infrastructure.md @@ -0,0 +1,101 @@ +# Infrastructure SecourIT - Proxmox VE + +Architecture d'infrastructure hébergée sur serveur OVH KS-2, migration vers Proxmox VE avec conteneurs LXC. + +## Serveur physique + +- **Modèle** : OVH KS-2 +- **CPU** : 4 cœurs +- **RAM** : 32 Go +- **Stockage** : 4x 1.8 TB SATA (HGST HUS724020AL) +- **OS** : Proxmox VE (sur sda) +- **RAID** : md0 (RAID5) sur sdb+sdc+sdd, `/srv/media` (3.6 To, ext4) + +## Réseau + +| Interface | IP | Description | +|-----------|-----|-------------| +| vmbr0 | 51.195.5.147/24 | Bridge principal (WAN) | +| localnet | 10.10.10.0/24 | SDN local pour LXC | + +- **NAT/Masquerade** : vmbr0 vers localnet +- **DNAT** : ports 80, 443, 81, 3001, 3005 vers 10.10.10.2 +- **SSH** : Clé SSH uniquement (pas de mot de passe) +- **Firewall** : fail2ban + +## Carte des conteneurs + +| LXC | Hostname | IP | Description | Domaine | +|-----|----------|-----|-------------|---------| +| 100 | nginx-proxy | 10.10.10.2 | Nginx Proxy Manager + sites statiques | secourit.fr, wolfsoulbikers.fr, ajd.secourit.fr | +| 101 | postgres | 10.10.10.10 | PostgreSQL 17 | - | +| 102 | mariadb | 10.10.10.11 | MariaDB (dynasqy + csv) | - | +| 103 | dyna-prod | 10.10.10.20 | Club DynaSQY (Docker) | dyna.secourit.fr | +| 104 | gestion-prod | 10.10.10.21 | SecourIT Gestion (Next.js) | gestion.secourit.fr | +| 105 | jellyfin | 10.10.10.22 | Jellyfin Media Server (Docker) | tv.secourit.fr | +| 106 | csv-prod | 10.10.10.23 | CSV Vie Locale (Docker) | csv.secourit.fr | +| 107 | web-prod | 10.10.10.24 | Wycz + Portugais (Docker) | wycz.fr, portugal.secourit.fr | +| 108 | gitea | 10.10.10.25 | Gitea Git Server (Docker) | git.secourit.fr | +| 110 | preprod | 10.10.10.30 | Preprod Dyna + Gestion (Docker) | dyna-preprod.secourit.fr, gestion-preprod.secourit.fr | + +## Bases de données + +### MariaDB (LXC 102, 10.10.10.11) + +| Base | Utilisateur | Description | +|------|-------------|-------------| +| dynasqy | dynausr / L0relei69 | Données DynaSQY (membres, événements, logs) | +| csv | csvusr / Fdp1989Dor@ | Données CSV (articles, événements, annonces) | +| dynasqy_preprod | dynausr | Données DynaSQY preprod | +| csv_preprod | csvusr | Données CSV preprod | + +### PostgreSQL (LXC 101, 10.10.10.10) + +| Base | Utilisateur | Description | +|------|-------------|-------------| +| gestion_secourit | gestion_user / L0relei69 | Données Gestion prod | +| gestion_secourit_preprod | gestion_user | Données Gestion preprod | + +## SSL / Certificats + +Tous les certificats Let' Encrypt sont gérés via Nginx Proxy Manager (API) : + +| Domaine | Proxy Host ID | Cert ID | Destination | +|---------|---------------|---------|-------------| +| dyna.secourit.fr | 1 | 1 | 10.10.10.20:3001 | +| gestion.secourit.fr | 2 | 2 | 10.10.10.21:3005 | +| secourit.fr | 3 | 3 | 172.18.0.4:80 | +| wolfsoulbikers.fr | 4 | 4 | 172.18.0.5:80 | +| ajd.secourit.fr | 5 | 5 | 172.18.0.6:80 | +| tv.secourit.fr | 6 | 6 | 10.10.10.22:8096 | +| csv.secourit.fr | 9 | 9 | 10.10.10.23:3003 | +| wycz.fr + www | 10 | 10 | 10.10.10.24:3004 | +| portugal.secourit.fr | 11 | 11 | 10.10.10.24:3007 | +| git.secourit.fr | 12 | 12 | 10.10.10.25:3000 | +| dyna-preprod.secourit.fr | 15 | 13 | 10.10.10.30:3101 | +| gestion-preprod.secourit.fr | 16 | 14 | 10.10.10.30:3105 | + +## Sauvegardes + +- **Script** : `/usr/local/bin/proxmox-backup.sh` +- **Fréquence** : Chaque dimanche à 3h00 (cron) +- **Destination** : kDrive via rclone (remote `kdrive`, user `pierre@secourit.fr`) +- **Rétention** : 3 dernières sauvegardes (les plus anciennes supprimées) +- **Contenu** : Dump MariaDB + PostgreSQL, sites nginx, données dyna, app gestion, Gitea, configs Proxmox +- **Log** : `/var/log/proxmox-backup.log` + +## Nginx Proxy Manager + +- **Container** : `nginx-proxy-manager` (LXC 100) +- **Admin** : pierre@secourit.fr / Pierre2026! +- **API** : http://localhost:81/api/tokens (POST avec identity + secret) + +## DNS + +Géré sur **Infomaniak**. Tous les enregistrements A pointent vers 51.195.5.147. + +## Fichiers importants + +- `/usr/local/bin/proxmox-backup.sh` : Script de sauvegarde +- `/root/.config/rclone/rclone.conf` : Config rclone kDrive +- `/var/log/proxmox-backup.log` : Log des sauvegardes