-
Notifications
You must be signed in to change notification settings - Fork 60
/
docker-compose.yml
433 lines (419 loc) · 15.7 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
##############################################################################
#
# Name: docker-compose.yml
#
# Function:
# Configure the docker-iot-dashboard collection of docker containers.
#
# Copyright:
# This file copyright (c) 2017-2022 by
#
# MCCI Corporation
# 3520 Krums Corners Road
# Ithaca, NY 14850
#
# Distributed under the terms of the license file shipped with this
# collection.
#
# Authors:
# Terry Moore, MCCI Corporation
# Murugan Chandrasekar, MCCI Corporation
# Based on work by Johan Stocking, The Things Network
#
##############################################################################
#
# Note: if you are running this manually, you must set a number of variables,
# not least IOT_DASHBOARD_DATA, which must be the path to the top data directory
# for these apps. If you use dashboard-ctl, this will be done for you.
#
# To get a list of all variables used in this file, use the following command:
# sed -n -e 's/#.*$//' -e 's/[^$]*${\([^-:}]*\)[-:}][^$]*/\1/p' docker-compose.yml | LC_ALL=C sort -u
#
# To get a list of undocumented variables, use the following command,
# then look in the left hand column:
#
# comm <(sed -n -e 's/#.*$//' -e 's/[^$]*${\([^-:}]*\)[-:}][^$]*/\1/p' docker-compose.yml | LC_ALL=C sort -u) <(sed -n -e '/^# IOT_[A-Z_0-9]*$/s/^# //p' docker-compose.yml | LC_ALL=C sort -u )
#
#+++
# IOT_DASHBOARD_NGINX_FQDN
# The fully-qualified domain name to be served by NGINX.
#
# IOT_DASHBOARD_AWS_ACCESS_KEY_ID
# The access key for AWS for backups.
#
# IOT_DASHBOARD_AWS_SECRET_ACCESS_KEY
# The AWS API secret key for backing up influxdb data.
#
# IOT_DASHBOARD_AWS_DEFAULT_REGION
# The AWS default region.
#
# IOT_DASHBOARD_AWS_S3_BUCKET
# The name of S3 host bucket.
#
# IOT_DASHBOARD_AWS_S3_BUCKET_NGINX
# The name of S3 bucket for Nginx backup
#
# IOT_DASHBOARD_AWS_S3_BUCKET_NODERED
# The name of S3 bucket for Node-red backup
#
# IOT_DASHBOARD_AWS_S3_BUCKET_GRAFANA
# The name of S3 bucket for Grafana backup
#
# IOT_DASHBOARD_AWS_S3_BUCKET_MQTTS
# The name of S3 bucket for Mqtts backup
#
# IOT_DASHBOARD_AWS_S3_BUCKET_INFLUXDB
# The S3 bucket to be used for uploading the influxdb backup data.
#
# IOT_DASHBOARD_AWS_S3_BUCKET_MONGODB
# The S3 bucket to be used for uploading the mongodb backup data.
#
# IOT_DASHBOARD_AWS_HOST_BASE
# The S3 endpoint is used to configure 3rd party clients(s3cmd).
# For Amazon: s3.amazonaws.com , For DigitalOcean: nyc3.digitaloceanspaces.com
#
# IOT_DASHBOARD_AWS_HOST_BUCKET
# The S3 endpoint to access host bucket.
# For Amazon: '%(${IOT_DASHBOARD_AWS_S3_BUCKET})s.s3.amazonaws.com'
# For DigitalOcean: '%(${IOT_DASHBOARD_AWS_S3_BUCKET}).nyc3.digitaloceanspaces.com'
#
# IOT_DASHBOARD_CERTBOT_EMAIL
# The email address to be used for registering with Let's Encrypt.
#
# IOT_DASHBOARD_CERTBOT_FQDN
# The domain(s) to be used by certbot when registering with Let's Encrypt.
#
# IOT_DASHBOARD_DATA
# The path to the data directory. This must end with a '/', and must either
# be absolute or must begin with './'. (If not, you'll get parse errors.)
#
# IOT_DASHBOARD_GRAFANA_ADMIN_PASSWORD
# The password to be used for the admin user on first login. This is ignored
# after the Grafana database has been built.
#
# IOT_DASHBOARD_GRAFANA_PROJECT_NAME
# The project name to be used for the emails from the administrator.
#
# IOT_DASHBOARD_GRAFANA_LOG_MODE
# Set the grafana log mode.
#
# IOT_DASHBOARD_GRAFANA_LOG_LEVEL
# Set the grafana log level (e.g. debug)
#
# IOT_DASHBOARD_GRAFANA_SMTP_ENABLED
# Set to false to disable SMTP.
# Defaults to true
#
# IOT_DASHBOARD_GRAFANA_SMTP_SKIP_VERIFY
# Set to false to enable SSL verification.
# Defaults to true.
#
# IOT_DASHBOARD_GRAFANA_INSTALL_PLUGINS
# A list of grafana plugins to install. Use (comma and space) ", " to delimit plugins.
#
# IOT_DASHBOARD_GRAFANA_SMTP_FROM_ADDRESS
# The "from" address for Grafana emails.
#
# IOT_DASHBOARD_GRAFANA_USERS_ALLOW_SIGN_UP
# Set to true to allow users to sign up.
#
# IOT_DASHBOARD_INFLUXDB_ADMIN_PASSWORD
# The password to be used for the admin user by influxdb. Again, this is
# ignored after the influxdb database has been built.
#
# IOT_DASHBOARD_INFLUXDB_INITIAL_DATABASE_NAME
# The inital database to be created on first launch of influxdb. Ignored
# after influxdb has been launched.
#
# IOT_DASHBOARD_MAIL_DOMAIN
# The postfix mail domain.
#
# IOT_DASHBOARD_MAIL_HOST_NAME
# The external FQDN for the mail host.
#
# IOT_DASHBOARD_MAIL_RELAY_IP
# The mail relay machine, assuming that the real mailer is upstream from us.
#
# IOT_DASHBOARD_MAIL_SMTP_AUTH
# To enable SMTP authentication, set to "yes".
# Defaults to "no"
#
# IOT_DASHBOARD_MAIL_SMTP_LOGIN
# The mail relay login: [email protected] -- it will come from your upstream provider.
#
# IOT_DASHBOARD_MAIL_SMTP_PASSWORD
# The mail relay password
#
# IOT_DASHBOARD_MAIL_TLS_SECURITY_LEVEL
# To enable SSL/TLS support for postfix container. set to "encrypt" to enable SSL/TLS
# Defaults to "may"
#
# IOT_DASHBOARD_MAIL_TLS_WRAPPERMODE
# To enable SSL/TLS support for postfix container. set to "yes" to enable SSL/TLS
# Defaults to "no"
#
# IOT_DASHBOARD_PORT_HTTP
# The port to listen to for HTTP. Primarily for test purposes. Defaults to 80.
#
# IOT_DASHBOARD_PORT_HTTPS
# The port to listen to for HTTPS. Primarily for test purposes. Defaults to 443.
#
# IOT_DASHBOARD_TIMEZONE
# The timezone to use. Defaults to GMT.
#
# IOT_DASHBOARD_NODE_RED_VERSION
# To Install specific version of node-red version. Defaults to latest.
#
# IOT_DASHBOARD_NODE_RED_INSTALL_MODULES
# To Install the required node-red modules. use "space" to delimit the modules.
#
# IOT_DASHBOARD_PORT_MQTT_TCP
# Accessing mqtt channel over TCP. Defaults to 1883.
#
# IOT_DASHBOARD_PORT_MQTT_SSL
# Accessing mqtt channel over TLS/SSL. Defaults to 8883.
#
# IOT_DASHBOARD_PORT_MQTT_WSS
# Accessing mqtt channel over WSS. Defaults to 8083.
#
# IOT_DASHBOARD_INFLUXDB_MAIL_HOST_NAME
# The external FQDN for the influxdb host
#
# IOT_DASHBOARD_INFLUXDB_BACKUP_EMAIL
# To send backup mail in Influxdb container. Use "space" to delimit the MAIL IDs.
#
# IOT_DASHBOARD_CRON_BACKUP_EMAIL
# To send backup mail in cron-backup container. Use "space" to delimit the MAIL IDs.
#
# IOT_DASHBOARD_MONGO_INITDB_ROOT_USERNAME
# The Username to be used for accessing Mongodb.
#
# IOT_DASHBOARD_MONGO_INITDB_ROOT_PASSWORD
# The Password to be used for accessing Mongodb root user.
#
# IOT_DASHBOARD_MONGO_DNC_DBNAME
# The DNC-DB to be used for managing DNC configurations
#
# IOT_DASHBOARD_MONGO_DNC_USERNAME
# The Username to be used for accessing DNC-DB
#
# IOT_DASHBOARD_MONGO_DNC_PASSWD
# The Password to be used for accessing DNC-DB
#
#---
# Also see nginx/setup.sh, which uses some additional test variables when
# debugging.
#
version: '3.8'
services:
# the nginx server connects us to the outside world
nginx:
environment:
CERTBOT_DOMAINS: "${IOT_DASHBOARD_CERTBOT_FQDN:-.}"
CERTBOT_EMAIL: "${IOT_DASHBOARD_CERTBOT_EMAIL:-.}"
NGINX_FQDN: "${IOT_DASHBOARD_NGINX_FQDN:-.}"
restart: unless-stopped
build: nginx
ports:
- "${IOT_DASHBOARD_PORT_HTTP:-80}:80"
- "${IOT_DASHBOARD_PORT_HTTPS:-443}:443"
- "${IOT_DASHBOARD_PORT_MONGODB_PROXY:-27020}:27020"
volumes:
- "${IOT_DASHBOARD_DATA}docker-nginx/htdocs:/usr/local/nginx/htdocs"
- "${IOT_DASHBOARD_DATA}docker-nginx/letsencrypt:/etc/letsencrypt"
- "${IOT_DASHBOARD_DATA}docker-nginx/authdata/influxdb:/etc/nginx/authdata/influxdb"
- "${IOT_DASHBOARD_DATA}docker-nginx/authdata/nodered:/etc/nginx/authdata/nodered"
# nginx proxies for all of the below, so it needs to have links to them.
# Examine nginx/proxy-*.conf to see how the links are set up. Also bear
# in mind that the individual servers (e.g. grafana) may need to be
# informed about the nature of the redirections.
#
links:
- grafana
- node-red
- influxdb
- mqtts
- apiserver
- expo
node-red:
restart: unless-stopped
build:
context: ./node-red
dockerfile: Dockerfile
args:
node_red_version: "${IOT_DASHBOARD_NODE_RED_VERSION:-latest}"
node_red_contrib_ttn_version: "${IOT_DASHBOARD_NODE_RED_CONTRIB_TTN_VERSION:-latest}"
node_red_install_modules: "${IOT_DASHBOARD_NODE_RED_INSTALL_MODULES:-}"
user: "root"
volumes:
- "${IOT_DASHBOARD_DATA}node-red:/data"
environment:
TZ: "${IOT_DASHBOARD_TIMEZONE:-GMT}"
# nodered opens ports on influxdb and postfix so it needs to be able to talk to it.
links:
- influxdb
- postfix
mqtts:
restart: unless-stopped
build:
context: ./mqtts
dockerfile: Dockerfile
environment:
ssl_cert: "${IOT_DASHBOARD_NGINX_FQDN:-.}"
ports:
# - "${IOT_DASHBOARD_PORT_MQTT_TCP:-1883}:1883" #-----> Connection on this TCP port is insecure. can be added if needed
- "${IOT_DASHBOARD_PORT_MQTT_SSL:-8883}:8883"
- "${IOT_DASHBOARD_PORT_MQTT_WSS:-8083}:8083"
volumes:
- "${IOT_DASHBOARD_DATA}docker-nginx/letsencrypt:/etc/letsencrypt"
- "${IOT_DASHBOARD_DATA}mqtt/credentials:/etc/mosquitto/credentials"
hostname: "${IOT_DASHBOARD_MQTT_HOST_NAME:-mqtts}"
influxdb:
restart: unless-stopped
build:
context: ./influxdb
dockerfile: Dockerfile
args:
distrib_id: "${IOT_DASHBOARD_OS_DISTRIB_ID:-ubuntu}"
distrib_codename: "${IOT_DASHBOARD_OS_DISTRIB_CODENAME:-focal}"
hostname: "${IOT_DASHBOARD_INFLUXDB_MAIL_HOST_NAME:-influxdb}"
relay_ip: "postfix:25"
domain: "${IOT_DASHBOARD_MAIL_DOMAIN:-example.com}"
# Backing up influxdb metadata and database to S3 Bucket
AWS_ACCESS_KEY_ID: "${IOT_DASHBOARD_AWS_ACCESS_KEY_ID:-.}"
AWS_SECRET_ACCESS_KEY: "${IOT_DASHBOARD_AWS_SECRET_ACCESS_KEY:-.}"
AWS_DEFAULT_REGION: "${IOT_DASHBOARD_AWS_DEFAULT_REGION:-.}"
AWS_HOST_BASE: "${IOT_DASHBOARD_AWS_HOST_BASE:-.}"
AWS_HOST_BUCKET: "${IOT_DASHBOARD_AWS_HOST_BUCKET:-.}"
hostname: "${IOT_DASHBOARD_INFLUXDB_MAIL_HOST_NAME:-influxdb}"
expose:
- "8086"
volumes:
- "${IOT_DASHBOARD_DATA}influxdb:/var/lib/influxdb"
environment:
INFLUXDB_INIT_PWD: "${IOT_DASHBOARD_INFLUXDB_ADMIN_PASSWORD:-!notset}"
PRE_CREATE_DB: "${IOT_DASHBOARD_INFLUXDB_INITIAL_DATABASE_NAME:-demo}"
INFLUXDB_BIND_ADDRESS: "influxdb:8088"
INFLUXDB_BACKUP_MAIL: "${IOT_DASHBOARD_INFLUXDB_BACKUP_EMAIL:-}"
SOURCE_NAME: "${IOT_DASHBOARD_CERTBOT_FQDN}"
S3_BUCKET_INFLUXDB: "${IOT_DASHBOARD_AWS_S3_BUCKET_INFLUXDB:-.}"
grafana:
restart: unless-stopped
image: grafana/grafana:${IOT_DASHBOARD_GRAFANA_VERSION:-latest}
user: "root"
volumes:
- "${IOT_DASHBOARD_DATA}grafana:/var/lib/grafana"
environment:
GF_SECURITY_ADMIN_PASSWORD: "${IOT_DASHBOARD_GRAFANA_ADMIN_PASSWORD:-!notset}"
GF_SERVER_DOMAIN: "${IOT_DASHBOARD_NGINX_FQDN}"
GF_SERVER_ROOT_URL: "https://%(domain)s/grafana/"
GF_SMTP_ENABLED: "${IOT_DASHBOARD_GRAFANA_SMTP_ENABLED:-true}"
GF_SMTP_SKIP_VERIFY: "${IOT_DASHBOARD_GRAFANA_SMTP_SKIP_VERIFY:-true}"
GF_SMTP_HOST: "postfix:25"
GF_SMTP_FROM_ADDRESS: "${IOT_DASHBOARD_GRAFANA_SMTP_FROM_ADDRESS:-grafana@localhost}"
GF_SMTP_FROM_NAME: "${IOT_DASHBOARD_GRAFANA_PROJECT_NAME:-Default} grafana admin"
GF_LOG_MODE: "${IOT_DASHBOARD_GRAFANA_LOG_MODE:-console,file}"
GF_LOG_LEVEL: "${IOT_DASHBOARD_GRAFANA_LOG_LEVEL:-info}"
GF_INSTALL_PLUGINS: "${IOT_DASHBOARD_GRAFANA_INSTALL_PLUGINS:-grafana-worldmap-panel}"
GF_USERS_ALLOW_SIGN_UP: "${IOT_DASHBOARD_GRAFANA_USERS_ALLOW_SIGN_UP:-false}"
# grafana opens ports on influxdb and postfix, so it needs to be able to talk to it.
links:
- influxdb
- postfix
postfix:
restart: unless-stopped
build:
context: ./postfix
dockerfile: Dockerfile
args:
hostname: "${IOT_DASHBOARD_MAIL_HOST_NAME:-iotmail}"
relay_ip: "${IOT_DASHBOARD_MAIL_RELAY_IP:-}"
domain: "${IOT_DASHBOARD_MAIL_DOMAIN:-example.com}"
smtp_auth: "${IOT_DASHBOARD_MAIL_SMTP_AUTH:-no}"
smtp_login: "${IOT_DASHBOARD_MAIL_SMTP_LOGIN:-}"
smtp_password: "${IOT_DASHBOARD_MAIL_SMTP_PASSWORD:-}"
# Enable SSL/TLS postfix communication
tls_security_level: "${IOT_DASHBOARD_MAIL_TLS_SECURITY_LEVEL:-may}"
tls_wrappermode: "${IOT_DASHBOARD_MAIL_TLS_WRAPPERMODE:-no}"
ports:
- "2525:25"
hostname: "${IOT_DASHBOARD_MAIL_HOST_NAME:-iotmail}"
cron-backup:
restart: unless-stopped
build:
context: ./cron-backup
dockerfile: Dockerfile
args:
hostname: "${IOT_DASHBOARD_CRONBACKUP_MAIL_HOST_NAME:-cron-backup}"
relay_ip: "postfix:25"
domain: "${IOT_DASHBOARD_MAIL_DOMAIN:-example.com}"
# Moving backup data to S3 Bucket
AWS_ACCESS_KEY_ID: "${IOT_DASHBOARD_AWS_ACCESS_KEY_ID:-.}"
AWS_SECRET_ACCESS_KEY: "${IOT_DASHBOARD_AWS_SECRET_ACCESS_KEY:-.}"
AWS_DEFAULT_REGION: "${IOT_DASHBOARD_AWS_DEFAULT_REGION:-.}"
AWS_HOST_BASE: "${IOT_DASHBOARD_AWS_HOST_BASE:-.}"
AWS_HOST_BUCKET: "${IOT_DASHBOARD_AWS_HOST_BUCKET:-.}"
hostname: "${IOT_DASHBOARD_CRONBACKUP_MAIL_HOST_NAME:-cron-backup}"
volumes:
- "${IOT_DASHBOARD_DATA}grafana:/grafana"
- "${IOT_DASHBOARD_DATA}node-red:/nodered"
- "${IOT_DASHBOARD_DATA}docker-nginx:/nginx"
- "${IOT_DASHBOARD_DATA}mqtt/credentials:/mqtts"
- "${IOT_DASHBOARD_DATA}mongodb/mongodb_data:/var/lib/mongodb"
- "${IOT_DASHBOARD_DATA}mongodb/mongodb-S3-bucket:/var/lib/mongodb-S3-bucket"
environment:
CRON_BACKUP_MAIL: "${IOT_DASHBOARD_CRON_BACKUP_EMAIL:-}"
MONGO_INITDB_ROOT_USERNAME: "${IOT_DASHBOARD_MONGO_INITDB_ROOT_USERNAME:-}"
MONGO_INITDB_ROOT_PASSWORD: "${IOT_DASHBOARD_MONGO_INITDB_ROOT_PASSWORD:-}"
SOURCE_NAME: "${IOT_DASHBOARD_CERTBOT_FQDN}"
S3_BUCKET_NODERED: "${IOT_DASHBOARD_AWS_S3_BUCKET_NODERED:-.}"
S3_BUCKET_GRAFANA: "${IOT_DASHBOARD_AWS_S3_BUCKET_GRAFANA:-.}"
S3_BUCKET_NGINX: "${IOT_DASHBOARD_AWS_S3_BUCKET_NGINX:-.}"
S3_BUCKET_MQTTS: "${IOT_DASHBOARD_AWS_S3_BUCKET_MQTTS:-.}"
S3_BUCKET_MONGODB: "${IOT_DASHBOARD_AWS_S3_BUCKET_MONGODB:-.}"
apiserver:
restart: unless-stopped
build:
context: ./apiserver
dockerfile: Dockerfile
environment:
MONGO_DNC_USERNAME: "${IOT_DASHBOARD_MONGO_DNC_USERNAME:-}"
MONGO_DNC_PASSWD: "${IOT_DASHBOARD_MONGO_DNC_PASSWD:-}"
MONGO_DNC_DBNAME: "${IOT_DASHBOARD_MONGO_DNC_DBNAME:-dncdb}"
MONGO_INITDB_ROOT_USERNAME: "${IOT_DASHBOARD_MONGO_INITDB_ROOT_USERNAME:-}"
MONGO_INITDB_ROOT_PASSWORD: "${IOT_DASHBOARD_MONGO_INITDB_ROOT_PASSWORD:-}"
#profiles: ['dnc']
expose:
- "8891" # Generic DNC server
- "8892" # DNC standard Plugin
- "8893" # DNC Granfana Influx Plugin
ports:
- "${IOT_DASHBOARD_PORT_APISERVER_SSH:-6789}:22"
hostname: "${IOT_DASHBOARD_APISERVER_HOST_NAME:-apiserver}"
volumes:
- "${IOT_DASHBOARD_DATA}apiserver/version:/vers"
mongodb:
restart: unless-stopped
image: mongo:5.0
environment:
MONGO_INITDB_ROOT_USERNAME: "${IOT_DASHBOARD_MONGO_INITDB_ROOT_USERNAME:-}"
MONGO_INITDB_ROOT_PASSWORD: "${IOT_DASHBOARD_MONGO_INITDB_ROOT_PASSWORD:-}"
#profiles: ['dnc']
expose:
- "27017"
volumes:
- "${IOT_DASHBOARD_DATA}mongodb/mongodb_data:/data/db"
- "${IOT_DASHBOARD_DATA}mongodb/mongodb_backup:/var/lib/mongodb_backup"
hostname: "${IOT_DASHBOARD_MONGODB_HOST_NAME:-mongodb}"
expo:
restart: unless-stopped
build:
context: ./expo
dockerfile: Dockerfile
#profiles: ['dnc']
expose:
- "19006"
ports:
- "${IOT_DASHBOARD_PORT_EXPO_SSH:-6791}:22"
hostname: "${IOT_DASHBOARD_EXPO_HOST_NAME:-expo}"
### end of file ###