docs: Add multi-Context Broker architecture (Orion-LD + Stellio separate pipelines)

This commit is contained in:
Eric FELIXINE
2026-05-06 17:32:35 -04:00
parent 3df9f914fa
commit 91ade0ad20
2 changed files with 193 additions and 0 deletions

134
architecture-multi-cb.md Normal file
View File

@@ -0,0 +1,134 @@
# 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*

View File

@@ -0,0 +1,59 @@
# QuantumLeap for Stellio - Separate instance
# Usage: docker compose -f docker-compose.yml -f docker-compose.quantumleap-stellio.yml up -d
version: '3.8'
services:
quantumleap-stellio:
image: smartsdk/quantumleap:latest
container_name: smart-city-quantumleap-stellio
restart: unless-stopped
networks:
- smartcity-shared
- traefik-public
environment:
- CRATE_HOST=smart-city-cratedb-stellio
- CRATE_PORT=4200
- CRATE_DB_NAME=quantumleap_stellio
- QL_CONFIG_DELETE_POLICY=oasis.settings.STELLIO_DELETE_POLICY
ports:
- "8669:8668"
labels:
- traefik.enable=true
- traefik.http.routers.quantum-leap-stellio.rule=Host(`quantum-leap-stellio.digitribe.fr`)
- traefik.http.services.quantum-leap-stellio.loadbalancer.server.port=8668
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8668/version"]
interval: 30s
timeout: 10s
retries: 3
depends_on:
- smart-city-cratedb-stellio
smart-city-cratedb-stellio:
image: crate:latest
container_name: smart-city-cratedb-stellio
restart: unless-stopped
networks:
smartcity-shared:
aliases:
- smart-city-cratedb-stellio
ports:
- "4201:4200"
- "5433:5432"
volumes:
- smart-city-cratedb-stellio-data:/data
command: -Clicense.enterprise=false -Cauth.host_based.enabled=true
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:4200/_admin/v1/health"]
interval: 30s
timeout: 10s
retries: 3
volumes:
smart-city-cratedb-stellio-data:
networks:
smartcity-shared:
external: true
traefik-public:
external: true