Skip to content

Commit 0676ab1

Browse files
committed
Update Device Emulator to use Redis
1 parent f13ee95 commit 0676ab1

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:
@@ -95,6 +110,8 @@ services:
95110
image: quay.io/fiware/tutorials.iot-devices
96111
hostname: iot-sensors
97112
container_name: fiware-iot-devices
113+
depends_on:
114+
- redis-sensors
98115
networks:
99116
- default
100117
expose:
@@ -107,6 +124,7 @@ services:
107124
- WEB_APP_PORT=${TUTORIAL_APP_PORT} # Port used by the content provider proxy and web-app for viewing data
108125
- IOTA_HTTP_HOST=iot-agent
109126
- IOTA_HTTP_PORT=${IOTA_SOUTH_PORT}
127+
- REDIS_HOST=redis-for-sensors
110128

111129
# Tutorial acts as a Farm Management Information System
112130
tutorial:
@@ -144,6 +162,7 @@ networks:
144162
volumes:
145163
mongo-db: ~
146164
mongo-config: ~
165+
redis-data: ~
147166
data-models:
148167
driver: local
149168
driver_opts:

0 commit comments

Comments
 (0)