-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathcommon.yml
More file actions
282 lines (268 loc) · 8.3 KB
/
common.yml
File metadata and controls
282 lines (268 loc) · 8.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# WARNING: Do not deploy this tutorial configuration directly to a production environment
#
# The tutorial docker-compose files have not been written for production deployment and will not
# scale. A proper architecture has been sacrificed to keep the narrative focused on the learning
# goals, they are just used to deploy everything onto a single Docker machine. All FIWARE components
# are running at full debug and extra ports have been exposed to allow for direct calls to services.
# They also contain various obvious security flaws - passwords in plain text, no load balancing,
# no use of HTTPS and so on.
#
# This is all to avoid the need of multiple machines, generating certificates, encrypting secrets
# and so on, purely so that a single docker-compose file can be read as an example to build on,
# not use directly.
#
# When deploying to a production environment, please refer to the Helm Repository
# for FIWARE Components in order to scale up to a proper architecture:
#
# see: https://github.com/FIWARE/helm-charts/
#
services:
# @context file is served from here
ld-context:
labels:
org.fiware: 'tutorial'
image: httpd:alpine
hostname: context
container_name: fiware-ld-context
ports:
- "3004:80"
volumes:
- data-models:/usr/local/apache2/htdocs/
- type: bind
source: ${PWD}/conf/mime.types
target: /usr/local/apache2/conf/mime.types
read_only: true
healthcheck:
test: (wget --server-response --spider --quiet http://context/user-context.jsonld 2>&1 | awk 'NR==1{print $$2}'| grep -q -e "200") || exit 1
# Cache foe Sensor Data Readings
redis-sensors:
labels:
org.fiware: 'tutorial'
image: redis:8.2.0-alpine
container_name: redis
hostname: redis-for-sensors
ports:
- "6378:6379"
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli","ping"]
interval: 10s
# Databases
mongo-db:
labels:
org.fiware: 'tutorial'
image: mongo:${MONGO_DB_VERSION}
hostname: mongo-db
container_name: db-mongo
expose:
- "${MONGO_DB_PORT}"
ports:
- "${MONGO_DB_PORT}:${MONGO_DB_PORT}" # localhost:27017
networks:
- default
volumes:
- mongo-db:/data/db
- mongo-config:/data/configdb
healthcheck:
test: ["CMD","mongosh", "localhost:27017/test", "--quiet"]
interval: 5s
# IoT-Agent is configured for the UltraLight Protocol
iot-agent:
labels:
org.fiware: 'tutorial'
image: quay.io/fiware/iotagent-ul:${ULTRALIGHT_VERSION}
hostname: iot-agent
container_name: fiware-iot-agent
depends_on:
- mongo-db
- ld-context
networks:
- default
ports:
- "${IOTA_NORTH_PORT}:${IOTA_NORTH_PORT}" # localhost:4041
- "${IOTA_SOUTH_PORT}:${IOTA_SOUTH_PORT}" # localhost:7896
deploy:
resources:
limits:
memory: 1024M
cpus: '2.0'
reservations:
memory: 512M
cpus: '1.0'
environment:
- IOTA_NORTH_PORT=${IOTA_NORTH_PORT}
- IOTA_REGISTRY_TYPE=mongodb #Whether to hold IoT device info in memory or in a database
- IOTA_LOG_LEVEL=INFO # The log level of the IoT Agent
- IOTA_TIMESTAMP=true # Supply timestamp information with each measurement
- IOTA_AUTOCAST=true # Ensure Ultralight number values are read as numbers not strings
- IOTA_MONGO_HOST=mongo-db # The host name of MongoDB
- IOTA_MONGO_PORT=${MONGO_DB_PORT} # The port mongoDB is listening on
- IOTA_MONGO_DB=iotagentul # The name of the database used in mongoDB
- IOTA_HTTP_PORT=${IOTA_SOUTH_PORT} # The port used for device traffic over HTTP
- IOTA_PROVIDER_URL=http://iot-agent:${IOTA_NORTH_PORT}
- IOTA_CB_NGSI_VERSION=ld # use NGSI-LD when sending updates for active attributes
- IOTA_JSON_LD_CONTEXT=http://context/user-context.jsonld
- IOTA_FALLBACK_TENANT=openiot
- IOTA_MULTI_CORE=true
- IOTA_AMQP_DISABLED=true
- IOTA_MQTT_DISABLED=true
healthcheck:
interval: 30s
farmer:
labels:
org.fiware: 'tutorial'
image: quay.io/fiware/tutorials.forwarder
hostname: 'farmer'
container_name: cb-farmer
ports:
- 1027:80
environment:
- TENANT=farmer
- DEBUG=broker:*
devices:
labels:
org.fiware: 'tutorial'
image: quay.io/fiware/tutorials.forwarder
hostname: 'openiot'
container_name: cb-devices
ports:
- 1028:80
environment:
- TENANT=openiot
- DEBUG=broker:*
# A series of dummy IoT Sensors over HTTP
iot-sensors:
labels:
org.fiware: 'tutorial'
image: quay.io/fiware/tutorials.iot-devices
hostname: iot-sensors
container_name: fiware-iot-devices
depends_on:
- redis-sensors
networks:
- default
expose:
- "${TUTORIAL_DUMMY_DEVICE_PORT}"
ports:
- "${TUTORIAL_DUMMY_DEVICE_PORT}:${TUTORIAL_DUMMY_DEVICE_PORT}" # localhost:3001
environment:
- DEBUG=devices:*
- WEB_APP_HOST=tutorial
- WEB_APP_PORT=${TUTORIAL_APP_PORT} # Port used by the content provider proxy and web-app for viewing data
- IOTA_HTTP_HOST=iot-agent
- IOTA_HTTP_PORT=${IOTA_SOUTH_PORT}
- PIG_COUNT=${PIG_COUNT}
- COW_COUNT=${COW_COUNT}
- REDIS_HOST=redis-for-sensors
# Tutorial acts as a Farm Management Information System
tutorial:
labels:
org.fiware: 'tutorial'
image: quay.io/fiware/tutorials.ngsi-ld
hostname: tutorial
container_name: fiware-tutorial
depends_on:
- mongo-db
networks:
- default
expose:
- "${TUTORIAL_APP_PORT}"
ports:
- "${TUTORIAL_APP_PORT}:${TUTORIAL_APP_PORT}" # localhost:3000
environment:
- DEBUG=tutorial:*
- WEB_APP_PORT=${TUTORIAL_APP_PORT} # Port used by the content provider proxy and web-app for viewing data
- IOTA_HTTP_HOST=iot-agent
- IOTA_HTTP_PORT=${IOTA_SOUTH_PORT}
- DUMMY_DEVICES=http://iot-sensors:3001
- MONGO_URL=mongodb://mongo-db:27017
- IOTA_JSON_LD_CONTEXT=http://context/user-context.jsonld
- CRATE_DB_SERVICE_URL=http://crate-db:4200/_sql
- NGSI_LD_TENANT=openiot
# Quantum Leap is persisting Short Term History to Crate-DB
quantumleap:
labels:
org.fiware: 'tutorial'
image: orchestracities/quantumleap:${QUANTUMLEAP_VERSION}
hostname: quantumleap
container_name: fiware-quantumleap
depends_on:
- crate-db
- redis-db
networks:
- default
ports:
- "${QUANTUMLEAP_PORT}:${QUANTUMLEAP_PORT}"
environment:
- CRATE_HOST=crate-db
- REDIS_HOST=redis-db
- REDIS_PORT=${REDIS_PORT}
- LOGLEVEL=DEBUG
healthcheck:
test: curl --fail -s http://quantumleap:${QUANTUMLEAP_PORT}/version || exit 1
redis-db:
labels:
org.fiware: 'tutorial'
image: redis:${REDIS_VERSION}
hostname: redis-db
container_name: db-redis
networks:
- default
ports:
- "${REDIS_PORT}:${REDIS_PORT}" # localhost:6379
volumes:
- redis-db:/data
healthcheck:
test: ["CMD", "redis-cli","ping"]
interval: 10s
crate-db:
labels:
org.fiware: 'tutorial'
image: crate:${CRATE_VERSION}
hostname: crate-db
container_name: db-crate
ports:
# Admin UI
- "4200:4200"
# Transport protocol
- "4300:4300"
command: crate -Cauth.host_based.enabled=false -Ccluster.name=democluster -Chttp.cors.enabled=true -Chttp.cors.allow-origin="*" -Cdiscovery.type=single-node
environment:
- CRATE_HEAP_SIZE=2g # see https://crate.io/docs/crate/howtos/en/latest/deployment/containers/docker.html#troubleshooting
volumes:
- crate-db:/data
# Other services
grafana:
labels:
org.fiware: 'tutorial'
image: grafana/grafana:8.5.27
container_name: grafana
depends_on:
- crate-db
ports:
- "3003:3000"
environment:
- GF_INSTALL_PLUGINS=orchestracities-map-panel,grafana-clock-panel,grafana-worldmap-panel
volumes:
- grafana:/var/lib/grafana
networks:
default:
labels:
org.fiware: 'tutorial'
ipam:
config:
- subnet: 172.18.1.0/24
volumes:
crate-db: ~
redis-db: ~
grafana: ~
mongo-db: ~
mongo-config: ~
redis-data: ~
data-models:
driver: local
driver_opts:
type: none
o: bind
device: ${PWD}/data-models