diff --git a/NETWORK_CONFIG.md b/NETWORK_CONFIG.md new file mode 100644 index 0000000..d64c9ac --- /dev/null +++ b/NETWORK_CONFIG.md @@ -0,0 +1,136 @@ +# 🌐 Configuration Réseau - MCP Browser + +## ✅ CONFIGURATION ACTUELLE + +### Mode: HOST NETWORK +Le dashboard utilise le réseau de l'hôte directement (pas de NAT Docker). + +**URL d'accès:** +- **MCP Browser:** `http://192.168.1.2:8000` +- **Local:** `http://localhost:8000` +- **Container:** `http://localhost:8000` (depuis l'intérieur) + +--- + +## 🔧 CONFIGURATION + +### docker-compose.yaml +```yaml +services: + dashboard_web: + network_mode: "host" + # Pas de mapping de ports nécessaire +``` + +### IP de l'hôte +```bash +hostname -I | awk '{print $1}' +# Résultat: 192.168.1.2 +``` + +--- + +## 📝 URLS À UTILISER + +### Pour le MCP Browser +``` +http://192.168.1.2:8000 # Dashboard +http://192.168.1.2:8000/health # Health check +http://192.168.1.2:8000/api/metrics # API +``` + +### Pour les tests locaux +``` +http://localhost:8000 # Dashboard +http://localhost:8000/docs # Swagger UI +``` + +--- + +## 🧪 COMMANDES DE TEST + +### Health check +```bash +curl http://localhost:8000/health +# {"status":"healthy","clickhouse":"connected"} +``` + +### Dashboard +```bash +curl http://localhost:8000 | grep title +# Bot Detector Dashboard +``` + +### API Metrics +```bash +curl http://localhost:8000/api/metrics | jq '.summary' +``` + +--- + +## ⚠️ POINTS IMPORTANTS + +### Ports utilisés +- **8000** - API + Frontend (mode host) +- ~~3000~~ - N'est plus utilisé (ancien mode bridge) + +### Avantages du mode host +- ✅ MCP peut se connecter +- ✅ Pas de NAT → meilleures perfs +- ✅ Plus simple à déboguer + +### Inconvénients +- ⚠️ Port 8000 doit être libre sur l'hôte +- ⚠️ Moins d'isolation réseau + +--- + +## 🔄 ROLLBACK (si nécessaire) + +Pour revenir au mode bridge avec mapping de ports : + +```yaml +services: + dashboard_web: + ports: + - "3000:8000" + # network_mode: null +``` + +Puis : +```bash +docker compose down +docker compose up -d +``` + +--- + +## 📊 DIAGNOSTIC + +### Vérifier que le dashboard écoute +```bash +curl http://localhost:8000/health +``` + +### Vérifier l'IP de l'hôte +```bash +hostname -I | awk '{print $1}' +``` + +### Logs du container +```bash +docker compose logs -f dashboard_web +``` + +### Status du container +```bash +docker compose ps +``` + +--- + +**Date:** 2026-03-14 +**Configuration:** HOST NETWORK +**IP Hôte:** 192.168.1.2 +**Port:** 8000 +**Status:** ✅ OPÉRATIONNEL diff --git a/docker-compose.yaml b/docker-compose.yaml index 5b3fd4b..a8cd08b 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -8,12 +8,11 @@ services: build: . container_name: dashboard_web restart: unless-stopped - ports: - - "3000:8000" # Dashboard web → http://localhost:3000 - + network_mode: "host" + env_file: - .env - + environment: # ClickHouse CLICKHOUSE_HOST: ${CLICKHOUSE_HOST:-clickhouse} @@ -23,7 +22,7 @@ services: # API API_PORT: 8000 - + healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/health"] interval: 30s