Aller au contenu

Roadmap Infrastructure ProbatioVault

🎯 Vision et Objectifs

Objectif final : Architecture haute disponibilité 99.99% sur VPC OVH Cloud souverain (Phase 4), capable de supporter 100 000+ utilisateurs avec conformité RGPD/SecNumCloud.

Architecture actuelle : VPS OVH classiques pour POC/MVP (Phase 0), suffisante pour valider le produit avec 500-1000 utilisateurs initiaux.


📊 Vue d'ensemble des phases

Phase Architecture Utilisateurs Dispo Coût/mois Statut
Phase 0 VPS classiques 500-1000 99.5% ~70€ ✅ ACTUEL (POC/MVP)
Phase 1 + Optimisations 1500-2000 99.7% ~90€ 📋 Planifié (3-6 mois)
Phase 2 + Load Balancing 5000-10000 99.9% ~150€ 📋 Planifié (6-12 mois)
Phase 3 + Haute Dispo 20000-50000 99.95% ~250€ 🔮 Futur (12-18 mois)
Phase 4 🎯 VPC Cloud 100000+ 99.99% ~300-500€ 🎯 OBJECTIF FINAL (18-24 mois)

🚀 Phase 0 : Architecture Actuelle (POC/MVP) - ✅ IMPLÉMENTÉE

Objectif

Valider le produit ProbatioVault avec les premiers utilisateurs (avocats, cabinets pilotes) tout en minimisant les coûts d'infrastructure.

Architecture

┌─────────────────────────────────────────────────────────────┐
│                    ENVIRONNEMENT DEV                        │
│                  VPS OVH 12GB - 6 vCores                    │
│                    (51.68.126.160)                          │
├─────────────────────────────────────────────────────────────┤
│ • Backend + API + SGBD + SonarQube + GitLab Runner         │
│ • Tout-en-un pour développement rapide                      │
│ • CI/CD complet                                              │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│                    ENVIRONNEMENT TEST                       │
│                  VPS OVH 4-8GB                              │
├─────────────────────────────────────────────────────────────┤
│ • Backend + API + SGBD                                      │
│ • Validation pré-production                                 │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│                  ENVIRONNEMENT PRODUCTION                   │
│                     4 VPS OVH séparés                       │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐    │
│  │   Backend    │  │     API      │  │   Database   │    │
│  │   VPS 4-8GB  │  │  VPS 4-8GB   │  │  VPS 4-8GB   │    │
│  └──────────────┘  └──────────────┘  └──────────────┘    │
│                                                             │
│  ┌──────────────┐                                          │
│  │ GitLab Runner│                                          │
│  │  VPS 2-4GB   │                                          │
│  └──────────────┘                                          │
└─────────────────────────────────────────────────────────────┘

Capacités

  • Utilisateurs simultanés : 500-1000
  • Requêtes/seconde : ~800-1200 req/s
  • Disponibilité : 99.5% (~44h downtime/an)
  • Stockage : ~50-200 GB par VPS
  • Backup : PostgreSQL quotidien (OVH Object Storage)

Limitations

Single Point of Failure (SPOF) sur chaque composant ❌ Pas de failover automatiquePas de load balancingMaintenance = DowntimeScalabilité limitée

Avantages

Coût minimal (~70€/mois) ✅ Simplicité de gestionDéploiement rapideSuffisant pour MVP/POCSouveraineté (hébergement France OVH)

Durée de vie

3-12 mois selon la croissance utilisateurs : - Si < 500 utilisateurs → Prolonger Phase 0 - Si 500-1000 utilisateurs → Préparer Phase 1 - Si > 1000 utilisateurs → Migrer vers Phase 1 rapidement


🔄 Phase 1 : Optimisations (3-6 mois)

Objectif

Améliorer les performances et la disponibilité sans changer d'architecture, pour supporter 1500-2000 utilisateurs.

Optimisations

1. Clustering Node.js avec PM2

# Backend/API : utiliser tous les CPU
pm2 start app.js -i max --name "api"

# Auto-restart en cas de crash
pm2 startup
pm2 save

Gain : x2 capacité Backend/API

2. Redis Cache

# Mettre en cache :
- Requêtes API fréquentes (GET documents, users)
- Sessions utilisateurs
- Rate limiting

Gain : -50% charge PostgreSQL

3. Connection Pooling PostgreSQL + pgBouncer

# Installer pgBouncer
apt install pgbouncer

# Configuration
max_connections = 200  # PostgreSQL
pool_size = 50         # pgBouncer

Gain : x3 connexions simultanées

4. CDN pour Assets Statiques

# Cloudflare Free
- JS/CSS/Images via CDN
- Cache 30 jours
- DDoS protection gratuite

Gain : -70% bande passante VPS

5. Monitoring Avancé

# Prometheus + Grafana
- Métriques temps réel
- Alertes proactives
- Dashboards disponibilité

Gain : Détection problèmes avant impact utilisateurs

Résultats Phase 1

Métrique Avant Après Amélioration
Utilisateurs 500-1000 1500-2000 +100%
Req/s 800-1200 1500-2500 +100%
Disponibilité 99.5% 99.7% +0.2%
Coût 70€/mois 90€/mois +20€

Investissement : ~20€/mois (Redis, monitoring) Temps : 2-3 semaines de travail


🌐 Phase 2 : Load Balancing & Réplication (6-12 mois)

Objectif

Éliminer les SPOF critiques et atteindre 99.9% de disponibilité pour supporter 5000-10000 utilisateurs.

Architecture

                      Internet
                    ┌────▼────┐
                    │Cloudflare│ ← CDN + DDoS protection
                    └────┬────┘
                 ┌───────▼───────┐
                 │  HAProxy LB   │ ← Load Balancer VPS
                 │   (VIP HA)    │
                 └───────┬───────┘
        ┌────────────────┼────────────────┐
        │                │                │
   ┌────▼────┐     ┌────▼────┐     ┌────▼────┐
   │Backend 1│     │Backend 2│     │Backend 3│ ← 3 instances
   │  (PM2)  │     │  (PM2)  │     │  (PM2)  │
   └────┬────┘     └────┬────┘     └────┬────┘
        │                │                │
        └────────────────┼────────────────┘
                   ┌─────▼─────┐
                   │  Redis    │ ← Cache partagé
                   │ (Sentinel) │
                   └─────┬─────┘
                   ┌─────▼─────┐
                   │ pgBouncer │ ← Connection pooling
                   └─────┬─────┘
              ┌──────────┼──────────┐
         ┌────▼────┐          ┌────▼────┐
         │PostgreSQL│◄────────►│PostgreSQL│ ← Streaming replication
         │  Master  │ Replication│ Replica │   (read-only)
         └────┬─────┘          └─────────┘
       ┌─────────────┐
       │ OVH Object  │ ← Backups toutes les 6h
       │  Storage    │
       └─────────────┘

Nouveaux composants

Composant Quantité Specs Rôle
HAProxy LB 1 (+1 backup Phase 3) 2GB Load balancing HTTPS
Backend/API 3 instances 4-8GB Répartition charge
Redis Sentinel 1 (+2 Phase 3) 2GB Cache + sessions
pgBouncer 1 2GB Connection pooling
PostgreSQL Replica 1 8GB Read replica + failover

Améliorations

Pas de SPOF Backend/API (3 instances) ✅ Failover PostgreSQL (replica en standby) ✅ Cache distribué (Redis) ✅ Load balancing intelligent (HAProxy) ✅ Health checks automatiques ✅ Rolling updates sans downtime

Résultats Phase 2

Métrique Phase 1 Phase 2 Amélioration
Utilisateurs 1500-2000 5000-10000 x3-5
Req/s 1500-2500 5000-8000 x3
Disponibilité 99.7% 99.9% +0.2% (8h→52min downtime/an)
Coût 90€/mois 150€/mois +60€

Investissement : ~80€/mois (+4 VPS) Temps : 4-6 semaines de travail


🏢 Phase 3 : Haute Disponibilité (12-18 mois)

Objectif

Atteindre 99.95% de disponibilité (~4h downtime/an) pour supporter 20000-50000 utilisateurs.

Améliorations Phase 3

1. HAProxy en HA (Keepalived + VRRP)

┌─────────────┐     ┌─────────────┐
│ HAProxy 1   │◄───►│ HAProxy 2   │ ← Keepalived (VIP)
│  (MASTER)   │ VRRP│  (BACKUP)   │
└─────────────┘     └─────────────┘

2. Auto-scaling Backend

# Règles auto-scaling
- Si CPU > 70% pendant 5min → +1 instance
- Si CPU < 30% pendant 10min → -1 instance
- Min: 3 instances
- Max: 10 instances

3. PostgreSQL High Availability

┌──────────────┐        ┌──────────────┐
│ PostgreSQL   │◄──────►│ PostgreSQL   │
│   Primary    │ Sync   │   Standby 1  │
└──────┬───────┘ Repl.  └──────────────┘
┌──────────────┐
│ PostgreSQL   │
│   Standby 2  │ ← Async replication
└──────────────┘

4. Redis Cluster (3 nodes + Sentinel)

┌────────┐   ┌────────┐   ┌────────┐
│ Redis1 │   │ Redis2 │   │ Redis3 │ ← Master/Slave + Sentinel
│ Master │◄─►│ Slave  │◄─►│ Slave  │   (failover automatique)
└────────┘   └────────┘   └────────┘

5. Monitoring & Alerting avancé

# Prometheus + Grafana + AlertManager
- Alertes sur 5+ canaux (Slack, PagerDuty, SMS)
- SLA tracking automatique
- Incident response playbooks

Résultats Phase 3

Métrique Phase 2 Phase 3 Amélioration
Utilisateurs 5000-10000 20000-50000 x4
Req/s 5000-8000 15000-30000 x3
Disponibilité 99.9% 99.95% +0.05% (52min→4h downtime/an)
Coût 150€/mois 250€/mois +100€

Investissement : ~100€/mois (+6 VPS) Temps : 6-8 semaines de travail


🎯 Phase 4 : VPC OVH Cloud - OBJECTIF FINAL (18-24 mois)

Vision

Architecture cloud-native souveraine sur VPC OVH Cloud, conforme SecNumCloud (préparation 2027), capable de supporter 100 000+ utilisateurs avec 99.99% de disponibilité.

Architecture Cible (spec PD-1)

┌───────────────────────────────────────────────────────────────────────────┐
│                         VPC OVH CLOUD 10.0.0.0/16                         │
│                    (Souveraineté France - RGPD native)                    │
└───────────────────────────────────────────────────────────────────────────┘

                               Internet
                         ┌────────▼────────┐
                         │  Cloudflare     │ ← CDN Global + WAF
                         │  Pro/Business   │   + DDoS protection
                         └────────┬────────┘
                         ┌────────▼────────┐
                         │   OVH Load      │ ← Load Balancer managé
                         │   Balancer      │   (HA native)
                         │   (Managed)     │
                         └────────┬────────┘
┌─────────────────────────────────┼─────────────────────────────────┐
│                    Subnet Public 10.0.1.0/24                      │
│                                 │                                 │
│                        ┌────────▼────────┐                        │
│                        │  NAT Gateway    │ ← Haute Dispo (2x)    │
│                        │      (HA)       │   Keepalived + VRRP   │
│                        └────────┬────────┘                        │
└─────────────────────────────────┼─────────────────────────────────┘
┌─────────────────────────────────┼─────────────────────────────────┐
│              Subnet Backend Privé 10.0.10.0/24                    │
│                                 │                                 │
│  ┌──────────┐  ┌──────────┐  ┌▼─────────┐  ┌──────────┐        │
│  │Backend 1 │  │Backend 2 │  │Backend 3 │  │Backend N │        │
│  │ (K8s Pod)│  │ (K8s Pod)│  │ (K8s Pod)│  │(Auto-scal│        │
│  └────┬─────┘  └────┬─────┘  └────┬─────┘  └────┬─────┘        │
│       │             │              │             │               │
│       └─────────────┼──────────────┼─────────────┘               │
│                     │              │                             │
│           ┌─────────▼──────────────▼────────┐                   │
│           │     Redis Cluster (3 nodes)     │                   │
│           │  (Cache + Sessions + BullMQ)    │                   │
│           └─────────┬───────────────────────┘                   │
└─────────────────────┼─────────────────────────────────────────┘
┌─────────────────────┼─────────────────────────────────────────┐
│          Subnet Database Privé 10.0.20.0/24                   │
│                     │                                         │
│           ┌─────────▼──────────┐                             │
│           │  PostgreSQL Managed│ ← OVH Managed Database      │
│           │    (High Avail)    │   (HA native + backups)     │
│           │   Primary + 2x     │   - Snapshots auto         │
│           │     Replicas       │   - Point-in-time recovery │
│           └────────────────────┘   - Encryption at rest     │
└───────────────────────────────────────────────────────────────┘

┌───────────────────────────────────────────────────────────────┐
│              Subnet HSM Privé 10.0.30.0/24                    │
│                                                               │
│           ┌────────────────────┐                             │
│           │   HSM OVH Cloud    │ ← FIPS 140-2 Level 3       │
│           │  (FIPS 140-2 L3)   │   Gestion clés maîtres     │
│           └────────────────────┘   mTLS uniquement           │
└───────────────────────────────────────────────────────────────┘

                         ┌──────────────┐
                         │   AWS S3     │ ← Stockage WORM
                         │    WORM      │   Backups + Documents
                         │ (Compliance) │   Conformité juridique
                         └──────────────┘

Composants Cloud-Native

1. VPC OVH Cloud OpenStack

Réseau:
  - VPC isolé 10.0.0.0/16
  - 4 subnets (Public, Backend, Database, HSM)
  - Security Groups OpenStack (firewall managé)
  - NAT Gateway HA (Keepalived)
  - Flow Logs activés (audit réseau)

Isolation:
  - Zero Trust architecture
  - Database: aucun accès Internet (air-gap)
  - HSM: isolation maximale, mTLS uniquement

2. Kubernetes (OVH Managed K8s)

Backend API:
  - Déploiement K8s natif
  - Auto-scaling (HPA): 3-50 pods
  - Rolling updates sans downtime
  - Health checks (liveness/readiness)
  - Resource limits (CPU/RAM)

Avantages:
  - Orchestration automatique
  - Self-healing (restart automatique)
  - Service mesh (Istio) optionnel
  - Zero-downtime deployments

3. PostgreSQL Managed (OVH)

Configuration:
  - Primary + 2 Replicas (sync + async)
  - Backups automatiques (PITR)
  - Snapshots toutes les 6h
  - Rétention 30 jours
  - Chiffrement at-rest + in-transit

Performance:
  - Connection pooling natif
  - Read replicas pour queries lourdes
  - Monitoring intégré
  - Auto-failover < 30 secondes

4. HSM OVH Cloud

Rôle:
  - Gestion clés de chiffrement maîtres
  - FIPS 140-2 Level 3 certifié
  - Génération clés matérielle
  - Signatures cryptographiques

Connexion:
  - mTLS uniquement
  - Isolation réseau totale
  - API HSM dédiée
  - Audit logs complets

5. AWS S3 WORM (Compliance)

Stockage:
  - Documents utilisateurs
  - Backups PostgreSQL
  - Logs d'audit

Configuration WORM:
  - Write Once Read Many
  - Conformité juridique (avocats)
  - Retention légale 10+ ans
  - Immuabilité garantie

Security Groups OpenStack (Zero Trust)

Backend Security Group

Ingress:
  - Port 443 HTTPS  Load Balancer UNIQUEMENT
  - Port 9100 Prometheus  Monitoring subnet

Egress:
  - Port 5432 PostgreSQL  Database subnet UNIQUEMENT
  - Port 6379 Redis  Backend subnet
  - Port 9000 HSM  HSM subnet (mTLS)
  - Port 443 HTTPS  Internet via NAT (APIs externes)

Database Security Group

Ingress:
  - Port 5432 PostgreSQL  Backend subnet UNIQUEMENT

Egress:
  - DENY ALL (isolation totale)

HSM Security Group

Ingress:
  - Port 9000 HSM  Backend subnet UNIQUEMENT (mTLS)

Egress:
  - DENY ALL (air-gap logique)

Capacités Phase 4

Métrique Valeur Scalabilité
Utilisateurs simultanés 100 000+ Linéaire (K8s)
Requêtes/seconde 50 000+ Auto-scaling
Disponibilité 99.99% 52 min downtime/an
Latence P95 < 100ms CDN + optimisations
Stockage Illimité S3 WORM
Backups PITR 30j Point-in-time recovery

Conformité et Souveraineté

RGPD & Juridique

Hébergement France (OVH Gravelines/Roubaix/Strasbourg) ✅ Juridiction européenne exclusive ✅ Pas de transfert hors UEWORM compliance (documents juridiques) ✅ Audit logs complets (CNIL) ✅ Chiffrement bout-en-bout (HSM)

SecNumCloud (préparation 2027)

Isolation réseau stricte (VPC + Security Groups) ✅ HSM FIPS 140-2 Level 3Traçabilité complète (VPC Flow Logs) ✅ Chiffrement souverain (clés françaises) ✅ Gestion des secrets (OVH Vault) ✅ Monitoring sécurité (SIEM)

Coûts Phase 4

Composant Quantité Prix unitaire Total/mois
K8s Managed 3-50 nodes ~30-50€/node ~150-250€
PostgreSQL Managed 1 cluster (3 nodes) ~80€ ~80€
HSM OVH 1 instance ~50€ ~50€
Load Balancer OVH 1 managé ~20€ ~20€
NAT Gateway 2 HA ~10€/chaque ~20€
Redis Managed 1 cluster ~30€ ~30€
VPC + Network - ~10€ ~10€
Monitoring/Logs - ~20€ ~20€
AWS S3 WORM ~500GB/mois ~0.023€/GB ~15€
Cloudflare Business - ~200€ ~200€
Total estimé - - ~595€/mois

Note : Coûts variables selon charge (auto-scaling K8s)

ROI Phase 4

Métrique Valeur
Coût par utilisateur (100k users) ~0.006€/user/mois
Disponibilité garantie 99.99% SLA
Temps de déploiement < 5 minutes (K8s)
Temps de recovery < 30 secondes (auto-failover)
Conformité RGPD + SecNumCloud ready

Migration vers Phase 4

Prérequis

  1. ✅ Architecture Phase ⅔ stabilisée
  2. ✅ Charge > 10 000 utilisateurs
  3. ✅ Budget infrastructure > 500€/mois validé
  4. ✅ Équipe DevOps formée Kubernetes
  5. ✅ Besoin conformité SecNumCloud

Étapes migration

Semaine 1-2:
  - Provisionner VPC OVH Cloud (Terraform PD-1)
  - Configurer Security Groups OpenStack
  - Déployer NAT Gateway HA

Semaine 3-4:
  - Migrer PostgreSQL vers Managed (snapshot + restore)
  - Configurer réplication
  - Tests de performance

Semaine 5-6:
  - Containeriser API Backend (Docker)
  - Déployer sur K8s Managed OVH
  - Tests de charge

Semaine 7-8:
  - Configurer HSM OVH Cloud
  - Migration clés de chiffrement
  - Intégration mTLS

Semaine 9-10:
  - Intégration AWS S3 WORM
  - Migration documents existants
  - Configuration lifecycle policies

Semaine 11-12:
  - Bascule DNS progressive (canary deployment)
  - Tests utilisateurs pilotes
  - Monitoring 24/7

Semaine 13-14:
  - Bascule production complète
  - Décommissionnement VPS classiques
  - Documentation ops finalisée

Durée totale : ~3-4 mois Risque : Moyen (bien planifié) Downtime : < 1 heure (bascule DNS)


📈 Comparaison des Phases

Capacité

Phase 0 (Actuel)    ████░░░░░░░░░░░░░░░░  500-1000 users
Phase 1             ████████░░░░░░░░░░░░  1500-2000 users
Phase 2             ████████████░░░░░░░░  5000-10000 users
Phase 3             ████████████████░░░░  20000-50000 users
Phase 4 (Objectif)  ████████████████████  100000+ users

Disponibilité

Phase 0 (Actuel)    99.5%   ████████████████░░░░  44h downtime/an
Phase 1             99.7%   █████████████████░░░  26h downtime/an
Phase 2             99.9%   ██████████████████░░  8.7h downtime/an
Phase 3             99.95%  ███████████████████░  4.4h downtime/an
Phase 4 (Objectif)  99.99%  ████████████████████  52min downtime/an

Coût / Utilisateur

Phase 0:  0.07€-0.14€ per user/month  (70€ / 500-1000 users)
Phase 1:  0.045-0.06€ per user/month  (90€ / 1500-2000 users)
Phase 2:  0.015-0.03€ per user/month  (150€ / 5000-10000 users)
Phase 3:  0.005-0.012€ per user/month (250€ / 20000-50000 users)
Phase 4:  0.006€ per user/month       (600€ / 100000 users)

Économie d'échelle : Le coût par utilisateur diminue avec la montée en charge.


🎯 Décision par rapport aux objectifs

Quand rester en Phase actuelle ?

  • ✅ < 500 utilisateurs
  • ✅ POC/MVP en validation
  • ✅ Budget limité (< 100€/mois)
  • ✅ Équipe réduite (1-2 devs)

Quand passer Phase 1 ?

  • ⚠️ 500-1000 utilisateurs atteints
  • ⚠️ Performance dégradée (latence > 1s)
  • ⚠️ CPU/RAM > 80% en permanence

Quand passer Phase 2 ?

  • ⚠️ > 1000 utilisateurs
  • ⚠️ SLA 99.9% requis contractuellement
  • ⚠️ Clients exigent disponibilité garantie

Quand passer Phase 4 (Objectif Final) ?

  • 🎯 > 10 000 utilisateurs
  • 🎯 Besoin conformité SecNumCloud
  • 🎯 Budget infrastructure > 500€/mois disponible
  • 🎯 Expansion internationale envisagée

📚 Documentation associée

  • terraform/SECURITY.md - Configuration sécurité actuelle
  • ansible/roles/security/README.md - Rôle Ansible security
  • PD-1 : VPC OVH Cloud - Spécification Phase 4
  • Architecture Overview - Vue d'ensemble actuelle

Dernière mise à jour : 2025-01-12 Version roadmap : 1.0.0 Statut : Phase 0 implémentée ✅ | Objectif Phase 4 🎯