-
Notifications
You must be signed in to change notification settings - Fork 12
/
docker-compose-default.yaml
386 lines (378 loc) · 9.43 KB
/
docker-compose-default.yaml
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
---
version: "3.3"
services:
# Sensu Backend
#
# Includes embedded database, API, event processor, and web app.
#
# See: https://docs.sensu.io/sensu-go/latest/reference/backend/
sensu-backend:
image: ${WORKSHOP_DOCKER_IMAGE}:${WORKSHOP_DOCKER_TAG}
deploy:
resources:
limits:
cpus: "1.0"
memory: "2048M"
labels:
- sensu.io/workshop/role=sensu-backend
ports:
- 3000:3000
- 8080:8080
- 8081:8081
environment:
- SENSU_INTERNAL_ENVIRONMENT
- SENSU_BACKEND_CLUSTER_ADMIN_USERNAME
- SENSU_BACKEND_CLUSTER_ADMIN_PASSWORD
- SENSU_BACKEND_CLUSTER_ADMIN_API_KEY
- SENSU_WORKSHOP_ENV_SECRET
- SUMOLOGIC_HTTP_SOURCE_URL
volumes:
- type: volume
source: sensu_data
target: /var/lib/sensu
healthcheck:
test: wget -q -O- http://127.0.0.1:8080/health
interval: 10s
timeout: 5s
retries: 6
command: >-
sensu-backend start
--log-level=warn
--debug=false
# Sensu Agent
#
# Includes monitoring agent, local API, and local StatsD socket.
#
# See: https://docs.sensu.io/sensu-go/latest/reference/agent/
sensu-agent:
image: ${WORKSHOP_DOCKER_IMAGE}:${WORKSHOP_DOCKER_TAG}
deploy:
resources:
limits:
memory: 256M
labels:
- sensu.io/workshop/role=sensu-agent
ports:
- ${SENSU_API_PORT}/tcp
- ${SENSU_STATSD_METRICS_PORT}/udp
environment:
- SENSU_BACKEND_URL=ws://sensu-backend:8081
- SENSU_AGENT_PASSWORD
- SENSU_NAMESPACE
- SENSU_SUBSCRIPTIONS
- SENSU_KEEPALIVE_INTERVAL=5
- SENSU_KEEPALIVE_WARNING_THRESHOLD=10
- SENSU_KEEPALIVE_CRITICAL_THRESHOLD=20
- SENSU_API_HOST
- SENSU_API_PORT
- SENSU_STATSD_METRICS_HOST
- SENSU_STATSD_METRICS_PORT
volumes:
- type: tmpfs
target: /var/lib/sensu
healthcheck:
test: wget -q -O- http://127.0.0.1:3031/healthz
interval: 10s
timeout: 5s
retries: 6
command: >-
sensu-agent start
--log-level=warn
--deregister=true
--detect-cloud-provider
--labels="environment=training,workshop_version=${WORKSHOP_SENSU_VERSION}"
--statsd-event-handlers sumologic-metrics
--password ${SENSU_AGENT_PASSWORD}
# Postgres
#
# Sensu data store.
#
# See: https://www.postgresql.org/docs/
postgres:
image: postgres:${POSTGRES_VERSION}
deploy:
resources:
limits:
memory: 1024M
labels:
- sensu.io/workshop/role=postgres
ports:
- 5432
environment:
- POSTGRES_USER
- POSTGRES_PASSWORD
- POSTGRES_DB
- PGDATA=/var/lib/postgresql/data
- SENSU_BACKEND_CLUSTER_ADMIN_USERNAME
- SENSU_BACKEND_CLUSTER_ADMIN_PASSWORD
- APP_DB_USERNAME
- APP_DB_PASSWORD
- APP_DB_NAME
- MATTERMOST_DB
- MATTERMOST_DB_USER
- MATTERMOST_DB_PASSWORD
volumes:
- type: bind
source: ./config/postgres/postgresql.conf
target: /etc/postgresql/postgresql.conf
- type: bind
source: ./config/postgres/scripts/
target: /docker-entrypoint-initdb.d/
- type: volume
source: postgres_data
target: /var/lib/postgresql/data
healthcheck:
test: pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}
interval: 10s
timeout: 5s
retries: 6
# Sensu Asset Server
#
# Serve Sensu Assets over HTTP using NGINX.
#
# See: https://nginx.org/en/docs/
sensu-assets:
image: "nginx:${NGINX_VERSION}"
deploy:
resources:
limits:
memory: 64M
labels:
- sensu.io/workshop/role=asset-server
ports:
- 8000:80
environment: []
volumes:
- type: bind
source: ./config/nginx/nginx.conf
target: /etc/nginx/nginx.conf
- type: bind
source: ./assets
target: /usr/share/nginx/html/assets
- type: volume
source: user_data
target: /usr/share/nginx/html/users
healthcheck:
test: curl -s -I -A "Docker health check (curl)" http://127.0.0.1:80/
interval: 10s
timeout: 5s
retries: 6
# Vault
#
# Includes a Vault "devmode" server for secrets management.
#
# See: https://www.vaultproject.io/docs
vault:
image: vault:${VAULT_VERSION}
deploy:
resources:
limits:
memory: 256M
labels:
- sensu.io/workshop/role=secrets-manager
ports:
- 8200:8200
environment:
- VAULT_DEV_ROOT_TOKEN_ID
- VAULT_DEV_LISTEN_ADDRESS
volumes:
- type: volume
source: workshop_data
target: /vault/logs
consistency: consistent
- type: volume
source: workshop_data
target: /vault/file
consistency: consistent
healthcheck:
test: wget -q -O- http://127.0.0.1:8200/v1/sys/health
interval: 10s
timeout: 5s
retries: 6
command: >-
vault server -dev -log-level debug
# Mattermost
#
# Includes a Mattermost deployment for workshop alerts and workshop chat.
#
# See: https://mattermost.com
mattermost:
image: mattermost/mattermost-team-edition:${MATTERMOST_VERSION}
deploy:
resources:
limits:
memory: 512M
labels:
- sensu.io/workshop/role=chat
ports:
- ${MATTERMOST_PORT}:8065
extra_hosts:
- "dockerhost:127.0.0.1"
environment:
- MATTERMOST_DB
- MATTERMOST_DB_USER
- MATTERMOST_DB_PASSWORD
- MM_SQLSETTINGS_DRIVERNAME=postgres
- MM_SQLSETTINGS_DATASOURCE=postgres://${MATTERMOST_DB_USER}:${MATTERMOST_DB_PASSWORD}@postgres/${MATTERMOST_DB}?sslmode=disable&connect_timeout=10
- MM_TEAMSETTINGS_ENABLEOPENSERVER=false
- MM_PASSWORDSETTINGS_MINIMUMLENGTH=5
- MM_PASSWORDSETTINGS_LOWERCASE=true
- MM_PASSWORDSETTINGS_UPPERCASE=false
- MM_PASSWORDSETTINGS_NUMBER=false
- MM_PASSWORDSETTINGS_SYMBOL=false
volumes:
- type: volume
source: mattermost_config
target: /mattermost/config
consistency: consistent
- type: volume
source: mattermost_data
target: /mattermost/data
consistency: consistent
- type: bind
source: ./config/mattermost/profile.jpg
target: /mattermost/profile.jpg
consistency: consistent
- type: volume
source: mattermost_logs
target: /mattermost/logs
consistency: consistent
- type: volume
source: mattermost_plugins
target: /mattermost/plugins
consistency: consistent
- type: volume
source: mattermost_plugins_extra
target: /mattermost/client/plugins
consistency: consistent
healthcheck:
test: wget -q -O- http://127.0.0.1:8065/api/v4/system/ping
interval: 10s
timeout: 5s
retries: 6
# Demo App
#
# See: https://github.com/portertech/demo-app
app:
image: portertech/demo-app:latest
deploy:
resources:
limits:
memory: 64M
labels:
- sensu.io/workshop/role=app
ports:
- 9001-9005:8080/tcp
environment:
- DB_HOST=${APP_DB_HOST}
- DB_PORT=${APP_DB_PORT}
- DB_USER=${APP_DB_USERNAME}
- DB_PASS=${APP_DB_PASSWORD}
- DB_NAME=${APP_DB_NAME}
volumes: []
healthcheck:
test: curl -XGET -I http://127.0.0.1:8080/healthz
interval: 10s
timeout: 5s
retries: 6
command: >-
/usr/bin/demo-app
# Configurator
#
# Configuration automation for user profile generation, using
# a super light-weight "configuration management" stack:
#
# - curl
# - jq
# - envsubst (part of the gettext package)
# - sensuctl
# - docker & docker-compose
#
# See: ./scripts/
configurator:
build:
context: ./
dockerfile: Dockerfile
args:
- WORKSHOP_DOCKER_IMAGE
- WORKSHOP_DOCKER_TAG
- SENSU_CLI_VERSION
- VAULT_VERSION
- MATTERMOST_VERSION
image: workshop:${SENSU_CLI_VERSION}-${WORKSHOP_VERSION}
deploy:
resources:
limits:
memory: 64M
restart_policy:
condition: on-failure
max_attempts: ${WORKSHOP_SETUP_RETRIES}
labels:
- sensu.io/workshop/role=configurator
ports: []
environment:
- SENSU_BACKEND_CLUSTER_ADMIN_USERNAME
- SENSU_BACKEND_CLUSTER_ADMIN_PASSWORD
- SENSU_BACKEND_CLUSTER_ADMIN_API_KEY
- VAULT_ADDR
- VAULT_TOKEN
- WORKSHOP_HOSTNAME
- WORKSHOP_SENSU_VERSION
- WORKSHOP_SENSU_BUILD
- WORKSHOP_DEFAULT_TRAINEE_PASSWORD
- MATTERMOST_PORT
- MATTERMOST_DB_USER
- MATTERMOST_DB_PASSWORD
- MATTERMOST_ADMIN_USER
- MATTERMOST_ADMIN_PASSWORD
volumes:
- type: bind
source: /var/run/docker.sock
target: /var/run/docker.sock
- type: bind
source: ./.env
target: /workshop/.env
- type: bind
source: ./${COMPOSE_FILE}
target: /workshop/${COMPOSE_FILE}
- type: bind
source: ./docker
target: /workshop/docker
- type: bind
source: ./scripts
target: /usr/local/bin/scripts
- type: bind
source: ./users
target: /workshop/users
- type: bind
source: ./config
target: /workshop/config
consistency: consistent
- type: volume
source: user_data
target: /users
command: |-
init-workshop
volumes:
workshop_data:
driver: local
sensu_data:
driver: local
etcd_data:
driver: local
postgres_data:
driver: local
user_data:
driver: local
elasticsearch_data:
driver: local
mattermost_config:
driver: local
mattermost_data:
driver: local
mattermost_logs:
driver: local
mattermost_plugins:
driver: local
mattermost_plugins_extra:
driver: local