-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdocker-compose.yml
552 lines (530 loc) · 13.3 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
version: "3.2"
networks:
internal_network:
volumes:
minio:
dgraph:
caddy:
esdata1:
esdata2:
services:
# flower - celery dashboard
flower:
container_name: flower
build:
context: .
dockerfile: docker/flower/Dockerfile
networks:
- internal_network
volumes:
- ./scripts:/app:cached
ports:
- 5555:5555
command: [flower, --app=worker.app, --port=5555]
environment:
CELERY_BROKER_URL: amqp://guest:guest@rabbit:5672
CELERY_BACKEND_URL: redis://redis:6379
TIKA_HOST: http://tika:4219
ES_HOSTS: http://elasticsearch:9200
ES_INDEX_DOCS: docs
HOSTNAME: ${HOSTNAME}
HTTP_PORT: ${HTTP_PORT}
HTTPS_PORT: ${HTTPS_PORT}
DGRAPH_TOKEN: ${DGRAPH_TOKEN}
JWT_SECRET: ${JWT_SECRET}
SYSTEM_PWD: ${SYSTEM_PWD}
ADMIN_PWD: ${ADMIN_PWD}
# api key protection
API_KEY_SECRET: ${API_KEY_SECRET}
API_KEY: ${API_KEY}
APP_ID: ${APP_ID}
APP_SECRET: ${APP_SECRET}
API_GATEWAY_URL: "http://app:4201"
# celery worker
worker:
container_name: worker
build:
context: .
dockerfile: docker/celery/Dockerfile
networks:
- internal_network
volumes:
- ./scripts:/app:cached
command:
[celery, worker, --app=worker.app, --concurrency=3, --loglevel=INFO]
environment:
CELERY_BROKER_URL: amqp://guest:guest@rabbit:5672
CELERY_BACKEND_URL: redis://redis:6379
TIKA_HOST: http://tika:4219
ES_HOSTS: http://elasticsearch:9200
ES_INDEX_DOCS: docs
HOSTNAME: ${HOSTNAME}
HTTP_PORT: ${HTTP_PORT}
HTTPS_PORT: ${HTTPS_PORT}
DGRAPH_TOKEN: ${DGRAPH_TOKEN}
JWT_SECRET: ${JWT_SECRET}
SYSTEM_PWD: ${SYSTEM_PWD}
ADMIN_PWD: ${ADMIN_PWD}
# api key protection
API_KEY_SECRET: ${API_KEY_SECRET}
API_KEY: ${API_KEY}
APP_ID: ${APP_ID}
APP_SECRET: ${APP_SECRET}
API_GATEWAY_URL: "http://app:4201"
# listens NATS events and react on them
reactor:
container_name: reactor
build:
context: .
dockerfile: docker/reactor/Dockerfile
networks:
- internal_network
volumes:
- ./scripts:/app:cached
environment:
CELERY_BROKER_URL: amqp://guest:guest@rabbit:5672
CELERY_BACKEND_URL: redis://redis:6379
TIKA_HOST: http://tika:4219
NATS_URI: ${NATS_URI}
HOSTNAME: ${HOSTNAME}
HTTP_PORT: ${HTTP_PORT}
HTTPS_PORT: ${HTTPS_PORT}
DGRAPH_TOKEN: ${DGRAPH_TOKEN}
JWT_SECRET: ${JWT_SECRET}
SYSTEM_PWD: ${SYSTEM_PWD}
ADMIN_PWD: ${ADMIN_PWD}
# api key protection
API_KEY_SECRET: ${API_KEY_SECRET}
API_KEY: ${API_KEY}
APP_ID: ${APP_ID}
APP_SECRET: ${APP_SECRET}
API_GATEWAY_URL: "http://app:4201"
# message broker for celery
rabbit:
container_name: rabbit
image: rabbitmq
networks:
- internal_network
ports:
- 5672:5672
restart: always
logging:
driver: "json-file"
options:
max-size: ${LOG_MAX_SIZE}
max-file: ${LOG_MAX_FILE}
# cache service
redis:
container_name: redis
build:
context: ./docker/redis
networks:
- internal_network
sysctls:
- net.core.somaxconn=1024
ports:
- 6379:6379
restart: always
healthcheck:
test: "curl --fail http://localhost:6379 || exit 1"
interval: 60s
timeout: 60s
retries: 10
logging:
driver: "json-file"
options:
max-size: ${LOG_MAX_SIZE}
max-file: ${LOG_MAX_FILE}
# file parsers by apache tika
tika:
container_name: tika
build:
context: ./fparse
environment:
FS_HOST: http://app:4201
SYSTEM_PWD: ${SYSTEM_PWD}
API_KEY: ${API_KEY}
volumes:
- ./fparse:/home/gradle/src
networks:
- internal_network
ports:
- 4219:4219
restart: always
logging:
driver: "json-file"
options:
max-size: ${LOG_MAX_SIZE}
max-file: ${LOG_MAX_FILE}
# message bus
nats:
image: nats:2-alpine
container_name: nats
hostname: nats
command: nats-server --config /etc/nats-server.conf
volumes:
- ./config/nats/nats-server.conf:/etc/nats-server.conf
networks:
- internal_network
ports:
- 4222:4222
- 6222:6222
- 8222:8222
restart: always
healthcheck:
test: "curl --fail http://localhost:4222 || exit 1"
interval: 60s
timeout: 60s
retries: 10
logging:
driver: "json-file"
options:
max-size: ${LOG_MAX_SIZE}
max-file: ${LOG_MAX_FILE}
# Amazon S3 compatible file store
minio:
image: minio/minio:latest
container_name: minio
networks:
- internal_network
volumes:
- minio:/data
- ./config/minio:/etc/minio:cached
ports:
- 9000:9000
environment:
MINIO_ACCESS_KEY: ${AWS_ACCESS_KEY_ID}
MINIO_SECRET_KEY: ${AWS_SECRET_ACCESS_KEY}
command: server --config-dir /etc/minio /data
restart: always
logging:
driver: "json-file"
options:
max-size: ${LOG_MAX_SIZE}
max-file: ${LOG_MAX_FILE}
# image ops service (we need resizing at least)
imageproxy:
image: tianon/true
# image: willnorris/imageproxy
container_name: imageproxy
networks:
- internal_network
# command: "-addr 0.0.0.0:1081"
# ports:
# - 1081:1081
# restart: always
logging:
driver: "json-file"
options:
max-size: ${LOG_MAX_SIZE}
max-file: ${LOG_MAX_FILE}
# dgraph cluster manager
zero:
image: dgraph/dgraph:v20.03.0-beta.20200320
container_name: zero
networks:
- internal_network
volumes:
- dgraph:/dgraph
ports:
- 5080:5080
- 6080:6080
command: dgraph zero --my=zero:5080 --telemetry=false -v=0
restart: always
healthcheck:
test: "curl --fail --max-time 10 http://localhost:6080/health"
interval: 60s
timeout: 60s
retries: 10
logging:
driver: "json-file"
options:
max-size: ${LOG_MAX_SIZE}
max-file: ${LOG_MAX_FILE}
# dgraph node (GraphQL native database)
dgraph:
image: dgraph/dgraph:v20.03.0-beta.20200320
container_name: dgraph
networks:
- internal_network
volumes:
- dgraph:/dgraph
ports:
- 8080:8080
- 9080:9080
command: dgraph alpha --my=dgraph:7080 --zero=zero:5080 --lru_mb=2048 --whitelist=${DGRAPH_WHITELIST} --telemetry=false -v=0
restart: always
healthcheck:
test: "curl --fail --max-time 10 http://localhost:8080/health"
interval: 60s
timeout: 60s
retries: 10
logging:
driver: "json-file"
options:
max-size: ${LOG_MAX_SIZE}
max-file: ${LOG_MAX_FILE}
# dgraph UI
ratel:
image: dgraph/dgraph:v20.03.0-beta.20200320
container_name: ratel
networks:
- internal_network
ports:
- 8000:8000
command: dgraph-ratel
restart: on-failure
logging:
driver: "json-file"
options:
max-size: ${LOG_MAX_SIZE}
max-file: ${LOG_MAX_FILE}
# elasticsearch node1
# see also https://github.com/deviantony/docker-elk
# todo elasticsearch production config
elasticsearch:
image: tianon/true
# build:
# context: ./
# dockerfile: ./docker/elasticsearch/Dockerfile
container_name: elasticsearch
networks:
- internal_network
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata1:/usr/share/elasticsearch/data
# ports:
# - 9200:9200
# restart: always
# healthcheck:
# test: "curl --fail http://localhost:9200 || exit 1"
# interval: 60s
# timeout: 60s
# retries: 10
logging:
driver: "json-file"
options:
max-size: ${LOG_MAX_SIZE}
max-file: ${LOG_MAX_FILE}
# elasticsearch node2
elasticsearch2:
image: tianon/true
# build:
# context: ./
# dockerfile: ./docker/elasticsearch/Dockerfile
container_name: elasticsearch2
networks:
- internal_network
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata2:/usr/share/elasticsearch/data
# restart: always
# healthcheck:
# test: "curl --fail http://localhost:9300 || exit 1"
# interval: 60s
# timeout: 60s
# retries: 10
logging:
driver: "json-file"
options:
max-size: ${LOG_MAX_SIZE}
max-file: ${LOG_MAX_FILE}
# lightweight UI for elasticsearch
eshead:
container_name: eshead
image: tianon/true
# image: mobz/elasticsearch-head:5-alpine
# restart: always
networks:
- internal_network
logging:
driver: "json-file"
options:
max-size: ${LOG_MAX_SIZE}
max-file: ${LOG_MAX_FILE}
# kibana - elasticsearch dashboard
kibana:
image: tianon/true
# image: docker.elastic.co/kibana/kibana:7.6.1
container_name: kibana
environment:
XPACK_MONITORING_ENABLED: "false"
ELASTICSEARCH_HOSTS: http://elasticsearch:9200
networks:
- internal_network
volumes:
- ./config/kibana/:/usr/share/kibana/config:cached
# ports:
# - 5601:5601
# restart: always
logging:
driver: "json-file"
options:
max-size: ${LOG_MAX_SIZE}
max-file: ${LOG_MAX_FILE}
# pyadmin API service
pyadmin:
depends_on:
- app
build:
context: ./
dockerfile: ./docker/pyadmin/Dockerfile
container_name: pyadmin
environment:
HOSTNAME: ${HOSTNAME}
HTTP_PORT: ${HTTP_PORT}
HTTPS_PORT: ${HTTPS_PORT}
DGRAPH_TOKEN: ${DGRAPH_TOKEN}
JWT_SECRET: ${JWT_SECRET}
SYSTEM_PWD: ${SYSTEM_PWD}
ADMIN_PWD: ${ADMIN_PWD}
# api key protection
API_KEY_SECRET: ${API_KEY_SECRET}
API_KEY: ${API_KEY}
APP_ID: ${APP_ID}
APP_SECRET: ${APP_SECRET}
API_GATEWAY_URL: "http://app:4201"
FLASK_ENV: development
FLASK_PORT: 4211
volumes:
- ./scripts:/pyadmin:cached
- ./schema.txt:/schema.txt:cached
- ./docker/pyadmin/main.sh:/main.sh:cached
networks:
- internal_network
ports:
- 4211:4211
restart: always
logging:
driver: "json-file"
options:
max-size: ${LOG_MAX_SIZE}
max-file: ${LOG_MAX_FILE}
# application API service
app:
depends_on:
- dgraph
- minio
- nats
build:
context: ./
dockerfile: ./docker/app/Dockerfile
container_name: app
environment:
PORT: 4201
HOSTNAME: ${HOSTNAME}
HTTP_PORT: ${HTTP_PORT}
HTTPS_PORT: ${HTTPS_PORT}
DGRAPH_TOKEN: ${DGRAPH_TOKEN}
DGRAPH_RPC_URL: dgraph:9080
DGRAPH_HTTP_URL: http://dgraph:8080
ES_HOSTS: http://elasticsearch:9200
NATS_URI: nats://nats:4222
JWT_SECRET: ${JWT_SECRET}
SYSTEM_EMAIL: ${SYSTEM_EMAIL}
SYSTEM_PWD: ${SYSTEM_PWD}
ADMIN_EMAIL: ${ADMIN_EMAIL}
ADMIN_PWD: ${ADMIN_PWD}
# api key protection
API_KEY_SECRET: ${API_KEY_SECRET}
APP_ID: ${APP_ID}
APP_SECRET: ${APP_SECRET}
# aws services
AWS_S3_ENDPOINT: ${AWS_S3_ENDPOINT}
AWS_S3_BUCKET: ${AWS_S3_BUCKET}
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_REGION: ${AWS_REGION}
# oauth config
FACEBOOK_KEY: ${FACEBOOK_KEY}
FACEBOOK_SECRET: ${FACEBOOK_SECRET}
VK_KEY: ${VK_KEY}
VK_SECRET: ${VK_SECRET}
GOOGLE_KEY: ${GOOGLE_KEY}
GOOGLE_SECRET: ${GOOGLE_SECRET}
volumes:
- .:/pandora:cached
- ./docker/app/main.sh:/main.sh:cached
networks:
- internal_network
ports:
- 4201:4201
restart: always
logging:
driver: "json-file"
options:
max-size: ${LOG_MAX_SIZE}
max-file: ${LOG_MAX_FILE}
# event streaming service
pubsub:
depends_on:
- nats
build:
context: ./
dockerfile: ./docker/pubsub/Dockerfile
container_name: pubsub
environment:
NATS_URI: ${NATS_URI}
networks:
- internal_network
ports:
- 4302:4302
restart: always
logging:
driver: "json-file"
options:
max-size: ${LOG_MAX_SIZE}
max-file: ${LOG_MAX_FILE}
# web server - service gateway
caddy:
build:
context: ./
dockerfile: ./docker/caddy/Dockerfile
container_name: caddy
environment:
CADDY_URLS: ${CADDY_URLS}
HOSTNAME: ${HOSTNAME}
HTTP_PORT: ${HTTP_PORT}
HTTPS_PORT: ${HTTPS_PORT}
DGRAPH_URL: http://dgraph:8080
JWT_SECRET: ${JWT_SECRET}
DGRAPH_TOKEN: ${DGRAPH_TOKEN}
ADMIN_SECRET: ${ADMIN_SECRET}
SYSTEM_PWD: ${SYSTEM_PWD}
ADMIN_PWD: ${ADMIN_PWD}
API_KEY: ${API_KEY}
CADDYPATH: /data/caddy
volumes:
- caddy:/data/caddy
- ./config/caddy/Caddyfile:/etc/Caddyfile:cached
networks:
- internal_network
ports:
- ${HTTP_PORT}:${HTTP_PORT}
- ${HTTPS_PORT}:${HTTPS_PORT}
restart: always
logging:
driver: "json-file"
options:
max-size: ${LOG_MAX_SIZE}
max-file: ${LOG_MAX_FILE}
# monitor
autoheal:
image: willfarrell/autoheal
container_name: autoheal
restart: on-failure
networks:
- internal_network
volumes:
- /var/run/docker.sock:/var/run/docker.sock
logging:
driver: "json-file"
options:
max-size: ${LOG_MAX_SIZE}
max-file: ${LOG_MAX_FILE}