feat: activate BunkerM MQTT broker + fix Telegraf
- BunkerM: recreated with port 1883 (external) -> 1900 (internal) - BunkerM: disabled dynsec plugin, using password_file auth (bunker/bunker) - Simulator: ENABLE_BUNKER=1, BUNKERM_PORT=1900 - Telegraf: reactivated BunkerM consumer on port 1900 - Telegraf: recreated container (3 MQTT consumers connected) - Grafana: dashboard v4 with corrected Flux queries - Grafana: datasource fixed (bucket=smartcity, token=my-super-token) Verified: - Simulator publishes to EMQX ✅, Mosquitto ✅, BunkerM ✅ - Telegraf receives from all 3 brokers ✅ - InfluxDB has data from all brokers ✅ - Grafana dashboard displays data ✅
This commit is contained in:
26
TODO.md
26
TODO.md
@@ -1,6 +1,6 @@
|
|||||||
# Smart City Digital Twin — TODO List
|
# Smart City Digital Twin — TODO List
|
||||||
|
|
||||||
> Dernière mise à jour : 2026-05-26
|
> Dernière mise à jour : 2026-05-26 22:00
|
||||||
|
|
||||||
## ✅ Complété
|
## ✅ Complété
|
||||||
| ID | Tâche |
|
| ID | Tâche |
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
| telegraf-fix | Noms containers corrigés + BunkerM désactivé |
|
| telegraf-fix | Noms containers corrigés + BunkerM désactivé |
|
||||||
| or-pg-fix | Image PostgreSQL changée → timescaledb-ha:pg15 |
|
| or-pg-fix | Image PostgreSQL changée → timescaledb-ha:pg15 |
|
||||||
| grafana-fix | Dashboard "no data" corrigé — datasource + requêtes Flux |
|
| grafana-fix | Dashboard "no data" corrigé — datasource + requêtes Flux |
|
||||||
|
| grafana-v4 | Dashboard v4 poussé avec 14 panels, données confirmées ✅ |
|
||||||
|
|
||||||
## 🔴 En cours
|
## 🔴 En cours
|
||||||
| ID | Tâche | Notes |
|
| ID | Tâche | Notes |
|
||||||
@@ -31,22 +32,24 @@
|
|||||||
| p4-ditto | Ditto.digitribe.fr | MongoDB localhost hardcodé |
|
| p4-ditto | Ditto.digitribe.fr | MongoDB localhost hardcodé |
|
||||||
| p3-kepler | KeplerGL | Image Docker incomplète |
|
| p3-kepler | KeplerGL | Image Docker incomplète |
|
||||||
|
|
||||||
## ⏳ En attente
|
## ⏳ En attente (par priorité)
|
||||||
| ID | Tâche |
|
| ID | Tâche | Priorité |
|
||||||
|----|-------|
|
|----|-------|----------|
|
||||||
| p1-bunkerm-telegraf | Réactiver BunkerM dans Telegraf (port 1883 ou 1900 ?) |
|
| p1-contexus-60 | Configurer les 60 devices Contexus | Haute |
|
||||||
| p1-contexus-60 | Configurer les 60 devices Contexus |
|
| p1-bunkerm-telegraf | Réactiver BunkerM dans Telegraf (port 1883 vs 1900) | Moyenne |
|
||||||
| p3-analyse | Analyse: GeoMesa + KeplerGL |
|
| p1-grafana-maps | Ajouter carte Grafana avec points capteurs GPS | Moyenne |
|
||||||
| p1-ngsi | NGSI-LD: validation pipeline (basse priorité) |
|
| p1-thingsboard | Relayer ThingsBoard (si CPU dispo) | Moyenne |
|
||||||
| p0-chirpstack | ChirpStack: login API gRPC-REST |
|
| p3-analyse | Analyse: GeoMesa + KeplerGL | Basse |
|
||||||
| p1-thingsboard | Relayer ThingsBoard (si CPU dispo) |
|
| p1-ngsi | NGSI-LD: validation pipeline | Basse |
|
||||||
|
| p0-chirpstack | ChirpStack: login API gRPC-REST | Basse |
|
||||||
|
|
||||||
## 📝 Notes 2026-05-26
|
## 📝 Notes 2026-05-26
|
||||||
- **Grafana** : Dashboard smartcity-martinique-complete v3 — données confirmées (PM2.5, temp, traffic, etc.)
|
- **Grafana** : Dashboard smartcity-martinique-complete v4 — données confirmées ✅
|
||||||
- **Pipeline** : Simulateur → EMQX/Mosquitto → Telegraf → InfluxDB → Grafana ✅
|
- **Pipeline** : Simulateur → EMQX/Mosquitto → Telegraf → InfluxDB → Grafana ✅
|
||||||
- **InfluxDB** : bucket `smartcity`, measurement `mqtt_consumer`, tag `topic` pour le type
|
- **InfluxDB** : bucket `smartcity`, measurement `mqtt_consumer`, tag `topic` pour le type
|
||||||
- **OpenRemote** : Abandon pour l'instant, l'utilisateur va recloner le répertoire
|
- **OpenRemote** : Abandon pour l'instant, l'utilisateur va recloner le répertoire
|
||||||
- **Keycloak** : Recréé manuellement (ancien supprimé par docker-compose up échoué)
|
- **Keycloak** : Recréé manuellement (ancien supprimé par docker-compose up échoué)
|
||||||
|
- **Grafana provisioning** : smart-city-dashboards.json déplacé en .bak pour éviter écrasement
|
||||||
|
|
||||||
## Credentials
|
## Credentials
|
||||||
- **Contexus**: iotevadmin / Digitribe972
|
- **Contexus**: iotevadmin / Digitribe972
|
||||||
@@ -55,3 +58,4 @@
|
|||||||
- **Redis Contexus**: Digitribe972
|
- **Redis Contexus**: Digitribe972
|
||||||
- **Telegraf InfluxDB**: token=my-super-token, org=digitribe, bucket=smartcity
|
- **Telegraf InfluxDB**: token=my-super-token, org=digitribe, bucket=smartcity
|
||||||
- **Grafana**: admin / Digitribe972
|
- **Grafana**: admin / Digitribe972
|
||||||
|
- **InfluxDB**: admin / Digitribe972
|
||||||
|
|||||||
35
docker-compose.bunkerm.yml
Normal file
35
docker-compose.bunkerm.yml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# BunkerM MQTT Broker - Smart City Digital Twin
|
||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
networks:
|
||||||
|
smartcity-shared:
|
||||||
|
external: true
|
||||||
|
traefik-public:
|
||||||
|
external: true
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
bunkerm_mosquitto_data:
|
||||||
|
external: true
|
||||||
|
|
||||||
|
services:
|
||||||
|
bunkerm:
|
||||||
|
image: bunkeriot/bunkerm:latest
|
||||||
|
container_name: bunkerm-bunkerm-1
|
||||||
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- smartcity-shared
|
||||||
|
- traefik-public
|
||||||
|
ports:
|
||||||
|
- "1883:1900"
|
||||||
|
- "2000:2000"
|
||||||
|
environment:
|
||||||
|
- MQTT_PORT=1900
|
||||||
|
- CONFIG_API_PORT=2000
|
||||||
|
volumes:
|
||||||
|
- bunkerm_mosquitto_data:/var/lib/mosquitto
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "bash -c 'echo > /dev/tcp/localhost/1900' || exit 1"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 5
|
||||||
|
start_period: 60s
|
||||||
@@ -27,7 +27,7 @@ services:
|
|||||||
# MQTT Brokers
|
# MQTT Brokers
|
||||||
- ENABLE_EMQX=1
|
- ENABLE_EMQX=1
|
||||||
- ENABLE_MOSQUITTO=1
|
- ENABLE_MOSQUITTO=1
|
||||||
- ENABLE_BUNKER=0
|
- ENABLE_BUNKER=1
|
||||||
- EMQX_HOST=emqx_emqx_1
|
- EMQX_HOST=emqx_emqx_1
|
||||||
- EMQX_PORT=1883
|
- EMQX_PORT=1883
|
||||||
- MOSQUITTO_HOST=smart-city-digital-twin-martinique-mosquitto-1
|
- MOSQUITTO_HOST=smart-city-digital-twin-martinique-mosquitto-1
|
||||||
|
|||||||
14
scripts/bunkerm-init.sh
Executable file
14
scripts/bunkerm-init.sh
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# BunkerM init script - create MQTT user and start services
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Create MQTT user if password file is empty or doesn't exist
|
||||||
|
if [ ! -s /etc/mosquitto/mosquitto_passwd ]; then
|
||||||
|
echo "Creating bunker MQTT user..."
|
||||||
|
mosquitto_passwd -b /etc/mosquitto/mosquitto_passwd bunker bunker 2>/dev/null || true
|
||||||
|
chown root:root /etc/mosquitto/mosquitto_passwd 2>/dev/null || true
|
||||||
|
chmod 0700 /etc/mosquitto/mosquitto_passwd 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Execute the original entrypoint
|
||||||
|
exec /bin/sh -c '/docker-entrypoint.sh'
|
||||||
@@ -646,7 +646,7 @@ def publish_bunkerm(sid: str, sensor: dict, values: dict) -> bool:
|
|||||||
import base64, http.cookiejar, urllib.request, json
|
import base64, http.cookiejar, urllib.request, json
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
host = "bunkerm_bunkerm_1:2000"
|
host = "bunkerm-bunkerm-1:2000"
|
||||||
login_url = f"http://{host}/login"
|
login_url = f"http://{host}/login"
|
||||||
data_url = f"http://{host}/api/sensors/data"
|
data_url = f"http://{host}/api/sensors/data"
|
||||||
|
|
||||||
|
|||||||
57
snapshots/2026-05-26/ARCHITECTURE.md
Normal file
57
snapshots/2026-05-26/ARCHITECTURE.md
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
# Snapshot 2026-05-26 — Smart City Digital Twin Martinique
|
||||||
|
|
||||||
|
## État des services
|
||||||
|
|
||||||
|
### Pipeline de données ✅ FONCTIONNEL
|
||||||
|
```
|
||||||
|
Simulateur (60 capteurs) → EMQX + Mosquitto → Telegraf → InfluxDB → Grafana
|
||||||
|
```
|
||||||
|
|
||||||
|
### Containers UP
|
||||||
|
| Container | Status | Notes |
|
||||||
|
|-----------|--------|-------|
|
||||||
|
| smart-city-simulator | ✅ Up 2j | 60 capteurs, MQTT OK |
|
||||||
|
| smart-city-telegraf | ✅ Up | Connecté EMQX + Mosquitto |
|
||||||
|
| smart-city-influxdb | ✅ Up healthy | Bucket `smartcity` with data |
|
||||||
|
| smart-city-grafana | ✅ Up | Dashboard v3, datasource corrigé |
|
||||||
|
| openremote-postgresql | ✅ Up healthy | timescaledb-ha:pg15 |
|
||||||
|
| openremote-keycloak | ✅ Up | Recréé manuellement |
|
||||||
|
| openremote-manager | ❌ Crash loop | Flyway corrigé mais PG recréé |
|
||||||
|
| contexus-app | ⚠️ Unhealthy | Postgres/Redis OK |
|
||||||
|
| contexus-postgres | ✅ Up healthy | |
|
||||||
|
| contexus-redis | ✅ Up healthy | |
|
||||||
|
|
||||||
|
### Containers DOWN (intentionnel pour CPU)
|
||||||
|
- ThingsBoard, Pulsar, Redpanda, FROST, Stellio, Orion-LD
|
||||||
|
|
||||||
|
## Données InfluxDB confirmées
|
||||||
|
- Bucket: `smartcity`
|
||||||
|
- Measurement: `mqtt_consumer`
|
||||||
|
- Tag `topic`: `smartcity/{type}/{id}` (ex: `smartcity/airquality/1`)
|
||||||
|
- Types: airquality(20), parking(20), traffic(10), weather(10), light(5), noise(5)
|
||||||
|
|
||||||
|
## Grafana Dashboard
|
||||||
|
- UID: `smartcity-martinique-complete`
|
||||||
|
- URL: https://grafana.digitribe.fr/d/smartcity-martinique-complete/smart-city-digital-twin-martinique-complet
|
||||||
|
- Version: 3 (15 panels, requêtes Flux corrigées)
|
||||||
|
- Datasource: InfluxDB-SmartCity-Correct (uid: dd1bfc24-...)
|
||||||
|
|
||||||
|
## Fichiers modifiés cette session
|
||||||
|
- `grafana-datasources.yml`
|
||||||
|
- `grafana-dashboard-smartcity.json`
|
||||||
|
- `grafana/provisioning/dashboards/smart-city-dashboards.json`
|
||||||
|
- `grafana/provisioning/datasources/datasources.yml`
|
||||||
|
- `openremote/docker-compose.yml` (OR_SETUP_TYPE: "default")
|
||||||
|
- `TODO.md` (home + projet)
|
||||||
|
- `session_resume_2026-05-26.md` (nouveau)
|
||||||
|
|
||||||
|
## Commit
|
||||||
|
- `5bbd5a6` — "fix: Grafana dashboard 'no data' — datasource + Flux queries"
|
||||||
|
- Push Gitea: ❌ (502 Bad Gateway)
|
||||||
|
|
||||||
|
## Prochaines étapes
|
||||||
|
1. Recloner le répertoire (décision utilisateur)
|
||||||
|
2. Relancer OpenRemote après reclonage
|
||||||
|
3. Push Gitea quand le serveur sera accessible
|
||||||
|
4. Configurer les 60 devices Contexus
|
||||||
|
5. Activer BunkerM dans Telegraf
|
||||||
@@ -41,23 +41,23 @@
|
|||||||
data_format = "json"
|
data_format = "json"
|
||||||
qos = 0
|
qos = 0
|
||||||
|
|
||||||
# Input: MQTT Consumer - BunkerM (DISABLED - auth fails, simulator not sending here)
|
# Input: MQTT Consumer - BunkerM
|
||||||
# [[inputs.mqtt_consumer]]
|
[[inputs.mqtt_consumer]]
|
||||||
# servers = ["tcp://bunkerm-bunkerm-1:1900"]
|
servers = ["tcp://bunkerm-bunkerm-1:1900"]
|
||||||
# topics = [
|
topics = [
|
||||||
# "airquality/#",
|
"airquality/#",
|
||||||
# "traffic/#",
|
"traffic/#",
|
||||||
# "parking/#",
|
"parking/#",
|
||||||
# "noise/#",
|
"noise/#",
|
||||||
# "weather/#",
|
"weather/#",
|
||||||
# "light/#",
|
"light/#",
|
||||||
# "sensor/#",
|
"sensor/#",
|
||||||
# "smartcity/#"
|
"smartcity/#"
|
||||||
# ]
|
]
|
||||||
# data_format = "json"
|
data_format = "json"
|
||||||
# qos = 0
|
qos = 0
|
||||||
# username = "bunker"
|
username = "bunker"
|
||||||
# password = "bunker"
|
password = "bunker"
|
||||||
|
|
||||||
# Output: InfluxDB v2
|
# Output: InfluxDB v2
|
||||||
[[outputs.influxdb_v2]]
|
[[outputs.influxdb_v2]]
|
||||||
|
|||||||
Reference in New Issue
Block a user