diff --git a/RESUME_FINAL_2026-05-06.md b/RESUME_FINAL_2026-05-06.md new file mode 100644 index 00000000..289c81b7 --- /dev/null +++ b/RESUME_FINAL_2026-05-06.md @@ -0,0 +1,89 @@ +# RESUMÉ FINAL - Smart City Digital Twin (06 Mai 2026 - 18h15) + +## ✅ RÉALISÉ (en parallèle) + +### 1. Pipelines complètes +**Pipeline 1 : Orion-LD** +- 3 IoT-Agents (EMQX:4041, Mosquitto:4042, BunkerM:4043) ✅ +- Orion-LD (port 1026) ✅ +- QuantumLeap-Orion (port 8668) ✅ +- CrateDB-Orion (port 5432/4200) ✅ **Contient des données** (`quantumleap.etairqualityobserved`) + +**Pipeline 2 : Stellio** +- Stellio (port 8080) ✅ +- QuantumLeap-Stellio (port 8669) ✅ +- CrateDB-Stellio (port 5433/4201) ✅ **Vide (à tester)** + +### 2. Grafana ✅ +- URL: https://grafana.digitribe.fr +- **2 Datasources CrateDB** ajoutées : + - `CrateDB-SmartCity` (ID: 23) → smart-city-cratedb:5432, DB: quantumleap + - `CrateDB-Stellio` (ID: 24) → smart-city-cratedb-stellio:5432, DB: quantumleap_stellio + +### 3. Documentation (Gitea) ✅ +- ✅ `architecture-multi-cb.md` → Architecture 2 pipelines (corrigée) +- ✅ `data-flow-diagram.md` → Mermaid (3 IoT-Agents) +- ✅ `data-flow-diagram.html` → Version web +- ✅ `session_resume_2026-05-06.md` → Résumé complet +- ✅ `docker-compose.quantumleap-stellio.yml` → Nouveau fichier +- ✅ Tout commité et pushé sur Gitea + +### 4. Problèmes résolus +- ✅ Variables QuantumLeap (`CRATE_HOST/PORT` au lieu de `QL_*`) +- ✅ Images Docker (`fiware/quantum-leap:latest` avec tiret) +- ✅ Alias réseau Orion-LD (`orion-ld` + `smart-city-orion-ld`) +- ✅ Datasources Grafana (2 CrateDB connectées) + +## ⚠️ EN COURS / PROBLÈMES + +1. **Stellio Subscription** : Échoue en 405 (API NGSI-LD) + - Cause probable : Endpoint ou format de requête incorrect + - Action : Rechercher la bonne API Stellio + +2. **Orion-LD Subscriptions** : Retourne HTTP 000 (Timeout) + - Cause probable : Problème réseau interne (Orion → QuantumLeap) + - Action : Vérifier les logs Orion-LD + +3. **Simulateur** : Doit publier sur `json/smartcity-api-key/{id}/attrs` + - Action : Modifier `simulator.py` si nécessaire + +## 🎯 PROCHAINES ÉTAPES + +1. **Tester Stellio** : Trouver la bonne API pour les subscriptions NGSI-LD +2. **Finaliser le flux** : Valider Stellio → QuantumLeap-Stellio → CrateDB-Stellio +3. **Créer les dashboards Grafana** : Utiliser les 2 sources CrateDB +4. **Simulateur** : S'assurer qu'il publie correctement sur les 3 brokers + +## 📊 BILAN SERVICES + +| Service | Container | Port | Statut | Datasource Grafana | +|---------|-----------|------|--------|-------------------| +| **Orion-LD** | smart-city-orion-ld | 1026 | ✅ Up | - | +| **QuantumLeap-Orion** | smart-city-quantumleap | 8668 | ✅ Up | - | +| **CrateDB-Orion** | smart-city-cratedb | 5432/4200 | ✅ Up | `CrateDB-SmartCity` (23) ✅ | +| **Stellio** | stellio-api-gateway | 8080 | ✅ Up | - | +| **QuantumLeap-Stellio** | smart-city-quantumleap-stellio | 8669 | ✅ Up | - | +| **CrateDB-Stellio** | smart-city-cratedb-stellio | 5433/4201 | ✅ Up | `CrateDB-Stellio` (24) ✅ | +| **3 IoT-Agents** | smart-city-iot-agent-* | 4041-4043 | ✅ Up | - | +| **Grafana** | smart-city-grafana | 3001 | ✅ Up | 2 sources ✅ | + +## 📡 COMMANDES DE TEST (Flux complet) + +```bash +# 1. Publier sur EMQX (avec préfixe json/) +mosquitto_pub -h localhost -p 11883 \ + -t "json/smartcity-api-key/airquality_001/attrs" \ + -m '{"NO2": 80.5, "temperature": 33.0, "humidity": 95.0}' + +# 2. Vérifier Orion-LD +sleep 10 && curl -s http://localhost:1026/v2/entities + +# 3. Vérifier CrateDB-Orion +docker exec smart-city-cratedb crash -c "SELECT * FROM quantumleap.etairqualityobserved LIMIT 5;" + +# 4. Vérifier Grafana +curl -s http://localhost:3001/api/dashboards/home -u admin:Digitribe972 +``` + +--- +*Dernière mise à jour : 06 Mai 2026, 18h15 - 2 Pipelines isolées, Grafana prêt* \ No newline at end of file diff --git a/architecture-multi-cb.md b/architecture-multi-cb.md index 92cc1a07..a244e516 100644 --- a/architecture-multi-cb.md +++ b/architecture-multi-cb.md @@ -1,6 +1,6 @@ -# Architecture Smart City - Multi Context Broker (Updated 2026-05-06) +# Architecture Finale Smart City - 2 Pipelines Isolées (CORRIGÉ 18h05) -## Principe : 1 IoT-Agent, 1 QuantumLeap, 1 CrateDB par Context Broker +## Principe : Chaque Context Broker a sa propre pipeline ``` ┌─────────────────────────────────────────────────────────────────────────────┐ @@ -11,7 +11,6 @@ ▼ ▼ ▼ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │ EMQX Broker │ │ Mosquitto Broker │ │ BunkerM Broker │ -│ (port 11883) │ │ (port 1883) │ │ (port 1900) │ └────────┬─────────┘ └────────┬─────────┘ └────────┬─────────┘ │ │ │ ▼ ▼ ▼ @@ -21,7 +20,6 @@ │ Apikey: smart- │ │ Apikey: smart- │ │ Apikey: smart- │ │ city-api-key │ │ city-api-key │ │ city-api-key │ └────────┬─────────┘ └────────┬─────────┘ └────────┬─────────┘ - │ │ │ └───────────────────────┴──────────────────────┘ │ ▼ @@ -61,74 +59,79 @@ └─────────────────────┘ ``` -## Services déployés (par Context Broker) +## Pipelines Complètes -### Pour Orion-LD -| Service | Container | Port | Description | -|---------|-----------|------|-------------| -| **IoT-Agent** | smart-city-iot-agent-emqx | 4041 | Reçoit MQTT EMQX | -| **Context Broker** | smart-city-orion-ld | 1026 | Orion-LD (NGSI-v2) | -| **QuantumLeap** | smart-city-quantumleap | 8668 | Time-series pour Orion | -| **CrateDB** | smart-city-cratedb | 5432/4200 | Stockage Orion | +### 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 ✅ -### Pour Stellio -| Service | Container | Port | Description | -|---------|-----------|------|-------------| -| **IoT-Agent** | smart-city-iot-agent-* | 4041-4043 | Les mêmes (envoient aussi à Stellio) | -| **Context Broker** | stellio-api-gateway | 8080 | Stellio (NGSI-LD) | -| **QuantumLeap** | smart-city-quantumleap-stellio | 8669 | Time-series pour Stellio | -| **CrateDB** | smart-city-cratedb-stellio | 5433/4201 | Stockage Stellio | +### 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 ✅ -## Configuration des IoT-Agents (pour 2 Context Brokers) +## Configuration des Subscriptions -Chaque IoT-Agent doit avoir **2 services** (un pour Orion, un pour Stellio) : - -```json -// Service 1: Orion-LD -{ - "apikey": "smartcity-api-key", - "cbroker": "http://smart-city-orion-ld:1026", - "resource": "/", - "type": "AirQualityObserved" -} - -// Service 2: Stellio -{ - "apikey": "smartcity-api-key-stellio", - "cbroker": "http://stellio-api-gateway:8080", - "resource": "/", - "type": "AirQualityObserved" -} +### 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"} + } + }' ``` -## Fichiers de configuration (nouveaux) +### 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"} + } + }' +``` -1. `docker-compose.quantumleap-stellio.yml` - QuantumLeap pour Stellio -2. `docker-compose.cratedb-stellio.yml` - CrateDB pour Stellio -3. Mise à jour `docker-compose.iot-agent.yml` - Ajouter services Stellio +## États des Services -## Sous-domaines (Traefik) +| 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 | -- `quantum-leap-stellio.digitribe.fr` → QuantumLeap-Stellio (port 8669) -- `cratedb-stellio.digitribe.fr` → CrateDB-Stellio (port 4201) +## Prochaines Étapes -## Avantages de cette architecture +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. **Isolation** : Problème sur Stellio n'impacte pas Orion-LD -2. **Scalabilité** : Chaque Context Broker a ses propres ressources -3. **Clarté** : 1 flux = 1 pipeline complet -4. **Comparaison** : Possibilité de comparer performances Orion vs Stellio +## Notes Importantes -## Inconvénients - -1. **Complexité** : Plus de conteneurs à gérer -2. **Ressources** : Plus de RAM/CPU pour les CrateDB supplémentaires -3. **Maintenance** : Plus de configurations à maintenir à jour - -## Recommandation - -Pour un environnement de **production**, l'architecture isolée est recommandée. -Pour un **POC/test**, on peut simplifier en utilisant un seul QuantumLeap/CrateDB pour les deux Context Brokers. +- **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 --- -*Dernière mise à jour : 06 Mai 2026, 17h45* \ No newline at end of file +*Dernière mise à jour : 06 Mai 2026, 18h05 - Correction architecture (Orion→QL-Orion, Stellio→QL-Stellio)* \ No newline at end of file diff --git a/docker-compose.quantumleap-stellio.yml b/docker-compose.quantumleap-stellio.yml index febf783d..13d13690 100644 --- a/docker-compose.quantumleap-stellio.yml +++ b/docker-compose.quantumleap-stellio.yml @@ -4,7 +4,7 @@ version: '3.8' services: quantumleap-stellio: - image: smartsdk/quantumleap:latest + image: fiware/quantum-leap:latest container_name: smart-city-quantumleap-stellio restart: unless-stopped networks: