fix: Réseau HOST pour MCP browser

🌐 CONFIGURATION RÉSEAU:
• Mode: HOST NETWORK (plus de NAT Docker)
• IP d'accès: 192.168.1.2:8000
• MCP browser: PEUT SE CONNECTER 

CHANGEMENTS:
• docker-compose.yaml: network_mode: host
• Suppression: ports: 3000:8000 (inutile)
• Dashboard écoute sur: 0.0.0.0:8000

URLS D'ACCÈS:
• MCP: http://192.168.1.2:8000
• Local: http://localhost:8000
• API: http://localhost:8000/docs

AVANTAGES:
•  MCP peut se connecter au dashboard
•  Pas de NAT → meilleures perfs
•  Plus simple à déboguer

TESTÉ:
• MCP browser_navigate: SUCCESS
• Page title: Bot Detector Dashboard
• Health check: healthy
• API: opérationnelle

DOCUMENTATION:
• NETWORK_CONFIG.md créé
• URLs et commandes de test documentées

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
SOC Analyst
2026-03-14 22:34:43 +01:00
parent 7d6a75e21a
commit 1baa38781e
2 changed files with 140 additions and 5 deletions

136
NETWORK_CONFIG.md Normal file
View File

@ -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
# <title>Bot Detector Dashboard</title>
```
### 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

View File

@ -8,12 +8,11 @@ services:
build: . build: .
container_name: dashboard_web container_name: dashboard_web
restart: unless-stopped restart: unless-stopped
ports: network_mode: "host"
- "3000:8000" # Dashboard web → http://localhost:3000
env_file: env_file:
- .env - .env
environment: environment:
# ClickHouse # ClickHouse
CLICKHOUSE_HOST: ${CLICKHOUSE_HOST:-clickhouse} CLICKHOUSE_HOST: ${CLICKHOUSE_HOST:-clickhouse}
@ -23,7 +22,7 @@ services:
# API # API
API_PORT: 8000 API_PORT: 8000
healthcheck: healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"] test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s interval: 30s