forked from oss-aspen/8Knot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
169 lines (160 loc) · 4.58 KB
/
docker-compose.yml
File metadata and controls
169 lines (160 loc) · 4.58 KB
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
services:
db-init:
build:
context: .
dockerfile: ./docker/Dockerfile
command: ["python3", "./cache_manager/db_init.py"]
depends_on:
postgres-cache:
condition: service_healthy # to ensure that postgres is indeed initialized before this starts
env_file:
- .env
# 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",
"--reload", # for Production, disable the "--reload" option.
"--bind",
":8080",
"app:server",
"--workers",
"1",
"--threads",
"2",
"--timeout",
"300",
"--keep-alive",
"5"
]
# ports:
# - 8080:8080
depends_on:
- worker-callback
- worker-query
- redis-cache
- redis-users
- postgres-cache
- db-init
env_file:
- .env
environment:
- EIGHTKNOT_SEARCHBAR_OPTS_SORT=shortest # Try different options: shortest, longest, alphabetical
- EIGHTKNOT_SEARCHBAR_OPTS_MAX_RESULTS=5500 # Maximum number of results to return (org and repo)
- EIGHTKNOT_SEARCHBAR_OPTS_MAX_REPOS=5000 # Max number of repos
restart: always
worker-callback:
build:
context: .
dockerfile: ./docker/Dockerfile
command: ["celery", "-A", "app:celery_app", "worker", "--loglevel=INFO", "--concurrency=1", "--time-limit=300", "--soft-time-limit=240"]
depends_on:
- redis-cache
- redis-users
- postgres-cache
env_file:
- .env
restart: always
worker-query:
build:
context: .
dockerfile: ./docker/Dockerfile
command:
[
"celery",
"-A",
"app:celery_app",
"worker",
"--loglevel=INFO",
"-Q",
"data",
"--concurrency=1",
"--time-limit=600",
"--soft-time-limit=540"
]
depends_on:
- redis-cache
- postgres-cache
env_file:
- .env
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
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
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
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
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
# ports:
# - 5555:5555
# profiles:
# - monitoring # run w/ '--profile monitoring' flag to enable