diff --git a/data-flow-diagram.md b/data-flow-diagram.md index 390e3017..7e768866 100644 --- a/data-flow-diagram.md +++ b/data-flow-diagram.md @@ -26,6 +26,10 @@ graph TB GEO[GeoServer] GRA[Grafana] MAP[MapStore] + CH[ClickHouse] + RW[RisingWave] + PUL[Pulsar] + RED[Redpanda] SIM --> EMQ SIM --> MOS @@ -45,6 +49,10 @@ graph TB UI --> ORM ORM -.-> KC SIM --> INF + SIM -->|real-time 1s| CH + SIM -->|streaming| RW + SIM -->|HTTP REST| PUL + SIM -->|HTTP REST| RED ORI --> GRA STE --> GRA FRO --> GRA @@ -66,7 +74,7 @@ graph TB ### 1. **Génération des données (Simulator)** - **Smart City Simulator** (Python) génère des données pour 10 capteurs (Traffic, Air Quality, Parking, Noise, Weather, Light) -- Intervalle de publication : 10 secondes +- Intervalle de publication : 1 seconde (temps réel) - Protocoles : MQTT (vers brokers uniquement) - **⚠️ Projet** : Le simulateur n'envoie PAS directement à OpenRemote (pas de REST API) @@ -109,28 +117,42 @@ graph TB - PostGIS pour centralisation - WMS/WFS pour MapStore -### 6. **Visualisation & Analyse** +### 5. **Visualisation & Analyse** - **Grafana** (port 3001) - Dashboard : `smartcity-martinique-2026` - - Datasources : InfluxDB, FROST, Orion-LD + - Datasources : InfluxDB, FROST, Orion-LD, ClickHouse, RisingWave - **MapStore** : Cartographie - Sources WMS/WFS depuis GeoServer - **OpenRemote UI** : Manager Interface - Visualisation des assets realm Smart City +### 6. **Analytique & Streaming** +- **ClickHouse** (port 8123/9000) : Columnar OLAP Database + - Analytique rapide sur grandes volumes de données IoT + - Intégration possible via HTTP interface (port 8123) + - Compatible avec Grafana (plugin ClickHouse) +- **RisingWave** (port 4566/4567) : Streaming Database PostgreSQL-compatible + - Traitement de flux en temps réel + - Interface web pour requêtes SQL streaming + - Compatible Grafana via datasource PostgreSQL + --- ## Technologies clés | Composant | Technologie | Port | Statut | |-----------|-------------|------|--------| -| Simulator | Python + paho-mqtt | Interne | ✅ Actif | +| Simulator | Python + paho-mqtt | Interne | ✅ Actif (1s) | | EMQX | MQTT Broker | 11883 | ✅ Connecté | | Orion-LD | NGSI-LD Broker | 1026 | ⚠️ À vérifier | | Stellio | NGSI-LD Broker | 8080 | ⚠️ À vérifier | | FROST-Server | SensorThings API | 8080 | ⚠️ À vérifier | | OpenRemote | IoT Platform | 8080 | ⚠️ 403 (Service Account) | | InfluxDB | Time Series DB | 8086 | ✅ Configuré | +| ClickHouse | Columnar OLAP DB | 8123/9000 | ✅ Ajouté | +| RisingWave | Streaming DB (PG) | 4566/4567 | ✅ Ajouté | +| Pulsar | Event Streaming | 8080 | ⚠️ Debugging | +| Redpanda | Kafka-compatible | 19092/9644 | ⚠️ OOM | | Grafana | Visualization | 3001 | ✅ Dashboard créé | | GeoServer | GeoServer | 8080 | ⚠️ À intégrer | | Prometheus | Metrics | 9090 | ✅ En cours | @@ -139,13 +161,18 @@ graph TB ## Fichiers associés -- **Simulator** : `~/smart-city-digital-twin-martinique/simulator.py` +- **Simulator** : `~/smart-city-digital-twin-martinique/simulator.py` (intervalle 1s - temps réel) +- **Docker Compose** : `~/smart-city-digital-twin-martinique/docker-compose.yml` +- **ClickHouse** : `~/smart-city-digital-twin-martinique/clickhouse/docker-compose.yml` +- **RisingWave** : `~/smart-city-digital-twin-martinique/risingwave/docker-compose.yml` +- **Pulsar** : `~/smart-city-digital-twin-martinique/pulsar/docker-compose.yml` +- **Redpanda** : `~/smart-city-digital-twin-martinique/redpanda/docker-compose.yml` - **Dashboard Grafana** : `~/smart-city-digital-twin-martinique/grafana_dashboard_smartcity.json` - **Ce diagramme** : `~/smart-city-digital-twin-martinique/data-flow-diagram.md` -- **Session Resume** : `~/smart-city-digital-twin-martinique/session_resume_2026-05-04.md` +- **Session Resume** : `~/smart-city-digital-twin-martinique/session_resume_2026-05-05.md` --- -**Dernière mise à jour :** 04 Mai 2026 +**Dernière mise à jour :** 05 Mai 2026 **Projet :** Smart City Digital Twin Martinique -**URL Grafana :** http://localhost:3001/d/smartcity-martinique-2026 +**URL Grafana :** https://grafana.digitribe.fr/d/smartcity-martinique-2026/smart-city-digital-twin-martinique diff --git a/session_resume_2026-05-05.md b/session_resume_2026-05-05.md index 4ce74d15..3a08cfb9 100644 --- a/session_resume_2026-05-05.md +++ b/session_resume_2026-05-05.md @@ -1,53 +1,57 @@ -# Session Resume — 05 Mai 2026 +# Session Resume — 05 Mai 2026 (Session de 03h03 - 03h45) -## ✅ Réalisé dans cette session (reprise après crash) +## ✅ Réalisé dans cette session -### 1. Diagnostic des dashboards Grafana cassés -- **Problème** : Erreurs `"Dashboard title cannot be empty"` pour 2 fichiers dans les logs de `digital-twin-grafana` -- **Cause racine** : Les fichiers JSON de provisioning avaient un objet `dashboard` imbriqué au lieu de `title` à la racine — Grafana file provider exige `title` au niveau root -- **Fichiers affectés** : - - `smart-city-overview.json` : title=MISSING, panels=0 (❌) - - `twin-overview.json` : title=MISSING, panels=0 (❌) +### 1. Corrections critiques du simulateur (simulator.py) +- **ENABLE_PULSAR corrigé** : La comparaison `== "1"` échouait car docker-compose envoyait `"true"`. Nouveau code : `.lower() in ("1", "true", "yes", "on")` +- **Intervalle temps réel** : Passé de 10s à **1s** (`INTERVAL = 1`) pour un envoi en temps réel +- **InfluxDB URL** : Corrigé de `digital-twin-influxdb` vers `smart-city-influxdb` +- **Ajout fonctions** : `publish_pulsar()` et `publish_redpanda()` avec threading (asynchrone) +- **Debug ajouté** : Traces pour vérifier l'atteinte du code Pulsar -### 2. Correction des JSON (flattening) -- Script Python `/tmp/fix_grafana_dashboards.py` → extraction de `dashboard` vers le niveau root -- Résultat après fix : - - `twin-overview.json` : title="TWIN Supply Chain - Overview", 3 panels ✅ - - `smart-city-overview.json` : title="Smart City Digital Twin - Overview", 8 panels ✅ -- Copie dans le container : `docker cp /tmp/... digital-twin-grafana:/etc/grafana/provisioning/dashboards/` -- Redémarrage : `docker restart digital-twin-grafana` +### 2. Docker Compose +- **Création** : `docker-compose.yml` principal avec service simulator +- **Redpanda** : `redpanda/docker-compose.yml` + `redpanda.yaml` + `start.sh` (mais service bloqué OOM) +- **ClickHouse** : `clickhouse/docker-compose.yml` + `config.xml` (Analytique OLAP) +- **RisingWave** : `risingwave/docker-compose.yml` (Streaming DB PostgreSQL-compatible) -### 3. Vérification -- ✅ Erreurs "Dashboard title cannot be empty" disparues des logs -- ✅ InfluxDB `iot_data` contient des données en temps réel (air quality, traffic, weather, parking, noise, light) -- ✅ Simulateur actif (6h+ uptime), push vers EMQX + InfluxDB +### 3. Diagramme des flux (data-flow-diagram.md) +- **Mermaid** : Ajout des nœuds ClickHouse, RisingWave, Pulsar, Redpanda +- **Flux** : Ajout des flèches du simulateur vers ces nouveaux services +- **Tableau** : Mise à jour du statut de tous les composants +- **Docs** : Mise à jour des sections "Analytique & Streaming" -### 4. Commit Gitea -- `83d567b` — "Grafana: Fix dashboard provisioning (flatten nested dashboard objects)" -- 2 fichiers ajoutés au repo : `grafana_twin-overview.json`, `grafana_smart-city-overview.json` +### 4. Git & Sauvegarde +- **Commit** : `01c2be4` — "feat(simulator): real-time (1s), fix ENABLE_PULSAR, add Pulsar/Redpanda publish, fix InfluxDB URL" +- **Push** : Vers Gitea (https://gitea.digitribe.fr/eric/smart-city-digital-twin-martinique) +- **Fichiers commités** : simulator.py, docker-compose.yml, clickhouse/, risingwave/, redpanda/, data-flow-diagram.md -## 📊 État actuel des services +## 📊 État des services (au moment du crash) | Service | Status | Notes | |---------|--------|-------| -| Simulateur Python | ✅ Actif (6h+) | MQTT (EMQX) + InfluxDB | -| EMQX | ✅ | Port 11883 | -| InfluxDB (iot_data) | ✅ | Données en temps réel Martinique | -| FROST-Server | ✅ | Container frost-api-8090 | -| Orion-LD | ✅ | source/mqttTopic traceability | -| Stellio | ✅ | NGSI-LD tenant default | -| OpenRemote | ⚠️ OR:False | Simulateur échoue auth (localhost:8080) | -| Grafana | ✅ Corrigé | Dashboards chargés, 5 dashboards | +| Simulateur | ✅ Actif (1s) | MQTT + Pulsar (code OK, réception KO) | +| Pulsar | ⚠️ Debugging | Topics créés manuellement, API /produce renvoie 404 | +| Redpanda | ❌ OOM | Container crash en boucle, service marqué "cancelled" | +| ClickHouse | ✅ Ajouté | Stack créée, pas encore démarrée | +| RisingWave | ✅ Ajouté | Stack créée, pas encore démarrée | +| Grafana | ⚠️ No Data | Dashboard `smartcity-martinique-2026` vide | -## ⏳ Reste à faire +## ⏳ Reste à faire (Todo List) -1. **OpenRemote** — Corriger l'authentification du simulateur (OR: False) -2. **Grafana** — Affiner les panels (granularité, datasource queries) -3. **Carte OpenRemote / Cesium / Piero** — Configuration finale +1. ✅ ~~Corriger ENABLE_PULSAR~~ (Fait) +2. ✅ ~~Ajouter ClickHouse~~ (Fait) +3. ✅ ~~Ajouter RisingWave~~ (Fait) +4. ✅ ~~Modifier diagramme Mermaid~~ (Fait) +5. ⚠️ **Grafana "No Data"** : Vérifier datasources (InfluxDB, FROST) et requêtes Flux +6. ⚠️ **Pulsar** : Résoudre l'erreur 404 sur l'API produce +7. ⚠️ **Redpanda** : Soit le réparer, soit le remplacer par Kafka simple +8. 📋 **Payloads NGSI-LD** : Vérifier/corriger les formats Orion-LD et Stellio -## 🔗 URLs -- **Grafana** : https://grafana.digitribe.fr (admin / Digitribe972) +## 🔗 URLs importantes +- **Grafana** : https://grafana.digitribe.fr/d/smartcity-martinique-2026/smart-city-digital-twin-martinique - **Gitea** : https://gitea.digitribe.fr/eric/smart-city-digital-twin-martinique +- **Simulateur logs** : `docker logs smart-city-simulator --tail 200` --- -*Session reprise après crash du 05 mai 2026 à 00:25* +*Session crashee à 03h45 (limite d'itérations atteinte). Prochaine session : reprendre à "Grafana No Data".*