# Architecture Smart City - Multi Context Broker (Updated 2026-05-06) ## Principe : 1 IoT-Agent, 1 QuantumLeap, 1 CrateDB par Context Broker ``` ┌─────────────────────────────────────────────────────────────────────────────┐ │ Smart City Simulator (Python) │ │ Publie sur 3 brokers MQTT avec format IoT-Agent JSON │ └──────────┬────────────────────┬──────────────────────┬───────────────────┘ │ │ │ ▼ ▼ ▼ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │ EMQX Broker │ │ Mosquitto Broker │ │ BunkerM Broker │ │ (port 11883) │ │ (port 1883) │ │ (port 1900) │ └────────┬─────────┘ └────────┬─────────┘ └────────┬─────────┘ │ │ │ ▼ ▼ ▼ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │ 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 │ └────────┬─────────┘ └────────┬─────────┘ └────────┬─────────┘ │ │ │ └───────────────────────┴──────────────────────┘ │ ▼ ┌───────────────┴───────────────┐ │ │ ▼ ▼ ┌─────────────────────┐ ┌─────────────────────┐ │ Orion-LD │ │ Stellio │ │ (port 1026) │ │ (port 8080) │ │ MongoDB backend │ │ (API Gateway) │ └─────────┬───────────┘ └─────────┬───────────┘ │ │ ▼ ▼ ┌─────────────────────┐ ┌─────────────────────┐ │ QuantumLeap-Orion │ │ QuantumLeap-Stellio │ │ (port 8668) │ │ (port 8669) │ │ → CrateDB-Orion │ │ → CrateDB-Stellio │ └─────────┬───────────┘ └─────────┬───────────┘ │ │ ▼ ▼ ┌─────────────────────┐ ┌─────────────────────┐ │ CrateDB-Orion │ │ CrateDB-Stellio │ │ (port 5432/4200) │ │ (port 5433/4201) │ │ DB: quantumleap │ │ DB: quantumleap_ │ │ │ │ stellio │ └─────────┬───────────┘ └─────────┬───────────┘ │ │ └───────────────────────┬─────────┘ │ ▼ ┌─────────────────────┐ │ Grafana │ │ (port 3001) │ │ 2 Datasources: │ │ - CrateDB-Orion │ │ - CrateDB-Stellio│ └─────────────────────┘ ``` ## Services déployés (par Context Broker) ### 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 | ### 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 | ## Configuration des IoT-Agents (pour 2 Context Brokers) 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" } ``` ## Fichiers de configuration (nouveaux) 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 ## Sous-domaines (Traefik) - `quantum-leap-stellio.digitribe.fr` → QuantumLeap-Stellio (port 8669) - `cratedb-stellio.digitribe.fr` → CrateDB-Stellio (port 4201) ## Avantages de cette architecture 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 ## 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. --- *Dernière mise à jour : 06 Mai 2026, 17h45*