Skip to content

Commit 33e0237

Browse files
committed
Update Device Emulator to use Redis
1 parent 1ed5f5e commit 33e0237

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

docker-compose/common.yml

Lines changed: 19 additions & 0 deletions
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:
@@ -127,6 +142,8 @@ services:
127142
image: quay.io/fiware/tutorials.iot-devices
128143
hostname: iot-sensors
129144
container_name: fiware-iot-devices
145+
depends_on:
146+
- redis-sensors
130147
networks:
131148
- default
132149
expose:
@@ -141,6 +158,7 @@ services:
141158
- IOTA_HTTP_PORT=${IOTA_SOUTH_PORT}
142159
- PIG_COUNT=${PIG_COUNT}
143160
- COW_COUNT=${COW_COUNT}
161+
- REDIS_HOST=redis-for-sensors
144162

145163
# Tutorial acts as a Farm Management Information System
146164
tutorial:
@@ -179,6 +197,7 @@ networks:
179197
volumes:
180198
mongo-db: ~
181199
mongo-config: ~
200+
redis-data: ~
182201
data-models:
183202
driver: local
184203
driver_opts:

0 commit comments

Comments
 (0)