Session resume 04 Mai + GeoServer géoMartinique integration doc
This commit is contained in:
@@ -1,118 +1,45 @@
|
|||||||
# 📅 Session Smart City Digital Twin — 04 Mai 2026 (Final)
|
# Session Resume - 04 Mai 2026 (soir)
|
||||||
**Projet :** ~/smart-city-digital-twin-martinique
|
|
||||||
**Reprise de la session :** 03 Mai 2026 (commit 8bb0381fff4cadc213db481795c36d2c03c2deff)
|
|
||||||
|
|
||||||
---
|
## ✅ Réalisé
|
||||||
|
1. **Simulateur** : Écriture InfluxDB asynchrone (threads daemon) → Grafana reçoit les données
|
||||||
|
2. **Grafana** :
|
||||||
|
- Organisation renommée "Main Org." → "Digitribe" ✅
|
||||||
|
- Nouvelle source InfluxDB créée (UID: `f9efd4b4-17cd-4ece-b4bc-087ff411051d`)
|
||||||
|
- Dashboard de test `smart-city-map-test` créé
|
||||||
|
3. **GeoServer** :
|
||||||
|
- Espace "Digitribe" créé ✅
|
||||||
|
- Flux géoMartinique identifiés (WMS/WMTS/WFS) ✅
|
||||||
|
- Documentation d'intégration créée ✅
|
||||||
|
- **Blocage XStream** : impossible créer magasin WMS cascadé via API REST
|
||||||
|
- **Workaround** : Interface web GeoServer (https://geoserver.digitribe.fr/geoserver/web/)
|
||||||
|
|
||||||
## ✅ Réalisations de cette session (04 Mai)
|
## ❌ Blocages
|
||||||
|
- **GeoServer XStream Security** : `java.net.URL` non autorisé malgré :
|
||||||
|
- `analyzer.properties` configuré ✅
|
||||||
|
- `-Dorg.geoserver.xstream.allowUnknownTypes=true` ✅
|
||||||
|
- Redémarrages multiples ❌
|
||||||
|
- **Grafana** : Source GeoServer WMS en `readOnly` (impossible supprimer via API)
|
||||||
|
|
||||||
### 1. OpenRemote Authentication Fix
|
## 📋 À faire (prochaine session)
|
||||||
- Modifié `simulator.py` : `_get_or_token()` utilise maintenant `password grant` avec `client_secret`
|
1. **GeoServer** : Créer magasin WMS géoMartinique via **interface web** (5 min)
|
||||||
- `client_credentials` testé avec succès (HTTP 200) mais échoue sur API PUT (403 Forbidden)
|
2. **OpenRemote** : Configurer MQTT Agent pour écouter EMQX (pas de flux géoMartinique !)
|
||||||
- Problème 403 persistait → Nécessite configuration manuelle Keycloak (Service Account Roles)
|
3. **Grafana** : Vérifier affichage carte + corriger source FIWARE Orion
|
||||||
|
|
||||||
### 2. Container Networking Fixed
|
## 🔗 URLs importantes
|
||||||
```bash
|
- **GeoServer** : https://geoserver.digitribe.fr/geoserver/web/ (admin/Digitribe972)
|
||||||
docker network connect openremote_default smart-city-simulator
|
- **Flux géoMartinique** :
|
||||||
docker network connect traefik smart-city-simulator
|
- WMS : `https://datacarto.geomartinique.fr/wms`
|
||||||
docker network connect frost_http_default smart-city-simulator
|
- WMTS : `https://datacarto.geomartinique.fr/wmts`
|
||||||
```
|
- **Grafana** : https://grafana.digitribe.fr/d/smart-city-map-test
|
||||||
|
|
||||||
### 3. Grafana Dashboard Created ✅
|
## 📝 Fichiers modifiés/créés
|
||||||
- Datasource InfluxDB ajoutée : `http://digital-twin-influxdb:8086`, database `smartcity`
|
- `simulator.py` : Threads asynchrones pour InfluxDB/FROST
|
||||||
- Dashboard importé : UID `smartcity-martinique-2026`
|
- `geoserver_geomartinique_integration.md` : Doc intégration + workaround
|
||||||
- **URL** : http://localhost:3001/d/smartcity-martinique-2026/smart-city-digital-twin-martinique
|
- `geoserver_config_status.md` : État config GeoServer
|
||||||
|
- `grafana_smart-city-overview.json` : Dashboard JSON
|
||||||
|
- `populate_influx.py` : Script peupler InfluxDB
|
||||||
|
|
||||||
### 4. Skill Updated ✅
|
## 🔧 Commits récents
|
||||||
- Skill `smart-city-simulator` mise à jour avec les changements de cette session
|
- `c69ecb5` : WIP: Dockerfile update + Grafana dashboard JSON + InfluxDB script
|
||||||
- Section "Session 2026-05-04 Updates" ajoutée
|
- `1d12a0b` : GeoServer: flux géoMartinique + XStream issue doc + workaround
|
||||||
|
- `ee708fb` : Fix: InfluxDB async write + Grafana Org rename + GeoServer workspace
|
||||||
---
|
|
||||||
|
|
||||||
## ❌ Blocages restants
|
|
||||||
|
|
||||||
1. **OpenRemote 403 Forbidden** : Le client `openremote` (realm `smartcity`) n'a pas les permissions d'écriture sur les assets.
|
|
||||||
- **Solution** : Via Keycloak UI → Realm `smartcity` → Clients → `openremote` → Service Account Roles → Assigner `realm-management` → `manage-clients`
|
|
||||||
|
|
||||||
2. **password grant échoue (401)** : L'utilisateur `admin` n'existe pas dans le realm `smartcity`.
|
|
||||||
- **Solution alternative** : Utiliser `client_credentials` mais configurer les permissions du Service Account.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 📋 Commandes utiles (Copier-Coller)
|
|
||||||
|
|
||||||
### Vérifier l'état des containers
|
|
||||||
```bash
|
|
||||||
cd ~/smart-city-digital-twin-martinique
|
|
||||||
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" | grep -E "smart-city|openremote|frost|orion|stellio|grafana"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Accéder au Dashboard Grafana
|
|
||||||
```bash
|
|
||||||
# Ouvrir dans le navigateur
|
|
||||||
xdg-open http://localhost:3001/d/smartcity-martinique-2026/smart-city-digital-twin-martinique
|
|
||||||
# Login: admin / Digitribe972
|
|
||||||
```
|
|
||||||
|
|
||||||
### Corriger OpenRemote 403 (Manuel Keycloak)
|
|
||||||
```bash
|
|
||||||
# 1. Aller sur https://openremote.digitribe.fr/auth/admin/
|
|
||||||
# 2. Login: admin / Digitribe972
|
|
||||||
# 3. Sélectionner realm "smartcity"
|
|
||||||
# 4. Clients → "openremote" → Tab "Service Account Roles"
|
|
||||||
# 5. Add "realm-management" → "manage-clients", "view-clients"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Rebuild simulator (après correction OpenRemote)
|
|
||||||
```bash
|
|
||||||
cd ~/smart-city-digital-twin-martinique
|
|
||||||
docker build -t smart-city-simulator:latest .
|
|
||||||
docker stop smart-city-simulator && docker rm smart-city-simulator
|
|
||||||
docker run -d --name smart-city-simulator --network emqx_default \
|
|
||||||
-e SENSOR_COUNT_traffic=3 -e SENSOR_COUNT_airquality=2 \
|
|
||||||
-e SENSOR_COUNT_parking=2 -e SENSOR_COUNT_noise=1 \
|
|
||||||
-e SENSOR_COUNT_weather=1 -e SENSOR_COUNT_light=1 \
|
|
||||||
-e PUBLISH_INTERVAL_SEC=10 -e ENABLE_ORION=1 \
|
|
||||||
-e ENABLE_STELLIO=1 -e ENABLE_FROST=1 -e ENABLE_OPENREMOTE=1 \
|
|
||||||
-e OR_CLIENT_ID=openremote -e OR_CLIENT_SECRET=QVTnyObwXdpQ0Vuc60kFSonidK49FiXb \
|
|
||||||
-e OR_REALM=smartcity -e OR_ADMIN_USER=admin -e OR_ADMIN_PASS=Digitribe972 \
|
|
||||||
smart-city-simulator:latest python -c "import simulator; simulator.main()"
|
|
||||||
docker network connect openremote_default smart-city-simulator
|
|
||||||
docker network connect traefik smart-city-simulator
|
|
||||||
docker network connect frost_http_default smart-city-simulator
|
|
||||||
```
|
|
||||||
|
|
||||||
### Vérifier les données Grafana (InfluxDB)
|
|
||||||
```bash
|
|
||||||
docker exec digital-twin-influxdb influx query 'from(bucket:"iot_data") |> range(start:-1h) |> last()'
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 📦 Prochaines étapes (Session suivante)
|
|
||||||
|
|
||||||
1. **Corriger OpenRemote 403** (via Keycloak UI ou API)
|
|
||||||
2. **Valider la remontée des données** dans l'UI OpenRemote Manager (https://openremote.digitribe.fr/manager/ → Realm: Smart City)
|
|
||||||
3. **Ajouter des panneaux** au dashboard Grafana (température, humidité, trafic, etc.)
|
|
||||||
4. **Pousser les changements sur Gitea** :
|
|
||||||
```bash
|
|
||||||
cd ~/smart-city-digital-twin-martinique
|
|
||||||
git add simulator.py grafana_dashboard_smartcity.json session_resume_2026-05-04.md
|
|
||||||
git commit -m "Fix OpenRemote auth, add Grafana dashboard, update skill"
|
|
||||||
git push origin master
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 📊 État final des tâches
|
|
||||||
|
|
||||||
| ID | Tâche | Statut |
|
|
||||||
|----|-------|--------|
|
|
||||||
| 1 | Vérifier l'état des containers Docker | ✅ Complété |
|
|
||||||
| 2 | Corriger la configuration Keycloak/OpenRemote | ✅ Complété |
|
|
||||||
| 3 | Tester l'authentification client_credentials OpenRemote | ❌ Annulé (401) |
|
|
||||||
| 4 | Valider la remontée des données OpenRemote | ❌ Annulé (403) |
|
|
||||||
| 5 | Créer le tableau de bord Grafana | ✅ Complété |
|
|
||||||
| 6 | Finaliser la skill smart-city-simulator | ✅ Complété |
|
|
||||||
|
|
||||||
**Progrès** : 3/6 complétés, 2/6 annulés (blocages), 1/6 non démarré
|
|
||||||
|
|||||||
Reference in New Issue
Block a user