-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
455 lines (428 loc) · 13.5 KB
/
docker-compose.yml
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
# version: "3.9"
services:
# Orion v2 Context Broker
orion:
image: fiware/orion:latest # 3.8.0
# hostname: orion
container_name: orion
depends_on:
mongo-db:
condition: service_healthy
# restart: on-failure # for Docker Compose
# deploy: # for Docker Swarm
# mode: replicated
# replicas: 3
# restart_policy:
# condition: on-failure
# networks:
# - default
expose:
- "1026" # orion:1026
ports:
- "10260:1026" # (for testing) localhost:10260
command: -dbhost mongo-db -db orion -logLevel DEBUG
# healthcheck:
# interval: 15s
# Orion-LD Context Broker
orion-ld:
image: fiware/orion-ld:latest # 1.1.2
# hostname: orion-ld
container_name: orion-ld
depends_on:
mongo-db:
condition: service_healthy
# restart: on-failure # for Docker Compose
# deploy: # for Docker Swarm
# mode: replicated
# replicas: 3
# restart_policy:
# condition: on-failure
# networks:
# - default
expose:
- "1026" # orion-ld:1026
ports:
- "10270:1026" # (for testing) localhost:10270
command: -dbhost mongo-db -db orionld -logLevel DEBUG
healthcheck:
test: curl --fail -s http://localhost:1026/ngsi-ld/ex/v1/version || exit 1
# interval: 5s
# Keyrock IdM
keyrock:
image: fiware/idm:latest # 8.3.2-distroless
# hostname: keyrock
container_name: keyrock
depends_on:
mysql-db:
condition: service_healthy
# restart: on-failure # for Docker Compose
# deploy: # for Docker Swarm
# mode: replicated
# replicas: 3
# restart_policy:
# condition: on-failure
# networks:
# - default
# expose:
# - "3005" # keyrock:3005
ports:
- "3005:3005" # localhost:3005
environment:
- DEBUG=idm:*
- IDM_DB_HOST=mysql-db
- IDM_DB_PASS=secret
- IDM_DB_USER=root
- IDM_HOST=http://localhost:3005
- IDM_PORT=3005
- IDM_HTTPS_ENABLED=false
- IDM_HTTPS_PORT=3443
- IDM_ADMIN_USER=alice
- IDM_ADMIN_PASS=test
- IDM_CSP_FORM_ACTION=*
# healthcheck:
# interval: 5s
# Wilma PEP Proxy for Orion (v2)
orion-proxy:
image: fiware/pep-proxy:latest # 8.3.0-distroless
# hostname: orion-proxy
container_name: orion-proxy
depends_on:
keyrock:
condition: service_started
restart: on-failure # for Docker Compose
# deploy: # for Docker Swarm
# mode: replicated
# replicas: 3
# restart_policy:
# condition: on-failure
# networks:
# - default
# expose:
# - "1027" # orion-proxy:1027
ports:
- "1026:1027" # localhost:1026
environment:
- DEBUG=pep-proxy:*
- PEP_PROXY_DEBUG=true
- PEP_PROXY_APP_HOST=orion
- PEP_PROXY_APP_PORT=1026
- PEP_PROXY_PORT=1027
- PEP_PROXY_IDM_HOST=keyrock
- PEP_PROXY_HTTPS_ENABLED=false
- PEP_PROXY_AUTH_ENABLED=false
- PEP_PROXY_IDM_SSL_ENABLED=false
- PEP_PROXY_IDM_PORT=3005
- PEP_PROXY_APP_ID=tutorial-dckr-site-0000-xpresswebapp
- PEP_PROXY_USERNAME=pep_proxy_00000000-0000-0000-0000-000000000000
- PEP_PASSWORD=test
- PEP_PROXY_PDP=idm
- PEP_PROXY_MAGIC_KEY=1234
- PEP_PROXY_PUBLIC_PATHS=/version
# healthcheck:
# interval: 50s
# Wilma PEP Proxy for Orion-LD
orion-ld-proxy:
image: fiware/pep-proxy:latest # 8.3.0-distroless
# hostname: orion-ld-proxy
container_name: orion-ld-proxy
depends_on:
keyrock:
condition: service_started
restart: on-failure # for Docker Compose
# deploy: # for Docker Swarm
# mode: replicated
# replicas: 3
# restart_policy:
# condition: on-failure
# networks:
# - default
# expose:
# - "1027" # orion-proxy-ld:1027
ports:
- "1027:1027" # localhost:1027
environment:
- DEBUG=pep-proxy:*
- PEP_PROXY_DEBUG=true
- PEP_PROXY_APP_HOST=orion-ld
- PEP_PROXY_APP_PORT=1026
- PEP_PROXY_PORT=1027
- PEP_PROXY_IDM_HOST=keyrock
- PEP_PROXY_HTTPS_ENABLED=false
- PEP_PROXY_AUTH_ENABLED=false
- PEP_PROXY_IDM_SSL_ENABLED=false
- PEP_PROXY_IDM_PORT=3005
- PEP_PROXY_APP_ID=tutorial-dckr-site-0000-xpresswebapp
- PEP_PROXY_USERNAME=pep_proxy_00000000-0000-0000-0000-000000000000
- PEP_PASSWORD=test
- PEP_PROXY_PDP=idm
- PEP_PROXY_MAGIC_KEY=1234
- PEP_PROXY_PUBLIC_PATHS=/version
# healthcheck:
# interval: 50s
# Apache Server for NGSI-LD @context files
ld-context:
image: httpd:alpine
# hostname: ld-context
container_name: ld-context
# restart: on-failure # for Docker Compose
# deploy: # for Docker Swarm
# restart_policy:
# condition: on-failure
networks:
default:
aliases:
- apache
- apache-server
- http
- http-server
# expose:
# - 80 # http://ld-context
ports:
- 80:80 # http://localhost
volumes:
- ./public:/usr/local/apache2/htdocs/
healthcheck:
test: curl -f http://localhost || exit 1
# interval: 15s
# Databases
# Mongo DB (Orion)
mongo-db:
image: mongo:5 # 5.0.14
# hostname: mongo-db
container_name: db-mongo
# restart: on-failure # for Docker Compose
# deploy: # for Docker Swarm
# restart_policy:
# condition: on-failure
# networks:
# - default
expose:
- "27017" # mongo-db:27017
# ports:
# - "27017:27017" # localhost:27017
command: --nojournal
volumes:
- mongo-db:/data/db
- mongo-db-config:/data/configdb
- ./mongo/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
healthcheck:
# test: |
# mongo --quiet localhost/test --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)' && exit 0 || exit 1
# interval: 5s
test: echo 'db.runCommand({serverStatus:1}).ok' | mongosh localhost:27017/test --quiet
# interval: 10s
# timeout: 10s
# start_period: 10s
# retries: 5
# Mongo DB front-end
mongo-express:
image: mongo-express:latest # 1.0.0-alpha
# hostname: mongo-express
container_name: fe-mongo
depends_on:
mongo-db:
condition: service_healthy
# restart: on-failure # for Docker Compose
# deploy: # for Docker Swarm
# restart_policy:
# condition: on-failure
# networks:
# - default
expose:
- "8081" # mongo-express:8081
# ports:
# - "8081:8081" # localhost:8081
environment:
- ME_CONFIG_MONGODB_SERVER=mongo-db
# healthcheck:
# test: wget --quiet --tries=3 --spider http://localhost:8081 || exit 1
# timeout: 10s
# retries: 30
# docker run -it --rm --net=fiware_default --name fe-mongo -p 80:8081 -e ME_CONFIG_MONGODB_SERVER=mongo-db mongo-express
# docker run -it --rm --net=fiware_default --name ngrok-mongo -e NGROK_AUTHTOKEN=2L2kdrNlcTBcxDERiOxTW3kyEaV_3siN3rWauYmt4KLGHrHZg ngrok/ngrok:latest http 8081
# MySQL DB (Keyrock)
mysql-db:
image: mysql:latest # 8.0.32
# hostname: mysql-db
container_name: db-mysql
# restart: on-failure # for Docker Compose
# deploy: # for Docker Swarm
# restart_policy:
# condition: on-failure
# networks:
# - default
expose:
- "3306" # mysql-db:3306
# ports:
# - "3306:3306" # localhost:3306
environment:
- MYSQL_ROOT_PASSWORD=secret
- MYSQL_ROOT_HOST=%
volumes:
- mysql-db:/var/lib/mysql
- ./mysql:/docker-entrypoint-initdb.d/:ro
healthcheck:
test: mysqladmin ping -h localhost -uroot -psecret
# interval: 5s
# timeout: 5s
# start_period: 10s
# retries: 20
# docker exec db-mysql /usr/bin/mysqldump --databases -u root --password=secret idm > backup.sql
# cat backup.sql | docker exec -i db-mysql /usr/bin/mysql -u root --password=secret idm
# MySQL DB front-end
adminer:
image: adminer:latest # 4.8.1
# hostname: adminer
container_name: fe-mysql
depends_on:
mysql-db:
condition: service_healthy
# restart: on-failure # for Docker Compose
# deploy: # for Docker Swarm
# restart_policy:
# condition: on-failure
# networks:
# - default
expose:
- "8080" # adminer:8080
# ports:
# - "8080:8080" # localhost:8080
environment:
# - ADMINER_DEFAULT_DB_DRIVER=mysql
# - ADMINER_DEFAULT_DB_HOST=mysql-db
# - ADMINER_DEFAULT_DB_NAME=root
# - ADMINER_DEFAULT_DB_PASSWORD=secret
- ADMINER_DESIGN=pokorny # mvt # pepa-linha # rmsoft_blue
# - ADMINER_PLUGINS=see https://www.adminer.org/en/plugins/
# healthcheck: TBD
# docker run -it --rm --network fiware_default --name fe-mysql -p 80:8080 adminer
# docker run -it --rm --network fiware_default --name ngrok-mysql -e NGROK_AUTHTOKEN=2L2kdrNlcTBcxDERiOxTW3kyEaV_3siN3rWauYmt4KLGHrHZg ngrok/ngrok:latest http 8080
# Other services
# Blockchain (Ganache)
ganache:
image: trufflesuite/ganache:latest # v7.7.3
# hostname: ganache
container_name: bc-ganache
# restart: on-failure # for Docker Compose
# deploy: # for Docker Swarm
# restart_policy:
# condition: on-failure
# networks:
# - default
# expose:
# - "7545" # ganache:7545
ports:
- "8545:7545" # localhost:8545
command: --database.dbPath /db --server.host 0.0.0.0 --server.port 7545 --wallet.mnemonic "visit carpet logic blame furnace confirm rebel deliver medal mean illness error"
volumes:
# - ./ganache/.db:/db
- ganache-db:/db
healthcheck:
test: |
node -e 'data = JSON.stringify({jsonrpc:"2.0",method:"eth_blockNumber",params:[],id:1}); require("http").request({hostname:"localhost", port: 7545, method:"POST", headers: {"Content-Type": "application/json", "Content-Length": data.length }}, resp => resp.on("data", chunk => process.exit(0)).on("error", err => process.exit(1))).write(data)' && exit 0 || exit 1
# test: curl -f -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' http://localhost:7545 && exit 0 || exit 1
# interval: 5s
# timeout: 5s
# retries: 5
# Blockchain front-end (Lite Explorer)
lite-explorer:
image: alethio/ethereum-lite-explorer:latest # v1.0.0-beta.10
# hostname: lite-explorer
container_name: fe-ganache
depends_on:
ganache:
condition: service_healthy
# restart: on-failure # for Docker Compose
# deploy: # for Docker Swarm
# restart_policy:
# condition: on-failure
# networks:
# - default
# expose:
# - "80" # lite-explorer:80
ports:
- "8082:80" # localhost:8082
environment:
- APP_NODE_URL=http://ganache:7545
# healthcheck: TBD
# docker run -it --rm --network fiware_default --name fe-ganache -p 80:80 -e APP_NODE_URL="http://ganache:7545" alethio/ethereum-lite-explorer
# docker run -it --rm --name fe-ganache -p 80:80 -e APP_NODE_URL="http://localhost:8545" alethio/ethereum-lite-explorer
# MQTT Broker (MosQuiTTo)
mosquitto:
image: eclipse-mosquitto:latest # 2.0.15
# hostname: mosquitto
container_name: mqtt-broker
# restart: on-failure # for Docker Compose
# deploy: # for Docker Swarm
# restart_policy:
# condition: on-failure
networks:
default:
aliases:
- mqtt
- mqtt-broker
# expose:
# - "1883" # mosquitto:8883
# - "9001" # mosquitto:9001
ports:
- "8883:1883" # localhost:8883
- "9001:9001" # localhost:9001
command: mosquitto -c /mosquitto-no-auth.conf
# volumes:
# - ./mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf
healthcheck:
test: mosquitto_sub -t '$$SYS/#' -C 1 | grep -v Error || exit 1
# test: timeout 5 mosquitto_sub -t '$$SYS/#' -C 1 | grep -v Error || exit 1
# interval: 10s
# timeout: 10s
# retries: 6
# docker exec -it mosquitto mosquitto_sub -h mosquitto -t "/#"
# docker exec -it mosquitto mosquitto_pub -h mosquitto -m "Hello world!" -t "/test"
# Node-RED for flow-programming automation
node-red:
build: ./node-red
# image: nodered/node-red
# hostname: node-red
container_name: node-red
# expose:
# - "1880" # node-red:1880
ports:
- "8880:1880" # localhost:8880
environment:
- ETHEREUM_ADDRESS
- ETHEREUM_PRIVATE_KEY
- TZ=Europe/Amsterdam
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ./node-red/data:/data
- /home:/home
- /root:/root
# volumes:
# - node-red-data:/data
# Custom Node-RED-based IoT Agent
custom-iota:
build: ./node-red/custom-iota
# hostname: iota
container_name: custom-iota
environment:
# - PUID=1000
# - PGID=1000
- TZ=Europe/Amsterdam
# volumes:
# - ./node-red/config:/config
restart: unless-stopped
# Volumes
volumes:
ganache-db: ~
mysql-db: ~
mongo-db: ~
mongo-db-config: ~
# node-red-data: ~
# Networks (with MTU patch for Vicenza2 VM)
networks:
default:
driver: bridge
driver_opts:
com.docker.network.driver.mtu: 1450