Skip to content

Commit 8734b5b

Browse files
committed
Fix configuration - add sensors
1 parent 2850ef5 commit 8734b5b

2 files changed

Lines changed: 104 additions & 2 deletions

File tree

docker-compose/common.yml

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,22 @@ services:
3535
healthcheck:
3636
test: (wget --server-response --spider --quiet http://context/user-context.jsonld 2>&1 | awk 'NR==1{print $$2}'| grep -q -e "200") || exit 1
3737

38-
# Databases
38+
# Cache for Sensor Data Readings
39+
redis-sensors:
40+
labels:
41+
org.fiware: 'tutorial'
42+
image: redis:8.2.0-alpine
43+
container_name: redis
44+
hostname: redis-for-sensors
45+
ports:
46+
- "6379:6379"
47+
volumes:
48+
- redis-data:/data
49+
healthcheck:
50+
test: ["CMD", "redis-cli","ping"]
51+
interval: 10s
52+
53+
# Databases
3954
mongo-db:
4055
labels:
4156
org.fiware: 'tutorial'
@@ -55,7 +70,7 @@ services:
5570
test: ["CMD","mongosh", "localhost:27017/test", "--quiet"]
5671
interval: 5s
5772

58-
# IoT-Agent is configured for the UltraLight Protocol
73+
# IoT-Agent is configured for the JSON Protocol
5974
iot-agent:
6075
labels:
6176
org.fiware: 'tutorial'
@@ -97,6 +112,32 @@ services:
97112
healthcheck:
98113
interval: 30s
99114

115+
116+
# A series of dummy IoT Sensors over HTTP
117+
iot-sensors:
118+
labels:
119+
org.fiware: 'tutorial'
120+
image: quay.io/fiware/tutorials.iot-devices
121+
hostname: iot-sensors
122+
container_name: fiware-iot-devices
123+
depends_on:
124+
- redis-sensors
125+
networks:
126+
- default
127+
expose:
128+
- "${TUTORIAL_DUMMY_DEVICE_PORT}"
129+
ports:
130+
- "${TUTORIAL_DUMMY_DEVICE_PORT}:${TUTORIAL_DUMMY_DEVICE_PORT}" # localhost:3001
131+
environment:
132+
- DEBUG=devices:*
133+
- WEB_APP_HOST=tutorial
134+
- WEB_APP_PORT=${TUTORIAL_APP_PORT} # Port used by the content provider proxy and web-app for viewing data
135+
- IOTA_HTTP_HOST=iot-agent
136+
- IOTA_HTTP_PORT=${IOTA_SOUTH_PORT}
137+
- IOTA_DEFAULT_RESOURCE=/iot/json
138+
- REDIS_HOST=redis-for-sensors
139+
- DUMMY_DEVICES_PAYLOAD=JSON
140+
100141
# Tutorial acts as a Farm Management Information System
101142
tutorial:
102143
labels:
@@ -132,6 +173,7 @@ networks:
132173
volumes:
133174
mongo-db: ~
134175
mongo-config: ~
176+
redis-data: ~
135177
data-models:
136178
driver: local
137179
driver_opts:

import-data

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,4 +478,64 @@ curl -s -o /dev/null -X POST 'http://'"${CONTEXT_BROKER}"'/ngsi-ld/v1/entityOper
478478
}
479479
]'
480480

481+
482+
#
483+
# Add ids for actuators
484+
#
485+
curl -s -o /dev/null -X POST 'http://'"${CONTEXT_BROKER}"'/ngsi-ld/v1/entityOperations/upsert' \
486+
-H 'Content-Type: application/json' \
487+
-H 'Link: <'"${TUTORIAL_DATA_MODELS_CONTEXT}"'>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
488+
-H 'NGSILD-Tenant: openiot' \
489+
-H 'Accept: application/ld+json' \
490+
--data-raw '[
491+
{
492+
"id": "urn:ngsi-ld:Device:tractor001",
493+
"type": "Tractor"
494+
},
495+
{
496+
"id": "urn:ngsi-ld:Device:tractor002",
497+
"type": "Tractor"
498+
},
499+
{
500+
"id": "urn:ngsi-ld:Device:tractor003",
501+
"type": "Tractor"
502+
},
503+
{
504+
"id": "urn:ngsi-ld:Device:tractor004",
505+
"type": "Tractor"
506+
},
507+
{
508+
"id": "urn:ngsi-ld:Device:water001",
509+
"type": "Water"
510+
},
511+
{
512+
"id": "urn:ngsi-ld:Device:water002",
513+
"type": "Water"
514+
},
515+
{
516+
"id": "urn:ngsi-ld:Device:water003",
517+
"type": "Water"
518+
},
519+
{
520+
"id": "urn:ngsi-ld:Device:water004",
521+
"type": "Water"
522+
},
523+
{
524+
"id": "urn:ngsi-ld:Device:filling001",
525+
"type": "FillingLevelSensor"
526+
},
527+
{
528+
"id": "urn:ngsi-ld:Device:filling002",
529+
"type": "FillingLevelSensor"
530+
},
531+
{
532+
"id": "urn:ngsi-ld:Device:filling003",
533+
"type": "FillingLevelSensor"
534+
},
535+
{
536+
"id": "urn:ngsi-ld:Device:filling004",
537+
"type": "FillingLevelSensor"
538+
}
539+
]'
540+
481541
echo -e " \033[1;32mdone\033[0m"

0 commit comments

Comments
 (0)