-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathdocker-compose.yml
276 lines (266 loc) · 8.54 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
version: '3.3'
# The CHORDS configuration (x86) for docker-compose.
#
# When run with "-p chords", it creates these containers:
# 1. chords_app: The CHORDS Ruby on Rails server
# 2. chords_mysql: A MyQSL database for CHORDS metadata.
# 3. chords_influxdb: An InfluxDB database for real-time time series data.
# 4. chords_nginx: An nginx reverse-proxy server.
# 5. chords_certbot: A letsencrypt certificate manager.
# 6. chords_grafana: A Grafana dashboard server.
# 6. chords_kapacitor: An influxdata kapacitor serve.
#
# This configuration is used to both build the the service images,
# and to deploy the CHORDS system. Dockerfiles provide the recipes
# for the chords image.
#
# To build and deploy the service images:
# cd <directory containing the CHORDS project>
# docker-compose -f docker-compose.yml -f docker-compose-build.yml build --no-cache <service>
# docker push earthcubechords/chords_<service>:<DOCKER_TAG>
#
# To deploy/start/stop CHORDS:
# curl -L https://github.com/earthcubeprojects-chords/chords/raw/<branch>/docker-compose.yml > docker-compose.yml
# docker-compose pull
# python chords_control --config
# docker-compose -p chords up -d
# docker-compose -p chords down
#
# To update a running system:
# docker-compose pull
# docker-compose -p chords down
# docker-compose -p chords up -d
#
# See bin/ssl/SSL.md for instructions on enabling SSL.
services:
# CHORDS Rails application
app:
container_name: chords_app
image: earthcubechords/chords:${DOCKER_TAG}
volumes:
- mysql-data:/var/lib/mysql
- shared-tmp:/tmp/
- rails-log:/chords/log
- /var/run/docker.sock:/var/run/docker.sock
environment:
- RAILS_ENV=${RAILS_ENV}
- CHORDS_ADMIN_PW=${CHORDS_ADMIN_PW}
- CHORDS_GUEST_PW=${CHORDS_GUEST_PW}
- GRAFANA_ADMIN_PW=${GRAFANA_ADMIN_PW}
- GRAFANA_HTTP_PORT=${GRAFANA_HTTP_PORT}
- SECRET_KEY_BASE=${SECRET_KEY_BASE}
- DB_RETENTION=${DB_RETENTION}
- DOCKER_TAG=${DOCKER_TAG}
- CHORDS_EMAIL_SERVER=${CHORDS_EMAIL_SERVER}
- CHORDS_EMAIL_PORT=${CHORDS_EMAIL_PORT}
- CHORDS_EMAIL_ADDRESS=${CHORDS_EMAIL_ADDRESS}
- CHORDS_EMAIL_PASSWORD=${CHORDS_EMAIL_PASSWORD}
- WORKERS=${WORKERS}
# Note: INFLUXDB_ variables are used by the Influxer gem, meaning that
# you should NOT create your own variables beginning with INFLUXDB_.
- INFLUXDB_USERNAME=admin
- INFLUXDB_PASSWORD=${CHORDS_ADMIN_PW}
- SSL_ENABLED=${SSL_ENABLED}
- SSL_HOST=${SSL_HOST}
- SSL_EMAIL=${SSL_EMAIL}
command: bash -c "dos2unix ./chords_start.sh && chmod a+x ./chords_start.sh && ./chords_start.sh"
logging:
driver: "json-file"
options:
max-size: "1m"
max-file: "5"
expose:
- "3042"
depends_on:
- mysql
- influxdb
# Nginx web server
nginx:
container_name: chords_nginx
image: earthcubechords/chords_nginx:${DOCKER_TAG}
volumes:
- nginx-log:/var/log/nginx
- letsencrypt-etc:/etc/letsencrypt
- letsencrypt-var-lib:/var/lib/letsencrypt
- acme-challenge:/acme-challenge
environment:
- WORKERS=${WORKERS}
- SSL_ENABLED=${SSL_ENABLED}
- SSL_HOST=${SSL_HOST}
- SSL_EMAIL=${SSL_EMAIL}
logging:
driver: "json-file"
options:
max-size: "1m"
max-file: "5"
ports:
- ${CHORDS_HTTP_PORT:-80}:80
- 443:443
depends_on:
- app
# Certbot SSL certificate handling.
certbot:
container_name: chords_certbot
image: earthcubechords/chords_certbot:${DOCKER_TAG}
volumes:
- letsencrypt-log:/var/log/letsencrypt
- letsencrypt-etc:/etc/letsencrypt
- letsencrypt-var-lib:/var/lib/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock
- acme-challenge:/acme-challenge
environment:
- SSL_ENABLED=${SSL_ENABLED}
- SSL_HOST=${SSL_HOST}
- SSL_EMAIL=${SSL_EMAIL}
depends_on:
- nginx
# Rails mysql database
mysql:
container_name: chords_mysql
image: mysql:5.7
volumes:
- mysql-data:/var/lib/mysql
- mysql-log:/var/log/mysql
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=1
- MYSQL_USER=chords_demo_user
- MYSQL_PASSWORD=${CHORDS_ADMIN_PW}
logging:
driver: "json-file"
options:
max-size: "1m"
max-file: "5"
# InfluxData influxdb time-series database
influxdb:
container_name: chords_influxdb
image: influxdb:1.8
volumes:
- influxdb-data:/var/lib/influxdb
- influxdb-log:/var/log/influxdb
- /var/run/docker.sock:/var/run/docker.sock
- shared-tmp:/tmp/
environment:
- INFLUXDB_HTTP_MAX_ROW_LIMIT=1000000
- INFLUXDB_HTTP_AUTH_ENABLED=true
- INFLUXDB_DATA_QUERY_LOG_ENABLED=false
- INFLUXDB_REPORTING_DISABLED=true
- INFLUXDB_USERNAME=admin
- INFLUXDB_PASSWORD=${CHORDS_ADMIN_PW}
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
ports:
- 8086:8086
- 8083:8083
# InfluxData kapacitor time series monitoring
kapacitor:
container_name: chords_kapacitor
image: earthcubechords/kapacitor
volumes:
- kapacitor-data:/var/lib/kapacitor
- kapacitor-log:/var/log/kapacitor
environment:
# Custom environment variable, used by earthcubechords/kapacitor
- KAPACITOR_ENABLED=${KAPACITOR_ENABLED}
#
- KAPACITOR_HOSTNAME=chords_kapacitor
- KAPACITOR_LOGGING_LEVEL=INFO
- KAPACITOR_REPORTING_ENABLED=false
#
- KAPACITOR_HTTP_AUTH_ENABLED=true
#
- KAPACITOR_INFLUXDB_0_URLS_0=http://chords_influxdb:8086
- KAPACITOR_INFLUXDB_0_USERNAME=admin
- KAPACITOR_INFLUXDB_0_PASSWORD=${CHORDS_ADMIN_PW}
#
- KAPACITOR_SMTP_ENABLED=true
- KAPACITOR_SMTP_FROM=${CHORDS_EMAIL_ADDRESS}
- KAPACITOR_SMTP_HOST=${CHORDS_EMAIL_SERVER}
- KAPACITOR_SMTP_PORT=${CHORDS_EMAIL_PORT}
- KAPACITOR_SMTP_USERNAME=${CHORDS_EMAIL_ADDRESS}
- KAPACITOR_SMTP_PASSWORD=${CHORDS_EMAIL_PASSWORD}
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
ports:
- 9092:9092
links:
- app
# Grafana graphing server. It draws data from influxdb.
grafana:
container_name: chords_grafana
image: grafana/grafana:11.3.1
# Note: GF_ variables are used by grafana, meaning that
# you should not create your own variables beginning with GF_.
environment:
- GF_DEFAULT_INSTANCE_NAME=localhost.localdomain
- GF_SERVER_HTTP_PORT=${GRAFANA_HTTP_PORT}
- GF_SERVER_DOMAIN=${GRAFANA_SERVER_DOMAIN}
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PW}
- GF_EMAILS_WELCOME_EMAIL_ON_SIGN_UP=true
- GF_SMTP_ENABLED=true
- GF_SMTP_FROM_ADDRESS=${CHORDS_EMAIL_ADDRESS}
- GF_SMTP_FROM_NAME=CHORDS Grafana
- GF_SMTP_HOST=${CHORDS_EMAIL_SERVER}:${CHORDS_EMAIL_PORT}
- GF_SMTP_USER=${CHORDS_EMAIL_ADDRESS}
- GF_SMTP_PASSWORD=${CHORDS_EMAIL_PASSWORD}
- GF_DATASOURCES_SECUREJSONDATA_PASSWORD=guest
- GF_INSTALL_PLUGINS= grafana-clock-panel,
grafana-worldmap-panel,
grafana-piechart-panel,
satellogic-3d-globe-panel,
ryantxu-ajax-panel,
neocat-cal-heatmap-panel,
petrslavotinek-carpetplot-panel,
briangann-gauge-panel,
jdbranham-diagram-panel,
mtanda-histogram-panel,
bessler-pictureit-panel,
natel-plotly-panel,
btplc-status-dot-panel,
operato-windrose-panel
volumes:
- grafana-data:/var/lib/grafana
- grafana-log:/var/log/grafana
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
ports:
- ${GRAFANA_HTTP_PORT:-3000}:${GRAFANA_HTTP_PORT:-3000}
user: "104"
links:
- influxdb
volumes:
# CHORDS Rails meta-data
mysql-data:
# CHORDS time-series data
influxdb-data:
# kapacitor data
kapacitor-data:
# Grafana configuration data
grafana-data:
# shared /tmp volume, used for influxdb backup sharing
# between app and influxdb services.
shared-tmp:
# log directories
rails-log:
nginx-log:
mysql-log:
influxdb-log:
kapacitor-log:
grafana-log:
letsencrypt-log:
# Volumes for letsencrypt configuration
# and certificates. Certbot manages these directories;
# nginx will access the certificates (in /etc/letsencrypt/live/).
# The DH params are also stored here.
letsencrypt-etc:
letsencrypt-var-lib:
acme-challenge: