-
Notifications
You must be signed in to change notification settings - Fork 60
/
docker-compose.yml
152 lines (143 loc) · 3.88 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
services:
db-init:
build:
context: .
dockerfile: ./docker/Dockerfile
command: ["python3", "./cache_manager/db_init.py"]
depends_on:
- postgres-cache
env_file:
- ./env.list
# sometimes, postgres-cache isn't spun up before this starts.
# so it'll fail. We want this to restart when it fails, because
# postgres will be ready eventually. we don't want it to restart
# after it succeeds. give it 1000 attempts I guess.
restart: on-failure:1000
reverse-proxy:
image: nginx:latest
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- app-server
ports:
- "8080:8080" # bound to host port, exposed app endpoint
app-server:
build:
context: .
dockerfile: ./docker/Dockerfile
command:
[
"gunicorn",
"--bind",
":8080",
"app:server",
"--workers",
"1",
"--threads",
"2",
]
# ports:
# - 8080:8080
depends_on:
- worker-callback
- worker-query
- redis-cache
- redis-users
- postgres-cache
- db-init
env_file:
- ./env.list
restart: always
worker-callback:
build:
context: .
dockerfile: ./docker/Dockerfile
command: ["celery", "-A", "app:celery_app", "worker", "--loglevel=INFO", "--concurrency=1"]
depends_on:
- redis-cache
- redis-users
- postgres-cache
env_file:
- ./env.list
restart: always
worker-query:
build:
context: .
dockerfile: ./docker/Dockerfile
command:
[
"celery",
"-A",
"app:celery_app",
"worker",
"--loglevel=INFO",
"-Q",
"data",
"--concurrency=1"
]
depends_on:
- redis-cache
- postgres-cache
env_file:
- ./env.list
restart: always
# for data blob caching
redis-cache:
image: docker.io/library/redis:6
command:
- /bin/sh
- -c
# - Double dollars, so that the variable is not expanded by Docker Compose
# - Surround by quotes, so that the shell does not split the password
# - The ${variable:?message} syntax causes shell to exit with a non-zero
# code and print a message, when the variable is not set or empty
- redis-server --requirepass "$${REDIS_PASSWORD:?REDIS_PASSWORD variable is not set}"
env_file:
- ./env.list
restart: always
# for user session storage
redis-users:
image: docker.io/library/redis:6
command:
- /bin/sh
- -c
# - Double dollars, so that the variable is not expanded by Docker Compose
# - Surround by quotes, so that the shell does not split the password
# - The ${variable:?message} syntax causes shell to exit with a non-zero
# code and print a message, when the variable is not set or empty
- redis-server --requirepass "$${REDIS_PASSWORD:?REDIS_PASSWORD variable is not set}"
env_file:
- ./env.list
restart: always
postgres-cache:
image: docker.io/library/postgres:16
command: ["postgres", "-c", "config_file=/etc/postgresql/postgresql.conf"]
volumes:
- ./postgres.conf:/etc/postgresql/postgresql.conf:ro
# - postgres-cache:/var/lib/postgresql/data
# environment:
# # the password we use shouldn't matter because DB is only reachable via
# # internal network.
# - POSTGRES_PASSWORD=password123
env_file:
- ./env.list
restart: always
volumes:
postgres-cache:
# flower:
# build:
# context: .
# dockerfile: ./docker/Dockerfile
# command:
# [ "celery", "-A", "app:celery_app", "flower" ]
# depends_on:
# - worker-callback
# - worker-query
# - redis-cache
# - app-server
# env_file:
# - ./env.list
# ports:
# - 5555:5555
# profiles:
# - monitoring # run w/ '--profile monitoring' flag to enable