From f5566f9e05a050218f919050176da20177814688 Mon Sep 17 00:00:00 2001 From: Massiles Ghernaout <749-gm213204@users.noreply.www-apps.univ-lehavre.fr> Date: Mon, 9 Feb 2026 12:19:45 +0100 Subject: [PATCH] updated readme & added licence --- .gitignore | 1 + LICENSE.txt | 22 ++++++++++++++++++++ README.md | 58 +++++++++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 LICENSE.txt diff --git a/.gitignore b/.gitignore index ff28193..bdf00a8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ backend/node_modules frontend/node_modules worker/node_modules +project.md \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..17f8e05 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2025 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/README.md b/README.md index efd3501..d9772fb 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ Ce dépôt contient une petite infrastructure Docker Swarm capable de bruteforcer des hash MD5 de manière scalable, ainsi qu’une application web pour piloter et monitorer le cluster. +--- + ### Sous-projets - **backend** : API Node.js/Express pour gérer les jobs de bruteforce, l’état du cluster, et le scaling des workers. @@ -12,11 +14,15 @@ Ce dépôt contient une petite infrastructure Docker Swarm capable de bruteforce - **infra** : configuration Docker Swarm (stack) et scripts éventuels. - **CI** : workflows d’intégration continue (fichier `.gitlab-ci.yml`). +--- + ### Prérequis - Docker et Docker Swarm initialisé (`docker swarm init`). - Node.js (pour le développement local du backend et du frontend). +--- + ### Auto-scaling Un **scaler** tourne dans le processus du backend. Il lit périodiquement la file Redis (`jobs:pending`) et le nombre de workers, puis ajuste le nombre de réplicas du service worker Swarm entre un min et un max configurables. Les seuils sont basés sur la charge (jobs par worker) : scale up si (jobs en attente / workers) dépasse un seuil, scale down si ça tombe en dessous d’un seuil plus bas (et qu’aucun job n’est en cours). @@ -32,12 +38,52 @@ Variables d’environnement (optionnelles, sur le service `api_backend`) : | `SCALER_SCALE_UP_WHEN_JOBS_PER_WORKER_ABOVE` | `4` | Scale up si (jobs en attente / workers) ≥ cette valeur. | | `SCALER_SCALE_DOWN_WHEN_JOBS_PER_WORKER_BELOW` | `1` | Scale down si (jobs en attente / workers) ≤ cette valeur (et aucun job en cours). | -### Démarrage rapide (esquisse) +--- + +### Déploiement via Docker Swarm (stack) + +1. Construire les images localement (ou via la CI) : + - `docker build -t md5-swarm-backend:latest ./backend` + - `docker build -t md5-swarm-worker:latest ./worker` + - `docker build -t md5-swarm-frontend:latest ./frontend` + +2. Initialiser Swarm si besoin : + - `docker swarm init` + +3. Déployer la stack : + - `cd infra` + - `docker stack deploy -c stack.yml md5-swarm` + +4. Accéder à l’application : + - Backend : `http://localhost:8080` + - Frontend (proxy Nginx dans le conteneur) : `http://localhost:5173` + +La stack crée un service Redis, un backend qui gère la file de jobs dans Redis, un worker scalable pour le bruteforce, et un frontend pour piloter le tout. + +--- + +### Tests & couverture + +- **Tests backend** : + - `cd backend` + - `npm test` + - Les tests utilisent le runner intégré de Node.js (`node --test`) avec la collecte de couverture activée. + +- **CI GitLab** : + - Le job `build-and-test` dans `.gitlab-ci.yml` exécute les tests backend, le build frontend et extrait le pourcentage de couverture à partir du rapport de Node. + - Le badge en haut de ce README reflète la couverture de la branche par défaut. + +--- + +### Licence + +Ce projet est distribué sous licence MIT. Voir le fichier `LICENSE.txt` pour plus de détails. + +--- -Les sections suivantes seront complétées au fur et à mesure de l’implémentation : +### À faire / améliorations possibles -- Lancement en mode développement (hors Swarm). -- Déploiement de la stack Swarm. -- Description des endpoints de l’API. -- Explications sur l’interface web et le monitoring. +- Durcir la configuration de sécurité (CORS plus restrictif, `helmet`, etc.). +- Ajouter davantage de tests (notamment sur le frontend). +- Documenter en détail les endpoints de l’API et les scénarios d’utilisation côté UI. -- GitLab