-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
281 lines (258 loc) · 8.82 KB
/
docker-compose.yml
File metadata and controls
281 lines (258 loc) · 8.82 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
# WARNING: Do not deploy this configuration directly to a production environment
#
# This 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/
#
version: "3.8"
services:
# Orion is the context broker
orion:
labels:
org.label: ${ORG}
image: fiware/orion:${ORION_VERSION}
container_name: ${ORION}
depends_on:
db-mongo:
condition: service_healthy
networks:
- default
expose:
- ${ORION_PORT}
ports:
- ${ORION_PORT}:1026
command: -dbhost ${MONGO} -logLevel ${LOG_LEVEL}
healthcheck:
test: curl --fail -s http://${ORION}:${ORION_PORT}/version || exit 1
interval: 5s
# Quantum Leap is persisting Short Term History to CrateDB
quantumleap:
labels:
org.label: ${ORG}
image: orchestracities/quantumleap:${QUANTUMLEAP_VERSION}
container_name: ${QUANTUMLEAP}
ports:
- ${QUANTUMLEAP_PORT}:8668
depends_on:
db-crate:
condition: service_healthy
db-redis:
condition: service_healthy
environment:
- CRATE_HOST=${CRATE}
- REDIS_HOST=${REDIS}
- REDIS_PORT=${REDIS_PORT}
- LOGLEVEL=${LOG_LEVEL}
healthcheck:
test: curl --fail -s http://${QUANTUMLEAP}:${QUANTUMLEAP_PORT}/version || exit 1
interval: 5s
# IoT-Agent for OPC-UA protocol
iot-agent-opcua:
labels:
org.label: ${ORG}
image: iotagent4fiware/iotagent-opcua:${OPC_UA_VERSION}
container_name: ${IOTA}
depends_on:
orion:
condition: service_healthy
networks:
- default
ports:
- ${IOTA_NORTH_PORT}:4041
- ${IOTA_SOUTH_PORT}:9229
volumes:
- ./iot-agent/opcua.js:/opt/iotagent-opcua/conf/config.js
environment:
- OCB_ID_PROCESS=${OCB_ID_PROCESS}
- OPCUA_ID_PROCESS=${OPCUA_ID_PROCESS}
- DEVICE_ID=${DEVICE_ID_BASE}:${DEVICE_TYPE}:001
- DEVICE_TYPE=${DEVICE_TYPE}
- FIWARE_SERVICE=${FIWARE_SERVICE}
- FIWARE_SERVICEPATH=${FIWARE_SERVICEPATH}
- IOTA_FALLBACK_TENANT=${FIWARE_SERVICE}
- IOTA_FALLBACK_PATH=${FIWARE_SERVICEPATH}
- IOTA_OPCUA_ENDPOINT=opc.tcp://${OPCUA_ENDPOINT}:${OPCUA_PORT}/ # Endpoint of OPC UA Server
- IOTA_OPCUA_MT_ENTITY_ID=${IOTA_OPCUA_MT_ENTITY_ID}
- IOTA_OPCUA_SECURITY_MODE=None # Security mode for OPC UA connection
- IOTA_OPCUA_SECURITY_POLICY=None # Security policy for OPC UA connection
- IOTA_OPCUA_SECURITY_USERNAME=null # Security username for OPC UA connection
- IOTA_OPCUA_SECURITY_PASSWORD=null # Security password for OPC UA connection
- IOTA_CB_HOST=${ORION} # Hostname of the context broker to update context
- IOTA_CB_PORT=${ORION_PORT} # Port that context broker listens on to update context
- IOTA_NORTH_PORT=${IOTA_NORTH_PORT} # Port used for configuring the IoT Agent and receiving context updates from the context broker
- IOTA_REGISTRY_TYPE=mongodb # Whether to hold IoT device info in memory or in a database
- IOTA_MONGO_HOST=${MONGO} # The hostname of MongoDB - used for holding device and service information
- IOTA_MONGO_PORT=${MONGO_PORT} # The port that MongoDB is listening on
- IOTA_MONGO=${IOTA} # The name of the database used in MongoDB
- IOTA_PROVIDER_URL=http://${IOTA}:${IOTA_NORTH_PORT} # URL passed to the Context Broker when commands are registered, used as a forwarding URL location when the Context Broker issues a command to a device
- IOTA_OPCUA_UNIQUE_SUBSCRIPTION=false # Boolean property to assess whether subscribe once for multiple OPC UA nodes or not
- LOGLEVEL=${LOG_LEVEL}
# Databases
db-mongo:
labels:
org.label: ${ORG}
image: mongo:${MONGO_VERSION}
container_name: ${MONGO}
expose:
- ${MONGO_PORT}
ports:
- ${MONGO_PORT}:27017
networks:
- default
volumes:
- ${MONGO}_data:/data/db
- ${MONGO}_config:/data/configdb
healthcheck:
test: |
host=`hostname --ip-address || echo '127.0.0.1'`;
mongo --quiet $host/test --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)' && echo 0 || echo 1
interval: 5s
# # Mongo GUI, to chek if Mongo it's working just for dev purpose
# mongo-express:
# image: mongo-express:1.0.0-alpha
# labels:
# org.label: ${ORG}
# container_name: mongo-express
# environment:
# # ME_CONFIG_MONGODB_ADMINUSERNAME: admin
# # ME_CONFIG_MONGODB_ADMINPASSWORD: admin
# ME_CONFIG_MONGODB_SERVER: "${MONGO}"
# ME_CONFIG_MONGODB_PORT: "${MONGO_PORT}"
# ports:
# - "8081:8081"
# networks:
# - default
# depends_on:
# db-mongo:
# condition: service_healthy
db-crate:
labels:
org.label: ${ORG}
image: crate:${CRATE_VERSION}
container_name: ${CRATE}
ports:
- ${CRATE_PORT_ADMIN}:4200
- ${CRATE_PORT_TRANSPORT_PROTOCOL}:4300
- ${CRATE_PORT_POSTGRES}:5432
command: crate -Cauth.host_based.enabled=false -Ccluster.name=rampcluster -Chttp.cors.enabled=false -Chttp.cors.allow-origin="*"
environment:
- CRATE_HEAP_SIZE=2g # see https://crate.io/docs/crate/howtos/en/latest/deployment/containers/docker.html#troubleshooting
volumes:
- ${CRATE}:/data
healthcheck:
test: curl --fail -s http://${CRATE}:${CRATE_PORT_ADMIN}/ || exit 1
interval: 5s
db-redis:
labels:
org.label: ${ORG}
image: redis:${REDIS_VERSION}
container_name: ${REDIS}
networks:
- default
ports:
- ${REDIS_PORT}:6379
volumes:
- ${REDIS}:/data
healthcheck:
test: ["CMD", "redis-cli","ping"]
interval: 5s
# # Redis GUI, to chek if Redis it's working just for dev purpose
# redisinsight:
# labels:
# org.label: ${ORG}
# image: redislabs/redisinsight:1.13.1
# container_name: "redisinsight"
# networks:
# - default
# ports:
# - '8001:8001'
# volumes:
# - redisinsight:/db
# depends_on:
# db-redis:
# condition: service_healthy
# Dashboard
grafana:
labels:
org.label: ${ORG}
image: grafana/grafana:${GRAFANA_VERSION}
container_name: ${GRAFANA}
ports:
- "${GRAFANA_PORT}:3000"
environment:
- CRATE=${CRATE}
- CRATE_PORT_POSTGRES=${CRATE_PORT_POSTGRES}
- FIWARE_SERVICE=$FIWARE_SERVICE
- CRATE_SCHEMA=$CRATE_SCHEMA
- CRATE_TABLE=$CRATE_TABLE
- CRATE_TABLE_DURATION=$CRATE_TABLE_DURATION
- CRATE_TABLE_OEE=$CRATE_TABLE_OEE
volumes:
- ${GRAFANA}:/var/lib/grafana
- ./grafana/datasources:/etc/grafana/provisioning/datasources
- ./grafana/dashboards:/etc/grafana/provisioning/dashboards
- ./grafana/configuration/custom.ini:/etc/grafana/grafana.ini
# ROSE-AP
oee-service:
labels:
org.label: ${ORG}
image: ${ROSEAP_OEE}
container_name: ${ROSEAP_OEE}
depends_on:
db-crate:
condition: service_healthy
orion:
condition: service_healthy
iot-agent-opcua:
condition: service_started
volumes:
- ./${ROSEAP_OEE}/.config:/app/.config
- ./.env:/app/.env
ports:
- ${ROSEAP_OEE_PORT}:8008
networks:
- default
stdin_open: true
tty: true
# healthcheck:
# test: curl -s -o /dev/null -w %{http_code} "http://${ROSEAP_OEE}:${ROSEAP_OEE_PORT}/version" == 200 || exit 1
# interval: 5s
# OPC-UA Demo Server
opc-ua-demo-server:
labels:
org.label: ${ORG}
image: ${OPCUA_ENDPOINT}
container_name: ${OPCUA_ENDPOINT}
volumes:
- ./.env:/app/.env
ports:
- ${OPCUA_PORT}:${OPCUA_PORT}
networks:
- default
stdin_open: true
tty: true
profiles:
- demo
networks:
default:
labels:
org.label: ${ORG}
volumes:
db-mongo_data: ~
db-mongo_config: ~
db-crate: ~
db-redis: ~
# redisinsight: ~
grafana: ~