Schéma d'Infrastructure Cloud
Architecture CapRover + Docker pour la plateforme de cashback REWAPP
VUE D'ENSEMBLE DE L'INFRASTRUCTURE
1.1Introduction
L'infrastructure de REWAPP est déployée sur CapRover avec Docker Containers sur un serveur dédié hébergé par l'équipe. Cette architecture est conçue pour garantir haute disponibilité, scalabilité et sécurité renforcée à un coût optimisé (~500€/mois).
PRINCIPE FONDAMENTAL
Architecture Docker Containers avec orchestration CapRover pour une disponibilité optimale
1.2Objectifs de l'Infrastructure
Objectifs & Cibles
| Objectif | Cible | Mesure |
|---|---|---|
| Disponibilité | 99.9% SLA | < 8.76h downtime/an |
| Scalabilité | 300 000 utilisateurs | Scaling horizontal Docker |
| Latence API | < 200ms (P95) | Monitoring Prometheus/Grafana |
| Sécurité | PCI DSS + RGPD | Audit continu |
| RPO | 1 heure | Backups automatiques |
| RTO | 4 heures | Disaster Recovery |
1.3Composants Principaux
ARCHITECTURE CAPROVER
2.1Configuration du Serveur CapRover
Serveur Production
| Paramètre | Valeur | Description |
|---|---|---|
| Plateforme | CapRover |
PaaS auto-hébergé |
| Localisation | France / Europe |
Conformité RGPD |
| Coût mensuel | ~500€/mois |
Serveur dédié |
| SSL/TLS | Let's Encrypt | Certificats automatiques |
2.2Organisation des Réseaux
RÈGLE
Séparation stricte entre réseaux publics, privés applicatifs et privés données
2.2.1 Réseaux Publics (DMZ)
Réseaux Publics
| Réseau | CIDR | Zone | Usage |
|---|---|---|---|
rewapp-public-a |
10.0.1.0/24 |
Serveur principal | Traefik, Docker Network |
rewapp-public-b |
10.0.2.0/24 |
Serveur backup | Traefik (failover) |
rewapp-public-c |
10.0.3.0/24 |
Redondance | Redondance |
2.2.2 Réseaux Privés Applicatifs
Réseaux Applicatifs
| Réseau | CIDR | Zone | Usage |
|---|---|---|---|
rewapp-private-app-a |
10.0.10.0/24 |
Serveur principal | Docker Container |
rewapp-private-app-b |
10.0.11.0/24 |
Serveur backup | Docker Container |
rewapp-private-app-c |
10.0.12.0/24 |
Redondance | Docker Container |
2.2.3 Réseaux Privés Données
Réseaux Données
| Réseau | CIDR | Zone | Usage |
|---|---|---|---|
rewapp-private-data-a |
10.0.20.0/24 |
Serveur principal | PostgreSQL Container |
rewapp-private-data-b |
10.0.21.0/24 |
Serveur backup | PostgreSQL Replica |
rewapp-private-data-c |
10.0.22.0/24 |
Redondance | Redis Cluster |
2.3Points d'accès réseau interne
Services Docker Internes
| Endpoint | Type | Service | Bénéfice |
|---|---|---|---|
rewapp-vpce-minio |
Volume | MinIO/Local Storage | Stockage persistant |
rewapp-vpce-registry |
Interface | Docker Registry | Pull images en interne |
rewapp-vpce-secrets |
Env Vars | CapRover Config | Variables d'environnement |
rewapp-vpce-prometheus |
Container | Prometheus/Grafana | Monitoring intégré |
AVANTAGE
Les Points d'accès réseau interne réduisent les coûts de transfert et améliorent la sécurité
SERVICES DOCKER PAR CATÉGORIE
3.1Compute - Docker Containers
Configuration Docker Containers
| Paramètre | Valeur Production | Description |
|---|---|---|
| Cluster | rewapp-cluster-prod |
Cluster Docker principal |
| Launch Type | Docker |
Containers orchestrés par CapRover |
| vCPU par Task | 1 vCPU | Puissance de calcul |
| Memory par Task | 2 GB | Mémoire allouée |
| Tasks Min/Max | 2 / 10 | Auto-scaling |
Microservices Déployés
- Auth Service : Authentification et JWT
- User Service : Gestion des utilisateurs
- Merchant Service : Gestion des partenaires
- Transaction Service : Détection des transactions
- Points Service : Gestion des points et QR codes
- Banking Service : Intégration bancaire
- Notification Service : Push, Email, SMS
3.2Base de Données - PostgreSQL
Configuration PostgreSQL par Environnement
| Paramètre | Production | Staging | Dev |
|---|---|---|---|
| Engine | PostgreSQL 15 | PostgreSQL 15 | PostgreSQL 15 |
| Instance | db.t3.medium |
db.t3.small |
db.t3.micro |
| Storage | 100 GB gp3 | 50 GB gp3 | 20 GB gp2 |
| redondant | Oui | Non | Non |
| Read Replicas | 1 | 0 | 0 |
| Backup Retention | 30 jours | 7 jours | 1 jour |
3.3Cache - Redis Container
Configuration Redis
| Paramètre | Production | Staging |
|---|---|---|
| Engine | Redis 7.0 | Redis 7.0 |
| Node Type | cache.t3.small |
cache.t3.micro |
| Cluster Mode | Activé | Désactivé |
| Replicas | 2 | 0 |
| Encryption | TLS | TLS |
Utilisation Redis
- Sessions utilisateurs (TTL 24h)
- Cache API (TTL 5min-1h)
- QR codes temporaires (TTL 15 minutes - règle métier)
- Rate limiting counters
- Pub/Sub pour WebSocket temps réel
3.4Distribution - Nginx/Traefik
Application Load Balancer
| Paramètre | Valeur | Description |
|---|---|---|
| Nom | rewapp-alb-prod |
Load balancer principal |
| Scheme | internet-facing |
Accessible publiquement |
| Security Group | rewapp-alb-sg |
Port 443 uniquement |
| Certificat | *.rewapp.fr |
Let's Encrypt wildcard HTTPS |
Reverse Proxy (Traefik)
| Distribution | Origine | Domaine | TTL |
|---|---|---|---|
rewapp-static |
Volume statique | static.rewapp.fr | 1 an |
rewapp-assets |
MinIO / Volume local | images.rewapp.fr | 24h |
SCHÉMA D'ARCHITECTURE CLOUD
4.1Diagramme d'Architecture Global
title Architecture Cloud REWAPP - CapRover + Docker
actor mobile as "Mobile Apps"
actor web as "Web Browsers"
cloud "Internet" {
}
package "CapRover Server" {
package "Reverse Proxy" {
[Traefik] as proxy
[DNS provider externe] as dns
[WAF] as waf
}
package "Réseau Interne" {
package "Public" {
[Traefik] as alb
[NAT] as nat
}
package "Private App" {
[Docker Container] as app
[Kong Gateway] as kong
}
package "Private Data" {
database db as "PostgreSQL"
database redis as "Redis"
}
}
package "External" {
[Plaid] as bi
[FCM] as fcm
[SendGrid] as sg
}
}
mobile --> dns
web --> dns
dns --> cdn
cdn --> waf
waf --> alb
alb --> kong
kong --> app
app --> db
app --> redis
app --> nat
nat --> bi
app ..> fcm
app ..> sg
HAUTE DISPONIBILITÉ ET RÉSILIENCE
5.1Stratégie de Redondance
Stratégie HA par Composant
| Composant | Stratégie HA | RTO | RPO |
|---|---|---|---|
| Application Load Balancer | Redondance automatique | < 30s | N/A |
| Docker Containers | Distribution redondante | < 60s | N/A |
| PostgreSQL Container | Standby synchrone | < 60s | 0 |
| Redis Container | Cluster Mode redondant | < 30s | < 1s |
| Docker Network | Un par AZ (redondance) | < 30s | N/A |
5.2Scaling Docker
Configuration Scaling Docker containers
| Métrique | Scale-Out | Scale-In | Cooldown |
|---|---|---|---|
| CPU Utilization | > 70% | < 30% | 300s |
| Memory Utilization | > 80% | < 40% | 300s |
| Request Count | > 1000 req/min | < 500 req/min | 300s |
CONFIGURATION
Minimum Tasks : 2 (HA) • Maximum Tasks : 10 (limite coût) • Target Tracking : CPU 70%
5.3Disaster Recovery
Stratégie de Backup
| Ressource | Fréquence | Rétention | Stockage |
|---|---|---|---|
| PostgreSQL Automated Backup | Quotidien (2h00) | 30 jours | Backup distant |
| PostgreSQL Manual Snapshot | Hebdomadaire | 90 jours | Archive externe |
| Redis Snapshot | Quotidien | 7 jours | MinIO |
| Backup distant | Temps réel | Illimitée | VPS dédié France (backup) |
SÉCURITÉ DE L'INFRASTRUCTURE
6.1Security Groups
Traefik Security Group
rewapp-alb-sg
| Type | Protocol | Port | Source | Description |
|---|---|---|---|---|
| Inbound | HTTPS | 443 | 0.0.0.0/0 |
Trafic HTTPS public |
| Inbound | HTTP | 80 | 0.0.0.0/0 |
Redirection HTTPS |
| Outbound | All | All | 0.0.0.0/0 |
Trafic sortant |
Database Security Group
rewapp-db-sg
| Type | Protocol | Port | Source | Description |
|---|---|---|---|---|
| Inbound | TCP | 5432 | rewapp-app-sg |
Depuis applications |
| Inbound | TCP | 5432 | rewapp-bastion-sg |
Admin via bastion |
| Outbound | None | - | - | Aucun trafic sortant |
6.2Pare-feu Applicatif (WAF)
Règles WAF
| Règle | Type | Action | Description |
|---|---|---|---|
CommonRuleSet |
Managed | Block | Protection OWASP Top 10 |
SQLiRuleSet |
Managed | Block | Injection SQL |
rewapp-rate-limit |
Custom | Block | 2000 req/5min |
rewapp-geo-block |
Custom | Block | Pays à risque |
6.3Chiffrement
Chiffrement des Données
| Données | Au Repos | En Transit |
|---|---|---|
| PostgreSQL Container | AES-256 (OpenSSL) |
TLS 1.2+ |
| Redis Container | AES-256 |
TLS 1.2+ |
| MinIO Buckets | AES-256 (MinIO) |
HTTPS |
| variables d'environnement CapRover | AES-256 (OpenSSL) |
TLS 1.3 |
MONITORING ET OBSERVABILITÉ
7.1Métriques Prometheus
Métriques Clés & Seuils
| Catégorie | Métrique | Warning | Critical |
|---|---|---|---|
| Docker | CPUUtilization | > 70% | > 85% |
| PostgreSQL container | FreeStorageSpace | < 20% | < 10% |
| Redis | CacheHitRate | < 90% | < 80% |
| Traefik | TargetResponseTime | > 300ms | > 500ms |
| Traefik | HTTPCode_ELB_5XX_Count | > 10/min | > 50/min |
7.2Dashboards Grafana
7.3Sécurité & Alertes
Détection de Menaces
| Type de Menace | Sévérité | Action |
|---|---|---|
| UnauthorizedAccess:SSH/BruteForce | High | Alerte + blocage IP |
| CryptoCurrency:Server/BitcoinTool.B | High | Alerte + investigation |
| Exfiltration:MinIO/ObjectRead.Unusual | High | Alerte + investigation |
| Recon:Server/PortProbeUnprotectedPort | Medium | Alerte |
CONFIGURATION PAR ENVIRONNEMENT
8.1Vue d'Ensemble
Environnements
| Environnement | URL | réseau interne serveur | Isolation |
|---|---|---|---|
| Développement | dev.rewapp.fr |
rewapp-net-dev | réseau séparé |
| Staging | staging.rewapp.fr |
rewapp-net-staging | réseau séparé |
| Production | rewapp.fr |
rewapp-net-prod | réseau séparé |
8.2Estimation des Coûts Mensuels
Coûts par Catégorie
| Catégorie | Dev | Staging | Production |
|---|---|---|---|
| Compute (Docker) | $50 | $150 | $800 |
| Database (PostgreSQL) | $30 | $80 | $400 |
| Cache (Redis) | $15 | $25 | $150 |
| Réseau (NAT, Traefik) | $50 | $100 | $300 |
| CDN + Monitoring + Sécurité | $35 | $120 | $500 |
| TOTAL | ~$180/mois | ~$475/mois | ~$2,150/mois |
NOTE
Estimations basées sur une utilisation moyenne. Les coûts réels peuvent varier en fonction du trafic et de l'utilisation.
GESTION DES COÛTS
9.1Stratégies d'Optimisation
Optimisations Prévues
| Stratégie | Économie | Mise en Œuvre |
|---|---|---|
| Optimisation stockage DB (1 an) | -30% | À partir du mois 6 |
| Savings Plans Docker (1 an) | -20% | À partir du mois 6 |
| MinIO Lifecycle | -40% | Immédiat |
| Spot Instances (dev/staging) | -70% | Immédiat |
| Scheduled Scaling (nuit/weekend) | -20% | Immédiat |
CONCLUSION
10.1Récapitulatif
L'infrastructure REWAPP sur CapRover + Docker a été conçue pour répondre aux exigences d'une plateforme de cashback moderne à coût optimisé (~500€/mois) :
- Haute Disponibilité : Architecture redondante avec SLA 99.9%
- Scalabilité : Scaling horizontal Docker supportant 300 000 utilisateurs
- Sécurité : Conformité RGPD et PCI DSS, chiffrement bout-en-bout
- Performance : Latence API < 200ms grâce au cache multi-niveaux
- Résilience : Disaster Recovery avec RPO 1h et RTO 4h
- Observabilité : Monitoring complet avec alerting proactif
10.2Évolutions Prévues
Court Terme (6 mois)
Optimisation des containers, serveur backup géographique, sauvegardes automatisées
Moyen Terme (12 mois)
Migration vers Kubernetes (si nécessaire), Service Mesh optionnel, CDN global
Long Terme (24 mois)
Multi-région active-active, Edge computing Container@Edge, ML SageMaker (détection fraude)