Skip to content

Commit 7f511e0

Browse files
committed
Update Device Emulator to use Redis
1 parent aacf0b8 commit 7f511e0

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

docker-compose/common.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,21 @@ 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+
# 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+
3853
# Databases
3954
mongo-db:
4055
labels:
@@ -93,7 +108,6 @@ services:
93108
- IOTA_MULTI_CORE=true
94109
healthcheck:
95110
interval: 10s
96-
97111

98112
farmer:
99113
labels:
@@ -126,6 +140,8 @@ services:
126140
image: quay.io/fiware/tutorials.iot-devices
127141
hostname: iot-sensors
128142
container_name: fiware-iot-devices
143+
depends_on:
144+
- redis-sensors
129145
networks:
130146
- default
131147
expose:
@@ -144,6 +160,7 @@ services:
144160
- DUMMY_DEVICES_TRANSPORT=HTTP # Default transport used by dummy Io devices
145161
- DUMMY_DEVICES_API_KEY=4jggokgpepnvsb2uv4s40d59ov
146162
- DUMMY_DEVICES_PAYLOAD=JSON
163+
- REDIS_HOST=redis-for-sensors
147164

148165

149166
# Tutorial acts as a Farm Management Information System
@@ -184,6 +201,7 @@ networks:
184201
volumes:
185202
mongo-db: ~
186203
mongo-config: ~
204+
redis-data: ~
187205
data-models:
188206
driver: local
189207
driver_opts:

0 commit comments

Comments
 (0)