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 | Auto-scaling horizontal |
| 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 Subnets
RÈGLE
Séparation stricte entre subnets publics, privés applicatifs et privés données
2.2.1 Subnets Publics (DMZ)
Subnets Publics
| Subnet | 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 Subnets Privés Applicatifs
Subnets Applicatifs
| Subnet | 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 Subnets Privés Données
Subnets Données
| Subnet | 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.3VPC Endpoints
Services Docker Internes
| Endpoint | Type | Service | Bénéfice |
|---|---|---|---|
rewapp-vpce-s3 |
Volume | MinIO/Local Storage | Stockage persistant |
rewapp-vpce-ecr |
Interface | Docker Registry | Pull images en interne |
rewapp-vpce-secrets |
Env Vars | CapRover Config | Variables d'environnement |
rewapp-vpce-cloudwatch |
Container | Prometheus/Grafana | Monitoring intégré |
AVANTAGE
Les VPC Endpoints 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 |
| Multi-AZ | 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 60 secondes - 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 |
ACM 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
@startuml
skinparam backgroundColor #FFFFFF
title Architecture Cloud REWAPP - CapRover + Docker
actor "Mobile Apps" as mobile
actor "Web Browsers" as web
cloud "Internet" {
}
package "CapRover Server" #LightBlue {
package "Reverse Proxy" #Orange {
[Traefik] as proxy
[Route 53] as dns
[WAF] as waf
}
package "VPC" #LightGreen {
package "Public" #Yellow {
[Traefik] as alb
[NAT] as nat
}
package "Private App" #LightCyan {
[Docker Container] as ecs
[Kong Gateway] as kong
}
package "Private Data" #Pink {
database "PostgreSQL" as rds
database "Redis" as redis
}
}
package "External" #LightGray {
[Budget Insight] as bi
[FCM] as fcm
[SendGrid] as sg
}
}
mobile --> dns
web --> dns
dns --> cdn
cdn --> waf
waf --> alb
alb --> kong
kong --> ecs
ecs --> rds
ecs --> redis
ecs --> nat
nat --> bi
ecs ..> fcm
ecs ..> sg
@enduml
HAUTE DISPONIBILITÉ ET RÉSILIENCE
5.1Stratégie Multi-AZ
Stratégie HA par Composant
| Composant | Stratégie HA | RTO | RPO |
|---|---|---|---|
| Application Load Balancer | Multi-AZ automatique | < 30s | N/A |
| Docker Containers | Distribution Multi-AZ | < 60s | N/A |
| PostgreSQL Container | Multi-AZ standby synchrone | < 60s | 0 |
| Redis Container | Cluster Mode Multi-AZ | < 30s | < 1s |
| Docker Network | Un par AZ (redondance) | < 30s | N/A |
5.2Auto-Scaling Docker
Configuration Auto-Scaling
| 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 | S3 |
| Backup distant | Temps réel | Illimitée | eu-west-1 (Irlande) |
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 (KMS) |
TLS 1.2+ |
| Redis Container | AES-256 |
TLS 1.2+ |
| S3 Buckets | SSE-S3 (AES-256) |
HTTPS |
| Secrets Manager | AES-256 (KMS) |
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% |
| RDS | 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:EC2/SSHBruteForce | High | Alerte + blocage IP |
| CryptoCurrency:EC2/BitcoinTool.B | High | Alerte + investigation |
| Exfiltration:S3/ObjectRead.Unusual | High | Alerte + investigation |
| Recon:EC2/PortProbeUnprotectedPort | Medium | Alerte |
CONFIGURATION PAR ENVIRONNEMENT
8.1Vue d'Ensemble
Environnements
| Environnement | URL | VPC | Isolation |
|---|---|---|---|
| Développement | dev.rewapp.fr |
rewapp-vpc-dev | VPC séparé |
| Staging | staging.rewapp.fr |
rewapp-vpc-staging | VPC séparé |
| Production | rewapp.fr |
rewapp-vpc-prod | VPC 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 |
| S3 Intelligent-Tiering | -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 Multi-AZ avec SLA 99.9%
- Scalabilité : Auto-scaling horizontal 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)