Aller au contenu

Vue d'ensemble

Architecture globale

PerfShop est composé de 8 services Docker qui communiquent sur un réseau bridge dédié.

┌─────────────────────────────────────────────────────────────┐
│                    perfshop-network (bridge)                 │
│                                                              │
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐  │
│  │   Frontend   │───▶│   Backend    │───▶│    MySQL     │  │
│  │ React/Nginx  │    │ Spring Boot  │    │     BDD      │  │
│  │   :9091      │    │    :9080     │    │    :3306     │  │
│  └──────────────┘    └──────────────┘    └──────────────┘  │
│                             │                               │
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐  │
│  │  Monitoring  │◀───│  Prometheus  │◀───│   Grafana    │  │
│  │  Node.js     │    │    :9092     │    │    :3002     │  │
│  │   :3001      │    └──────────────┘    └──────────────┘  │
│  └──────────────┘                                           │
│                                                              │
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐  │
│  │ Chaos Admin  │    │    Admin     │    │     Docs     │  │
│  │   :3003      │    │    :3004     │    │    :9085     │  │
│  └──────────────┘    └──────────────┘    └──────────────┘  │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│              Reverse Proxy Synology (Nginx)                 │
├─────────────────────────────────────────────────────────────┤
│  https://perfshop.perfshop.io  → :9091      │
│  https://perfshop-api.perfshop.io    → :9080      │
│  https://perfshop-monitoring.perfshop.io → :3001  │
│  https://perfshop-chaos.perfshop.io  → :3003      │
│  https://perfshop-admin.perfshop.io  → :3004      │
│  https://perfshop-grafana.perfshop.io → :3002     │
│  https://perfshop-doc.perfshop.io    → :9085      │
└─────────────────────────────────────────────────────────────┘

Flux de données

Métriques système

Docker socket ──▶ Monitoring Node.js (/metrics) ──▶ Prometheus ──▶ Grafana

Métriques navigateur

chaos-agent.js (navigateur) ──▶ POST /api/chaos/client-metrics ──▶ Monitoring Node.js
                                                                Prometheus (/metrics)
                                                                       Grafana

Chaos Backend

Panneau de contrôle ──▶ POST /api/chaos/backend/state ──▶ ChaosService.java
                                ┌─────────────────────────────────┼──────────────────┐
                                ▼                                 ▼                  ▼
                         CpuChaosScheduler               MemoryLeakService   ThreadPoolChaos

Chaos Frontend

Panneau de contrôle ──▶ GET /api/chaos/frontend/state ──▶ chaos-agent.js (polling 5s)
                                ┌─────────────────────────────────┼──────────────────┐
                                ▼                                 ▼                  ▼
                          startCpuBurn()                  startMemoryLeak()   startFetchFlood()

Propagation des URLs

.env PUBLIC_* variables
  ├─→ docker-compose environment:
  │     ├─→ perfshop-app    CORS_ALLOWED_ORIGINS  → CorsConfig.java
  │     ├─→ perfshop-frontend VITE_*              → env-inject.sh (bundle JS)
  │     ├─→ perfshop-monitoring PUBLIC_*          → server.js → window.__CONFIG__
  │     ├─→ perfshop-chaos-admin PUBLIC_API_URL   → env-inject-nginx.sh (HTML)
  │     └─→ perfshop-admin PUBLIC_API_URL         → env-inject-nginx.sh (HTML)
  └─→ grafana GF_SERVER_ROOT_URL