chore(monitoring): centralisation Grafana/Prometheus; dashboards 4NK; labels promtail; docs

This commit is contained in:
Nicolas Cantu 2025-09-11 12:32:58 +02:00
parent bf2c0901f4
commit 425cb21e20
4 changed files with 38 additions and 22 deletions

View File

@ -1,3 +1,11 @@
## [Unreleased]
- Build: correction Dockerfile host-api (`libgl1-mesa-glx` -> `libgl1`).
- Dev Stack: mapping Grafana sur `3100:3000` pour éviter conflits locaux.
- Réseau: exposition explicite des ports `5432` (PostgreSQL) et `6379` (Redis).
- Docs: mise à jour `docs/NETWORK.md` (Grafana 3100, checklist ports).
- Monitoring: retrait de Grafana local de cette stack; Grafana centralisé via `4NK_node/modules/grafana-central` et `4NK_node/docker-compose.yml`.
- Monitoring: retrait de Prometheus local; Prometheus centralisé via `4NK_node/modules/grafana-central` et `4NK_node/docker-compose.yml`.
- Monitoring: dashboards Grafana central ajoutés (API, Worker, Système) dans le dossier « 4NK ».
# Changelog
Toutes les modifications notables de ce projet seront documentées dans ce fichier.

View File

@ -7,7 +7,7 @@ RUN apt-get update && apt-get install -y \
tesseract-ocr \
tesseract-ocr-fra \
libtesseract-dev \
libgl1-mesa-glx \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \

View File

@ -40,7 +40,7 @@ Le système notarial 4NK_IA utilise une architecture réseau distribuée avec de
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ OpenSearch │ │ Prometheus │ │ Grafana │ │
│ │ (9200) │ │ (9090) │ │ (3000) │ │
│ │ (9200) │ │ (central) │ │ (central) │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
└─────────────────────────────────────────────────────────────────┘
```
@ -55,7 +55,7 @@ Le système notarial 4NK_IA utilise une architecture réseau distribuée avec de
| **Traefik** | 443 | HTTPS | Passerelle sécurisée |
| **Web UI** | 8081 | HTTP | Interface utilisateur |
| **MinIO Console** | 9001 | HTTP | Interface d'administration MinIO |
| **Grafana** | 3000 | HTTP | Dashboards de monitoring |
| **Grafana (centralisé)** | n/a | HTTP | Voir 4NK_node: `modules/grafana-central` |
| **Neo4j Browser** | 7474 | HTTP | Interface Neo4j |
### **Services Internes (Réseau Docker)**
@ -70,7 +70,7 @@ Le système notarial 4NK_IA utilise une architecture réseau distribuée avec de
| **AnythingLLM** | 3001 | HTTP | RAG et chat |
| **Neo4j** | 7687 | TCP | Base de données graphe |
| **OpenSearch** | 9200 | HTTP | Moteur de recherche |
| **Prometheus** | 9090 | HTTP | Métriques |
| **Prometheus (centralisé)** | n/a | HTTP | Voir 4NK_node: `modules/grafana-central` |
## 🌍 Communication Inter-Services
@ -122,8 +122,8 @@ MINIO_ENDPOINT = "minio:9000"
- targets: ['api:8000', 'worker:celery', 'postgres:5432']
scrape_interval: 15s
# Grafana (Dashboards)
- datasource: prometheus:9090
# Grafana (Dashboards centralisé)
- datasource: central/prometheus
- dashboards: ['api', 'worker', 'database']
```
@ -289,6 +289,19 @@ async def get_document_analysis(doc_id: str):
pass
```
### **Dashboards Grafana centralisés (4NK)**
- Dossier: « 4NK » dans Grafana central (`grafana-central.local:3000`)
- Dashboards spécifiques 4NK_IA_back:
- « 4NK IA Back - API » (Prometheus: job `4nk-ia-back-api`)
- « 4NK IA Back - Worker » (Loki: logs container `worker`)
- « 4NK IA Back - Système » (Prometheus: disponibilité et erreurs HTTP)
Références:
- DNS local (dnsmasq): `grafana-central.local`, `prometheus.local`, `loki.local`, `promtail.local`
- Prometheus central lit `4NK_node/modules/grafana-central/conf/prometheus.yml`
- Promtail central lit `4NK_node/modules/grafana-central/conf/promtail-config.yml`
### **2. Compression**
```python
# Gzip compression
@ -337,7 +350,7 @@ docker logs 4nk_ia-api-1
## 📋 Checklist de Déploiement Réseau
- [ ] **Ports ouverts** : 80, 443, 8081, 3000, 9001, 7474
- [ ] **Ports ouverts** : 80, 443, 8081, 9001, 7474
- [ ] **Firewall configuré** : Règles iptables/ufw
- [ ] **Certificats SSL** : Let's Encrypt ou certificats manuels
- [ ] **DNS configuré** : Résolution des noms de domaines

View File

@ -13,6 +13,8 @@ services:
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
@ -25,6 +27,8 @@ services:
command: ["redis-server", "--appendonly", "yes"]
volumes:
- redis:/data
ports:
- "6379:6379"
restart: unless-stopped
minio:
@ -91,6 +95,9 @@ services:
build:
context: ../docker/host-api
dockerfile: Dockerfile
labels:
- logging=promtail
- project=4nk_ia_back
env_file: ./.env
environment:
<<: *default-env
@ -139,6 +146,9 @@ services:
build:
context: ../
dockerfile: docker/worker/Dockerfile
labels:
- logging=promtail
- project=4nk_ia_back
env_file: ./.env
environment:
<<: *default-env
@ -159,20 +169,7 @@ services:
- host-api
restart: unless-stopped
prometheus:
image: prom/prometheus:v2.54.1
volumes:
- prometheus:/prometheus
restart: unless-stopped
grafana:
image: grafana/grafana:11.1.0
volumes:
- grafana:/var/lib/grafana
- ../services/charts:/var/lib/grafana/dashboards:ro
ports:
- "3000:3000"
restart: unless-stopped
volumes:
pgdata:
@ -181,7 +178,5 @@ volumes:
ollama:
neo4j:
opensearch:
prometheus:
grafana:
anythingllm:
api_logs: