|
| 1 | +# Cahier des charges — Web App de Monitoring VPS (version optimisée) |
| 2 | + |
| 3 | +## Contexte |
| 4 | + |
| 5 | +Le projet consiste à développer une application web de monitoring pour un VPS multi-applications basé sur : |
| 6 | + |
| 7 | +- Docker (`docker-compose`) |
| 8 | +- Reverse proxy Nginx |
| 9 | +- Plusieurs applications (Node.js, Next.js, PHP, MongoDB) |
| 10 | + |
| 11 | +Actuellement, une page statique (`/var/www/home/index.html`) sert de homepage. |
| 12 | + |
| 13 | +Elle doit être remplacée par une application dynamique de supervision. |
| 14 | + |
| 15 | +## Objectifs |
| 16 | + |
| 17 | +### Objectif principal |
| 18 | + |
| 19 | +Mettre en place une interface web permettant de : |
| 20 | + |
| 21 | +- Superviser l’état des containers Docker |
| 22 | +- Vérifier la disponibilité des applications web |
| 23 | +- Centraliser les informations techniques |
| 24 | + |
| 25 | +### Objectifs secondaires |
| 26 | + |
| 27 | +- Remplacer la homepage actuelle |
| 28 | +- Minimiser la consommation de ressources |
| 29 | +- Simplifier la maintenance |
| 30 | + |
| 31 | +## Utilisateurs |
| 32 | + |
| 33 | +### Utilisateur cible |
| 34 | + |
| 35 | +- Administrateur du VPS |
| 36 | + |
| 37 | +### Contraintes UX |
| 38 | + |
| 39 | +- Interface rapide à lire |
| 40 | +- Pas besoin d’UX complexe ou grand public |
| 41 | + |
| 42 | +## Périmètre fonctionnel |
| 43 | + |
| 44 | +### Monitoring Docker |
| 45 | + |
| 46 | +L’application doit : |
| 47 | + |
| 48 | +- Lister tous les containers Docker |
| 49 | +- Afficher pour chacun : |
| 50 | + - Nom |
| 51 | + - Statut (`running`, `exited`, `restarting`) |
| 52 | + - Ports exposés |
| 53 | + - Uptime |
| 54 | + - Image Docker |
| 55 | + |
| 56 | +États visuels |
| 57 | + |
| 58 | +- 🟢 Running |
| 59 | +- 🔴 Stopped / Exited |
| 60 | +- 🟡 Restarting |
| 61 | + |
| 62 | +### Monitoring HTTP (via Nginx) |
| 63 | + |
| 64 | +L’application doit vérifier la disponibilité des routes exposées : |
| 65 | + |
| 66 | +| Application | URL | |
| 67 | +| --- | --- | |
| 68 | +| TP Vue | `/B3dev-TP_VUE/` | |
| 69 | +| SaintBarth Volley | `/saintbarthvolley/` | |
| 70 | +| Lucky7 | `/lucky7/` | |
| 71 | +| College La Boussole | `/collegelaboussole/` | |
| 72 | +| Cinemap | `/cinemap/` | |
| 73 | + |
| 74 | +Vérifications |
| 75 | + |
| 76 | +- Code HTTP (200 attendu) |
| 77 | +- Timeout / erreur |
| 78 | + |
| 79 | +États visuels |
| 80 | + |
| 81 | +- 🟢 OK |
| 82 | +- 🔴 DOWN |
| 83 | + |
| 84 | +### Dashboard global |
| 85 | + |
| 86 | +L’interface doit afficher : |
| 87 | + |
| 88 | +- Statut global du VPS |
| 89 | +- Nombre de services OK / KO |
| 90 | +- Vue synthétique + détaillée |
| 91 | + |
| 92 | +Rafraîchissement automatique |
| 93 | + |
| 94 | +- Fréquence : toutes les 5 à 10 secondes |
| 95 | +- Mise à jour sans rechargement de page |
| 96 | + |
| 97 | +### Actions (optionnel mais recommandé) |
| 98 | + |
| 99 | +- Restart un container |
| 100 | +- Stop / Start un container |
| 101 | + |
| 102 | +## Architecture technique |
| 103 | + |
| 104 | +### Vue globale simplifiée |
| 105 | + |
| 106 | +``` |
| 107 | +Frontend statique (HTML + JS) |
| 108 | + ↓ |
| 109 | +Backend API (Node.js) |
| 110 | + ↓ |
| 111 | +Docker socket + HTTP checks |
| 112 | +``` |
| 113 | + |
| 114 | +### Backend |
| 115 | + |
| 116 | +Technologie |
| 117 | + |
| 118 | +- Node.js + Express |
| 119 | + |
| 120 | +Responsabilités |
| 121 | + |
| 122 | +- Interroger Docker via socket |
| 123 | +- Vérifier les endpoints HTTP |
| 124 | +- Fournir une API REST |
| 125 | +- Servir les fichiers frontend statiques |
| 126 | + |
| 127 | +Accès Docker |
| 128 | + |
| 129 | +Montage obligatoire : |
| 130 | + |
| 131 | +``` |
| 132 | +/var/run/docker.sock |
| 133 | +``` |
| 134 | + |
| 135 | +### Frontend (choix optimisé) |
| 136 | + |
| 137 | +Le frontend doit être : |
| 138 | + |
| 139 | +- Sans framework (pas React / Vue) |
| 140 | +- Ultra léger |
| 141 | +- Sans build |
| 142 | + |
| 143 | +Stack |
| 144 | + |
| 145 | +- HTML |
| 146 | +- CSS |
| 147 | +- JavaScript vanilla |
| 148 | + |
| 149 | +### Structure projet |
| 150 | + |
| 151 | +``` |
| 152 | +vps-monitor/ |
| 153 | +├── api/ |
| 154 | +│ ├── server.js |
| 155 | +│ └── services/ |
| 156 | +├── public/ |
| 157 | +│ ├── index.html |
| 158 | +│ ├── app.js |
| 159 | +│ └── style.css |
| 160 | +``` |
| 161 | + |
| 162 | +### Déploiement Docker |
| 163 | + |
| 164 | +Un seul service suffit : |
| 165 | + |
| 166 | +``` |
| 167 | +vps-monitor: |
| 168 | + build: ./vps-monitor |
| 169 | + container_name: vps-monitor |
| 170 | + volumes: |
| 171 | + - /var/run/docker.sock:/var/run/docker.sock |
| 172 | + ports: |
| 173 | + -"3020:3000" |
| 174 | + restart: unless-stopped |
| 175 | +``` |
| 176 | + |
| 177 | +### API (spécifications) |
| 178 | + |
| 179 | +#### GET `/api/status` |
| 180 | + |
| 181 | +Retour : |
| 182 | + |
| 183 | +``` |
| 184 | +{ |
| 185 | + "containers": [ |
| 186 | + { |
| 187 | + "name":"sbv-api", |
| 188 | + "status":"running", |
| 189 | + "ports": ["3006:5000"] |
| 190 | + } |
| 191 | + ], |
| 192 | + "websites": [ |
| 193 | + { |
| 194 | + "name":"saintbarth", |
| 195 | + "url":"/saintbarthvolley/", |
| 196 | + "status":200 |
| 197 | + } |
| 198 | + ], |
| 199 | + "globalStatus":"OK" |
| 200 | +} |
| 201 | +``` |
| 202 | + |
| 203 | +#### POST `/api/container/restart` |
| 204 | + |
| 205 | +``` |
| 206 | +{ |
| 207 | + "name":"sbv-api" |
| 208 | +} |
| 209 | +``` |
| 210 | + |
| 211 | +## Intégration Nginx |
| 212 | + |
| 213 | +### Objectif |
| 214 | + |
| 215 | +Remplacer la homepage actuelle. |
| 216 | + |
| 217 | +### Nouvelle configuration |
| 218 | + |
| 219 | +``` |
| 220 | +location / { |
| 221 | + proxy_pass http://127.0.0.1:3020; |
| 222 | + proxy_http_version 1.1; |
| 223 | + proxy_set_header Host $host; |
| 224 | + proxy_set_header X-Real-IP $remote_addr; |
| 225 | +} |
| 226 | +``` |
| 227 | + |
| 228 | +## Sécurité |
| 229 | + |
| 230 | +### Obligatoire |
| 231 | + |
| 232 | +- Authentification simple (login / password) |
| 233 | + |
| 234 | +### Risques |
| 235 | + |
| 236 | +- Accès au socket Docker = contrôle total du serveur |
| 237 | + |
| 238 | +## UX / UI |
| 239 | + |
| 240 | +### Contraintes |
| 241 | + |
| 242 | +- Interface simple |
| 243 | +- Lecture rapide |
| 244 | +- Aucune complexité inutile |
| 245 | + |
| 246 | +### Éléments |
| 247 | + |
| 248 | +- Cartes par service |
| 249 | +- Couleurs (vert / rouge / orange) |
| 250 | +- Mise à jour automatique |
| 251 | +- Indicateur global |
| 252 | + |
| 253 | +## Performance |
| 254 | + |
| 255 | +### Objectifs |
| 256 | + |
| 257 | +- Interface instantanée |
| 258 | +- Très faible consommation RAM/CPU |
| 259 | +- Aucun build frontend |
| 260 | + |
| 261 | +## Évolutions futures |
| 262 | + |
| 263 | +- Alertes (Discord / email) |
| 264 | +- Historique uptime |
| 265 | +- Graphiques CPU / RAM |
| 266 | +- Logs en temps réel |
| 267 | +- Multi-serveurs |
| 268 | + |
| 269 | +## Tests |
| 270 | + |
| 271 | +- Container arrêté |
| 272 | +- Service HTTP indisponible |
| 273 | +- Restart container |
| 274 | +- Vérification Nginx |
| 275 | + |
| 276 | +## Livrables |
| 277 | + |
| 278 | +- Backend Node.js |
| 279 | +- Frontend statique |
| 280 | +- Configuration Docker |
| 281 | +- Configuration Nginx |
| 282 | +- Documentation |
| 283 | + |
| 284 | +## Roadmap |
| 285 | + |
| 286 | +### Phase 1 (MVP) |
| 287 | + |
| 288 | +- API Docker |
| 289 | +- Endpoint `/status` |
| 290 | +- Front simple HTML |
| 291 | + |
| 292 | +### Phase 2 |
| 293 | + |
| 294 | +- Monitoring HTTP |
| 295 | +- UI améliorée |
| 296 | + |
| 297 | +### Phase 3 |
| 298 | + |
| 299 | +- Actions (restart) |
| 300 | +- Sécurité |
| 301 | + |
| 302 | +### Phase 4 |
| 303 | + |
| 304 | +- Alertes / métriques |
0 commit comments