From 362a9d1f6b68d28421fc38dfe24ff4052d3309d8 Mon Sep 17 00:00:00 2001 From: Eric FELIXINE Date: Wed, 6 May 2026 21:26:21 -0400 Subject: [PATCH] =?UTF-8?q?Architecture=20mise=20=C3=A0=20jour=20(07=20Mai?= =?UTF-8?q?=202026)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Correction flux : Simulateur → MQTT Brokers → IoT Agents → Orion-LD/Stellio → QuantumLeap → CrateDB - IoT Agents fonctionnels (EMQX:4041, Mosquitto:4042, BunkerM:4043) - Pipeline Orion-LD validé (CrateDB: quantumleap.etairqualityobserved) - BunkerM domaine corrigé : mosquitto2.digitribe.fr:1900 - Simulateur publie sur topics smartcity-api-key/{sid}/attrs --- architecture-multi-cb.md | 161 ++++++++++++++++++----------------- docker-compose.iot-agent.yml | 6 +- 2 files changed, 87 insertions(+), 80 deletions(-) diff --git a/architecture-multi-cb.md b/architecture-multi-cb.md index a244e516..f553868c 100644 --- a/architecture-multi-cb.md +++ b/architecture-multi-cb.md @@ -1,24 +1,32 @@ -# Architecture Finale Smart City - 2 Pipelines Isolées (CORRIGÉ 18h05) +# Architecture Smart City Digital Twin - Martinique (État au 07 Mai 2026) -## Principe : Chaque Context Broker a sa propre pipeline +## Architecture Validée : Simulateur → MQTT → IoT Agents → Context Brokers → Time-Series ``` ┌─────────────────────────────────────────────────────────────────────────────┐ │ Smart City Simulator (Python) │ -│ Publie sur 3 brokers MQTT avec format IoT-Agent JSON │ +│ Publie sur 3 brokers MQTT avec format IoT-Agent JSON (30 capteurs) │ └──────────┬────────────────────┬──────────────────────┬───────────────────┘ │ │ │ ▼ ▼ ▼ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │ EMQX Broker │ │ Mosquitto Broker │ │ BunkerM Broker │ +│ (emqx_emqx_1)│ │ (smart-city- │ │ (mqtt.digitribe.│ +│ :1883 (host │ │ mosquitto) │ │ fr:1900) │ +│ 11883) │ │ :1883 (host │ │ ❌ Inaccessible │ +│ ✅ Fonctionnel │ │ 1883) │ │ depuis simu │ +│ │ │ ✅ Fonctionnel │ │ │ └────────┬─────────┘ └────────┬─────────┘ └────────┬─────────┘ │ │ │ ▼ ▼ ▼ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │ IoT-Agent-EMQX │ │IoT-Agent-Mosquitto│ │IoT-Agent-BunkerM │ -│ Port: 4041 │ │ Port: 4042 │ │ Port: 4043 │ -│ Apikey: smart- │ │ Apikey: smart- │ │ Apikey: smart- │ -│ city-api-key │ │ city-api-key │ │ city-api-key │ +│ (smart-city- │ │ (smart-city- │ │ (smart-city- │ +│ iot-agent-emqx)│ │ iot-agent- │ │ iot-agent- │ +│ :4041 │ │ mosquitto) │ │ bunkerm) │ +│ Apikey: smart- │ │ :4042 │ │ :4043 │ +│ city-api-key │ │ Apikey: smart- │ │ Apikey: bunker-│ +│ │ │ city-api-key │ │ m-api-key │ └────────┬─────────┘ └────────┬─────────┘ └────────┬─────────┘ └───────────────────────┴──────────────────────┘ │ @@ -28,23 +36,31 @@ ▼ ▼ ┌─────────────────────┐ ┌─────────────────────┐ │ Orion-LD │ │ Stellio │ -│ (port 1026) │ │ (port 8080) │ -│ MongoDB backend │ │ (API Gateway) │ +│ (smart-city- │ │ (stellio-api- │ +│ orion-ld) │ │ gateway) │ +│ Port: 1026 │ │ Port: 8080 │ +│ ✅ Fonctionnel │ │ ✅ Fonctionnel │ +│ MongoDB backend │ │ Kafka backend │ └─────────┬───────────┘ └─────────┬───────────┘ │ │ ▼ ▼ ┌─────────────────────┐ ┌─────────────────────┐ │ QuantumLeap-Orion │ │ QuantumLeap-Stellio │ -│ (port 8668) │ │ (port 8669) │ +│ (smart-city- │ │ (smart-city- │ +│ quantumleap) │ │ quantumleap) │ +│ Port: 8668 │ │ Port: 8668? │ +│ ✅ Fonctionnel │ │ (à vérifier) │ │ → CrateDB-Orion │ │ → CrateDB-Stellio │ └─────────┬───────────┘ └─────────┬───────────┘ │ │ ▼ ▼ ┌─────────────────────┐ ┌─────────────────────┐ │ CrateDB-Orion │ │ CrateDB-Stellio │ -│ (port 5432/4200) │ │ (port 5433/4201) │ -│ DB: quantumleap │ │ DB: quantumleap_ │ -│ │ │ stellio │ +│ (smart-city- │ │ (smart-city- │ +│ cratedb) │ │ cratedb) │ +│ Port: 5432/4200 │ │ Port: 5432/4200 │ +│ DB: quantumleap │ │ DB: quantumleap │ +│ ✅ Données présentes│ │ (à vérifier) │ └─────────┬───────────┘ └─────────┬───────────┘ │ │ └───────────────────────┬─────────┘ @@ -52,86 +68,77 @@ ▼ ┌─────────────────────┐ │ Grafana │ - │ (port 3001) │ + │ (digital-twin- │ + │ grafana) │ + │ Port: 3000 │ + │ https:// │ + │ grafana.digitribe│ + │ .fr │ │ 2 Datasources: │ │ - CrateDB-Orion │ │ - CrateDB-Stellio│ └─────────────────────┘ ``` -## Pipelines Complètes +## Flux de Données Validés (07 Mai 2026) -### Pipeline 1 : Orion-LD ✅ (Opérationnel) -1. Simulateur → 3 MQTT Brokers -2. 3 IoT-Agents → Orion-LD (1026) -3. **Orion-LD Subscription** → QuantumLeap-Orion (8668) ✅ -4. QuantumLeap-Orion → CrateDB-Orion (5432) ✅ -5. Grafana ← CrateDB-Orion ✅ +### Pipeline 1 : Orion-LD ✅ (Opérationnel Complet) +1. **Simulateur** → Publie sur EMQX & Mosquitto (topics `smartcity-api-key/{sid}/attrs`) ✅ +2. **IoT Agents** (EMQX & Mosquitto) → Transfèrent vers Orion-LD ✅ +3. **Orion-LD** (1026) → Reçoit les entités (`urn:ngsi-ld:AirQualityObserved:sensor001`...) ✅ +4. **QuantumLeap-Orion** (8668) → Reçoit notifications Orion-LD ✅ +5. **CrateDB-Orion** (5432) → Persistance dans `quantumleap.etairqualityobserved` ✅ + - Données vérifiées : `sensor005` (NO2=72.1, temp=31.5°C, humidité=92%) +6. **Grafana** ← Visualise données CrateDB ✅ -### Pipeline 2 : Stellio 🔄 (En cours) -1. Simulateur → 3 MQTT Brokers -2. 3 IoT-Agents → Stellio (8080) *(à configurer)* -3. **Stellio Subscription** → QuantumLeap-Stellio (8669) *(en cours)* -4. QuantumLeap-Stellio → CrateDB-Stellio (5433) ✅ -5. Grafana ← CrateDB-Stellio ✅ +### Pipeline 2 : Stellio 🔄 (À finaliser) +1. **Simulateur** → Publie sur EMQX & Mosquitto ✅ +2. **IoT Agents** → Transfèrent vers Stellio (à configurer) ⏳ +3. **Stellio** (8080) → Reçoit les entités NGSI-LD ✅ +4. **QuantumLeap-Stellio** → Reçoit notifications Stellio (à configurer) ⏳ +5. **CrateDB-Stellio** → Persistance (même CrateDB?) ⏳ +6. **Grafana** ← Visualise données ⏳ -## Configuration des Subscriptions +## États des Services (07 Mai 2026 - 21h30) -### Pour Orion-LD (déjà fait) ✅ -```bash -curl -X POST http://localhost:1026/v2/subscriptions \ - -H 'Content-Type: application/json' \ - -d '{ - "description": "Orion-LD to QuantumLeap-Orion", - "subject": {"entities": [{"idPattern": ".*", "type": "AirQualityObserved"}]}, - "notification": { - "http": {"url": "http://smart-city-quantumleap:8668/v2/op/notify"} - } - }' -``` - -### Pour Stellio (à faire) 🔄 -```bash -# Stellio utilise l'API NGSI-LD pour les subscriptions -curl -X POST http://localhost:8080/ngsi-ld/v1/subscriptions \ - -H 'Content-Type: application/ld+json' \ - -d '{ - "description": "Stellio to QuantumLeap-Stellio", - "type": "Subscription", - "entities": [{"type": "AirQualityObserved"}], - "notification": { - "endpoint": {"uri": "http://smart-city-quantumleap-stellio:8668/v2/op/notify"} - } - }' -``` - -## États des Services - -| Service | Container | Port | Statut | -|---------|-----------|------|--------| -| **Orion-LD** | smart-city-orion-ld | 1026 | ✅ Up | -| **QuantumLeap-Orion** | smart-city-quantumleap | 8668 | ✅ Up | -| **CrateDB-Orion** | smart-city-cratedb | 5432/4200 | ✅ Up | -| **Stellio** | stellio-api-gateway | 8080 | ✅ Up | -| **QuantumLeap-Stellio** | smart-city-quantumleap-stellio | 8669 | ✅ Up | -| **CrateDB-Stellio** | smart-city-cratedb-stellio | 5433/4201 | ✅ Up | -| **3 IoT-Agents** | smart-city-iot-agent-* | 4041-4043 | ✅ Up | -| **Grafana** | smart-city-grafana | 3001 | ✅ Up | +| Service | Container | Ports | Statut | Notes | +|---------|-----------|--------|--------|-------| +| **Simulateur** | `smart-city-simulator` | - | ✅ **UP** | Publie sur 2/3 brokers (EMQX ✅, Mosquitto ✅, BunkerM ❌) | +| **EMQX Broker** | `emqx_emqx_1` | 1883 (host 11883) | ✅ **UP** | Messages reçus, topics `smartcity-api-key/#` ✅ | +| **Mosquitto Broker** | `smart-city-mosquitto` | 1883 (host 1883) | ✅ **UP** | Messages reçus ✅ | +| **BunkerM Broker** | `smart-city-bunkerm` | 1900 | ❌ **Inaccessible** | `mqtt.digitribe.fr:1900` ne répond pas au simulateur | +| **IoT Agent EMQX** | `smart-city-iot-agent-emqx` | 4041 | ✅ **UP** | Reçoit et transfère vers Orion-LD/Stellio ✅ | +| **IoT Agent Mosquitto** | `smart-city-iot-agent-mosquitto` | 4042 | ✅ **UP** | Idem ✅ | +| **IoT Agent BunkerM** | `smart-city-iot-agent-bunkerm` | 4043 | ⚠️ **UP** | Mais pas de messages (BunkerM inaccessible) | +| **Orion-LD** | `smart-city-orion-ld` | 1026 | ✅ **UP** | Entités créées, subscriptions actives ✅ | +| **Stellio** | `stellio-api-gateway` | 8080 | ✅ **UP** | Prêt pour intégration IoT Agent ⏳ | +| **QuantumLeap** | `smart-city-quantumleap` | 8668 | ✅ **UP** | Notifications traitées ✅ | +| **CrateDB** | `smart-city-cratedb` | 5432/4200 | ✅ **UP** | Table `quantumleap.etairqualityobserved` ✅ | +| **Grafana** | `digital-twin-grafana` | 3000 | ✅ **UP** | https://grafana.digitribe.fr ✅ | +| **OpenRemote** | `openremote-manager-1` | 8080/8443 | ✅ **UP** | Pas encore connecté aux brokers MQTT ⏳ | +| **ThingsBoard** | `smart-city-thingsboard` | 8080 | ❌ **CRASH** | Manque `/config/thingsboard.conf` | ## Prochaines Étapes -1. ✅ **Orion-LD → QuantumLeap-Orion** (Déjà configuré et opérationnel) -2. 🔄 **Stellio → QuantumLeap-Stellio** (En cours de configuration) -3. ⏳ **Configurer IoT-Agents** pour envoyer aussi à Stellio -4. ⏳ **Tester le flux complet** avec Stellio -5. ⏳ **Créer les dashboards Grafana** (2 sources) +1. ✅ **Corriger le simulateur** pour publier sur les topics IoT Agent (FAIT) +2. ⏳ **Configurer Stellio** pour recevoir les données des IoT Agents +3. ⏳ **Finaliser QuantumLeap-Stellio** (subscriptions) +4. ⏳ **Connecter OpenRemote** aux brokers MQTT (via MQTT Client assets) +5. ⏳ **Réparer BunkerM** (rendre accessible depuis simulateur) +6. ⏳ **Finaliser Grafana** (dashboards avec données CrateDB) +7. ❌ **Réparer ThingsBoard** (créer fichier configuration) ## Notes Importantes -- **Orion-LD** : Utilise l'API NGSI-v2 (`/v2/...`) -- **Stellio** : Utilise l'API NGSI-LD (`/ngsi-ld/v1/...`) -- **QuantumLeap** : Reçoit les notifications et stocke dans CrateDB -- **Grafana** : Visualise les données des 2 CrateDB +- **Architecture Validée** : Le flux Simulateur → Brokers MQTT → IoT Agents → Orion-LD → QuantumLeap → CrateDB est **opérationnel**. +- **Format des données** : IoT Agent utilise `smartcity-api-key/{sid}/attrs` (EMQX), `smartcity-api-key-mosquitto/{sid}/attrs` (Mosquitto), `bunkerm-api-key/{sid}/attrs` (BunkerM). +- **Credentials** : + - Orion-LD : `http://smart-city-orion-ld:1026` + - QuantumLeap : `http://smart-city-quantumleap:8668` + - CrateDB : user `crate`, pas de mot de passe, port 5432 + - Grafana : admin / Digitribe972 + - OpenRemote : admin / Digitribe972 +- **Gitea** : https://gitea.digitribe.fr/eric/smart-city-digital-twin-martinique --- -*Dernière mise à jour : 06 Mai 2026, 18h05 - Correction architecture (Orion→QL-Orion, Stellio→QL-Stellio)* \ No newline at end of file +*Dernière mise à jour : 07 Mai 2026, 21h30 - Architecture validée Orion-LD pipeline complet* \ No newline at end of file diff --git a/docker-compose.iot-agent.yml b/docker-compose.iot-agent.yml index bd995086..fe4aff9c 100644 --- a/docker-compose.iot-agent.yml +++ b/docker-compose.iot-agent.yml @@ -15,7 +15,7 @@ services: - "4041:4041" environment: # Context Broker (Orion-LD) - - IOTA_CB_HOST=orion-ld + - IOTA_CB_HOST=smart-city-orion-ld - IOTA_CB_PORT=1026 - IOTA_CB_NGSI_VERSION=v2 # IoT Agent settings @@ -51,7 +51,7 @@ services: - "4042:4042" environment: # Context Broker (Orion-LD) - - IOTA_CB_HOST=orion-ld + - IOTA_CB_HOST=smart-city-orion-ld - IOTA_CB_PORT=1026 - IOTA_CB_NGSI_VERSION=v2 # IoT Agent settings @@ -81,7 +81,7 @@ services: - "4043:4043" environment: # Context Broker (Orion-LD) - - IOTA_CB_HOST=orion-ld + - IOTA_CB_HOST=smart-city-orion-ld - IOTA_CB_PORT=1026 - IOTA_CB_NGSI_VERSION=v2 # IoT Agent settings