-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathdocker-compose.yml
624 lines (592 loc) · 15.8 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
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
version: "3.0"
services:
# service container
verification_code:
build:
context: ./verification_code
image: catalyst_verification_code
env_file: docker-compose.env
container_name: verification_code
networks:
- catalyst-backend
volumes:
- verification_code_vol:/app/node_modules
- ./verification_code:/app/:delegated #delegates speeds up mac os volumes
command:
- ./wait-for-it.sh
- postgresd:5432
- --
- make
- start-service
environment:
SERVICES: verification_code
DB_NAME: verification_code
NODE_INSPECT_PORT: 9033
TRACING_ENABLED: 'true'
POSTGRES_HOST: ${POSTGRES_HOST}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PORT: ${POSTGRES_PORT}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
REDIS_HOST: ${REDIS_HOST}
REDIS_PORT: ${REDIS_PORT}
REDIS_PASSWORD: ${REDIS_PASSWORD}
KETO_ADMIN_URL: ${KETO_ADMIN_URL}
ROOT_ORG_IDENTIFIER: ${ROOT_ORG_IDENTIFIER}
KETO_RESOURCE_PREFIX: ${KETO_RESOURCE_PREFIX}
KETO_ACTION_PREFIX: ${KETO_ACTION_PREFIX}
KETO_SUBJECT_PREFIX: ${KETO_SUBJECT_PREFIX}
ports:
- "9033:9033"
links:
- nats
- redis
- jaeger
depends_on:
- nats
- redis
- postgresd
# service container
email:
build:
context: ./email
image: catalyst_email
env_file: docker-compose.env
container_name: email
networks:
- catalyst-backend
volumes:
- email_vol:/app/node_modules
- ./email:/app/:delegated #delegates speeds up mac os volumes
command:
- ./wait-for-it.sh
- postgresd:5432
- --
- make
- start-service
environment:
SERVICES: email
EMAIL_DOMAIN: ${EMAIL_DOMAIN}
EMAIL_API_KEY: ${EMAIL_API_KEY}
EMAIL_PROVIDER: ${EMAIL_PROVIDER}
NODE_INSPECT_PORT: 9031
TRACING_ENABLED: 'true'
ports:
- "9031:9031"
links:
- nats
- redis
- jaeger
depends_on:
- nats
- redis
- postgresd
# # service container
# client:
# build:
# context: ./client
# container_name: client
# image: catalyst_client
# env_file: docker-compose.env
# networks:
# - catalyst-backend
# - catalyst-frontend
# volumes:
# - ./client:/app:delegated #delegates speeds up mac os volumes
# - client_vol:/app/node_modules
# command:
# - ./wait-for-it.sh
# - postgresd:5432
# - --
# - make
# - start-service
# environment:
# - ADMIN_OAUTH2_CLIENT_ID=${ADMIN_OAUTH2_CLIENT_ID}
# - ADMIN_OAUTH2_CLIENT_SECRET=${ADMIN_OAUTH2_CLIENT_SECRET}
# - HOST_NAME=${HOST_NAME}
# - SUB_PATH=admin
# ports:
# - 9089:80
# - 19000:19000
# - 19001:19001
# - 19002:19002
# links:
# - nats
# - redis
# - hydra
# - jaeger
# depends_on:
# - nats
# - redis
# - postgresd
# - traefik
# - api
# labels:
# - "traefik.enable=true"
# - "traefik.backend=client"
# - "traefik.port=8080"
# - "traefik.frontend.rule=Host:${HOST_NAME};PathPrefix:/"
# service container
admin:
build:
context: ./admin
container_name: admin
image: catalyst_admin
env_file: docker-compose.env
networks:
- catalyst-backend
- catalyst-frontend
volumes:
- ./admin:/app:delegated #delegates speeds up mac os volumes
- admin_vol:/app/node_modules
command:
- ./wait-for-it.sh
- postgresd:5432
- --
- make
- start-service
environment:
- ADMIN_OAUTH2_CLIENT_ID=${ADMIN_OAUTH2_CLIENT_ID}
- ADMIN_OAUTH2_CLIENT_SECRET=${ADMIN_OAUTH2_CLIENT_SECRET}
- HOST_NAME=${HOST_NAME}
- SUB_PATH=admin
links:
- nats
- redis
- hydra
- jaeger
depends_on:
- nats
- redis
- postgresd
- traefik
- api
labels:
- "traefik.enable=true"
- "traefik.backend=admin"
- "traefik.port=3000"
- "traefik.frontend.rule=Host:${HOST_NAME};PathPrefix:/admin"
# service container
api:
build:
context: ./api
image: catalyst_api
container_name: api
env_file: docker-compose.env
networks:
- catalyst-backend
- catalyst-frontend
volumes:
- ./api:/app:delegated #delegates speeds up mac os volumes
- api_vol:/app/node_modules
command:
- ./wait-for-it.sh
- postgresd:5432
- --
- make
- start-service
environment:
SERVICES: api
PORT: 3000
LOGLEVEL: trace
HOST_NAME: ${HOST_NAME}
HYDRA_ADMIN_URL: http://hydra:4445
KETO_ADMIN_URL: http://keto:4466
NODE_INSPECT_PORT: 9030
REDIS_HOST: ${REDIS_HOST}
REDIS_PORT: ${REDIS_PORT}
REDIS_PASSWORD: ${REDIS_PASSWORD}
ports:
- "9030:9030"
links:
- nats
- redis
- hydra
- keto
depends_on:
- nats
- redis
- postgresd
- traefik
- hydra
- keto
- jaeger
labels:
- "traefik.enable=true"
- "traefik.backend=api"
- "traefik.port=3000"
- "traefik.frontend.rule=Host:${HOST_NAME}"
# service container
user:
build:
context: ./user
container_name: user
image: catalyst_user
env_file: docker-compose.env
networks:
- catalyst-backend
volumes:
- user_vol:/app/node_modules
- ./user:/app/:delegated #delegates speeds up mac os volumes
command:
- ./wait-for-it.sh
- postgresd:5432
- --
- make
- start-service
environment:
SERVICES: user
DB_NAME: user
NODE_INSPECT_PORT: 9032
TRACING_ENABLED: "true"
POSTGRES_HOST: ${POSTGRES_HOST}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PORT: ${POSTGRES_PORT}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
REDIS_HOST: ${REDIS_HOST}
REDIS_PORT: ${REDIS_PORT}
REDIS_PASSWORD: ${REDIS_PASSWORD}
KETO_ADMIN_URL: ${KETO_ADMIN_URL}
ROOT_ORG_IDENTIFIER: ${ROOT_ORG_IDENTIFIER}
KETO_RESOURCE_PREFIX: ${KETO_RESOURCE_PREFIX}
KETO_ACTION_PREFIX: ${KETO_ACTION_PREFIX}
KETO_SUBJECT_PREFIX: ${KETO_SUBJECT_PREFIX}
ports:
- "9032:9032"
links:
- nats
- redis
depends_on:
- nats
- redis
- postgresd
- traefik
- jaeger
# microeservices messaging hub
nats:
image: nats
container_name: nats
ports:
- "4222:4222"
networks:
- catalyst-backend
# services cache container. Services containers
# will use this for faster response rates
redis:
image: redis:alpine
container_name: redis
ports:
- "6379:6379"
environment:
- REDIS_REPLICATION_MODE=master
- REDIS_PORT_NUMBER=${REDIS_PORT}
- REDIS_PASSWORD=${REDIS_PASSWORD}
networks:
- catalyst-backend
volumes:
- redis-data:/data
# database
postgresd:
image: postgres:10
container_name: postgresd
env_file: .env
restart: always
networks:
- catalyst-backend
volumes:
- ./postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
- ./postgres/data:/var/lib/postgresql/data
ports:
- "5432:5432"
# migration container to setup postgres,
# this usually will only migrate once
# unless you delete ./postgres/data
hydra-migrate:
image: oryd/hydra:${HYDRA_VERSION}
networks:
- catalyst-backend
environment:
- DSN=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgresd:5432/${HYDRA_POSTGRES_DB}?sslmode=disable&max_conns=20&max_idle_conns=4
command: migrate sql -e --yes
depends_on:
- postgresd
restart: on-failure
# the main hydra container providing
# http(s)://hydra:4444(4445)
hydra:
image: oryd/hydra:${HYDRA_VERSION}
container_name: hydra
build:
context: ./hydra
links:
- postgresd:postgresd
depends_on:
- postgresd
- hydra-migrate
- jaeger
- traefik
networks:
- catalyst-backend
- catalyst-frontend
ports:
# public port
- "4444:4444"
# admin port
- "4445:4445"
# port for hydra token user
- "5555:5555"
# forge token port
- "9010:9010"
command: serve all --dangerous-force-http
env_file: docker-compose.env
environment:
- DSN=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgresd:5432/${HYDRA_POSTGRES_DB}?sslmode=disable&max_conns=20&max_idle_conns=4
- LOG_LEVEL=debug
- URLS_SELF_ISSUER=https://trust.${HOST_NAME}
- OAUTH2_CONSENT_URL=https://${HOST_NAME}/consent
- OAUTH2_LOGIN_URL=https://${HOST_NAME}/login
- SECRETS_SYSTEM=youReallyNeedToChangeThis
- OAUTH2_EXPOSE_INTERNAL_ERRORS=1
- OIDC_SUBJECT_IDENTIFIERS_SUPPORTED_TYPES=public,pairwise
- OIDC_SUBJECT_IDENTIFIERS_PAIRWISE_SALT=youReallyNeedToChangeThis
- TRACING_PROVIDER=jaeger
- TRACING_PROVIDER_JAEGER_SAMPLING_SERVER_URL=http://jaeger:5778/sampling
- TRACING_PROVIDER_JAEGER_LOCAL_AGENT_HOST_PORT=jaeger:6831
- TRACING_OMIT_SQL_ARGUMENTS_FROM_SPANS=false
restart: on-failure
labels:
- "traefik.enable=true"
- "traefik.hydra.backend=oauth"
- "traefik.hydra.port=4444" # callback
- "traefik.hydra.frontend.rule=Host:trust.${HOST_NAME}"
keto-migrate:
image: oryd/keto:${KETO_VERSION}
networks:
- catalyst-backend
links:
- postgresd:postgresd
environment:
- LOG_LEVEL=debug
command: migrate sql postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgresd:5432/${KETO_POSTGRES_DB}?sslmode=disable&max_conns=20&max_idle_conns=4
restart: on-failure
keto:
image: oryd/keto:${KETO_VERSION}
container_name: keto
networks:
- catalyst-backend
ports:
- "4466:4466"
command: serve
links:
- postgresd:postgresd
depends_on:
- keto-migrate
environment:
- LOG_LEVEL=debug
- PORT=4466
- DSN=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgresd:5432/${KETO_POSTGRES_DB}?sslmode=disable
restart: on-failure
configurator:
build:
context: ./configurator
dockerfile: Dockerfile
args:
- HYDRA_VERSION=$HYDRA_VERSION
- KETO_VERSION=$KETO_VERSION
- OATHKEEPER_VERSION=$OATHKEEPER_VERSION
depends_on:
- hydra
- keto
# - oathkeeper-api Omit until oauthkeeper is needed
networks:
- catalyst-backend
environment:
- HOST_NAME=${HOST_NAME}
# All of these URLs MUST NOT end with a trailing slash. This is very important!
- HYDRA_URL=http://hydra:4444
- HYDRA_ADMIN_URL=http://hydra:4445
- KETO_URL=http://keto:4466
# - RESOURCE_SERVER_URL=http://resource-server:4478 Omit until oauthkeeper is needed
# This sets the prefix for all resource, action, and subject names. Be aware that this prefix is automatically
# applied to all OAuth2 Clients as well.
- "HYDRA_SUBJECT_PREFIX=subjects:hydra:"
- "HYDRA_RESOURCE_PREFIX=resources:hydra:"
- "HYDRA_ACTION_PREFIX=actions:hydra:"
- "OATHKEEPER_RESOURCE_PREFIX=resources:oathkeeper:"
- "OATHKEEPER_ACTION_PREFIX=actions:oathkeeper:"
- "KETO_RESOURCE_PREFIX=resources:${ROOT_ORG_IDENTIFIER}:"
- "KETO_ACTION_PREFIX=actions:${ROOT_ORG_IDENTIFIER}:"
- "KETO_SUBJECT_PREFIX=subjects:${ROOT_ORG_IDENTIFIER}:"
- ADMIN_OAUTH2_CLIENT_ID=${ADMIN_OAUTH2_CLIENT_ID}
- ADMIN_OAUTH2_CLIENT_SECRET=${ADMIN_OAUTH2_CLIENT_SECRET}
- PLATFORM_OAUTH2_CLIENT_ID=${PLATFORM_OAUTH2_CLIENT_ID}
- PLATFORM_OAUTH2_CLIENT_SECRET=${PLATFORM_OAUTH2_CLIENT_SECRET}
- OATHKEEPER_HYDRA_JWK_SET_ID=jwk:oathkeeper
- OATHKEEPER_HYDRA_CLIENT_ID=clients:oathkeeper-client
- OATHKEEPER_HYDRA_CLIENT_SECRET=dummy-oathkeeper-secret
restart: on-failure
# tracing container for all tracing reporting
# includes hydra and microservices
jaeger:
networks:
- catalyst-frontend
- catalyst-backend
image: jaegertracing/all-in-one:latest
container_name: jaeger
ports:
- "5775:5775/udp"
- "6831:6831/udp"
- "6832:6832/udp"
- "5778:5778"
- "16686:16686"
- "14268:14268"
- "9411:9411"
depends_on:
- traefik
environment:
- QUERY_BASE_PATH=/jaeger
labels:
- "traefik.enable=true"
- "traefik.jaeger.frontend=jaeger"
- "traefik.jaeger.port=16686"
- 'traefik.jaeger.frontend.rule=Host:${HOST_NAME};PathPrefix:/jaeger/'
prometheus:
image: prom/prometheus:v2.1.0
container_name: prometheus
volumes:
- ./prometheus/:/etc/prometheus/
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
ports:
- 9090:9090
links:
- cadvisor:cadvisor
- alertmanager:alertmanager
- user
- verification_code
- api
- email
depends_on:
- cadvisor
networks:
- catalyst-backend
restart: always
node-exporter:
image: prom/node-exporter
container_name: node-exporter
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.sysfs=/host/sys'
- --collector.filesystem.ignored-mount-points
- "^/(sys|proc|dev|host|etc|rootfs/var/lib/docker/containers|rootfs/var/lib/docker/overlay2|rootfs/run/docker/netns|rootfs/var/lib/docker/aufs)($$|/)"
ports:
- 9100:9100
networks:
- catalyst-backend
restart: always
alertmanager:
image: prom/alertmanager
container_name: alertmanager
ports:
- 9093:9093
volumes:
- ./alertmanager/:/etc/alertmanager/
networks:
- catalyst-backend
restart: always
command:
- '--config.file=/etc/alertmanager/config.yml'
- '--storage.path=/alertmanager'
cadvisor:
image: google/cadvisor
container_name: cadvisor
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
ports:
- 8085:8080
networks:
- catalyst-backend
restart: always
grafana:
image: grafana/grafana
container_name: grafana
user: "104"
depends_on:
- prometheus
- traefik
ports:
- 3005:3000
volumes:
- grafana_data:/var/lib/grafana
- ./grafana/provisioning/:/etc/grafana/provisioning/
env_file:
- ./grafana.env
links:
- prometheus:prometheus
networks:
- catalyst-backend
- catalyst-frontend
restart: always
environment:
- GF_SERVER_ROOT_URL=%(protocol)s://%(domain)s/grafana
labels:
- "traefik.enable=true"
- "traefik.frontend.rule=Path:/grafana/"
- "traefik.port=3000"
- "traefik.frontend.rule=Host:${HOST_NAME};PathPrefixStrip:/grafana"
- 'traefik.frontend.redirect.entryPoint=https'
# router for microservices
traefik:
image: traefik:alpine
container_name: traefik
command:
- --configFile=/traefik.toml
- --web
- --logLevel=INFO
ports:
- "80:80"
- "8080:8080"
- "443:443"
networks:
- catalyst-backend
- catalyst-frontend
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./traefik/traefik.toml:/traefik.toml
- ./traefik/acme.json:/acme.json
volumes:
verification_code_vol:
driver: local
client_vol:
driver: local
email_vol:
driver: local
admin_vol:
driver: local
redis-data:
driver: local
api_vol:
driver: local
user_vol:
driver: local
prometheus_data:
driver: local
grafana_data:
driver: local
networks:
catalyst-backend:
driver: bridge
catalyst-frontend:
driver: bridge