-
Notifications
You must be signed in to change notification settings - Fork 34
/
compose.yaml
277 lines (255 loc) · 7.69 KB
/
compose.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
services:
###################################################################
# Dependencies
###################################################################
nginx:
image: nginx:1.25.4
container_name: nginx
depends_on:
- gunicorn
env_file:
- ./.env
ports:
- ${PORT}:${PORT}
networks:
- private
- public
volumes:
- ./compose/nginx.conf.template:/etc/nginx/templates/default.conf.template
- ${DATA_DIR}/media:/media
minio:
image: minio/minio:RELEASE.2020-12-03T05-49-24Z
container_name: minio
entrypoint: ["/bin/sh", "-ce", "/usr/bin/docker-entrypoint.sh minio server /data"]
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 5s
timeout: 5s
retries: 5
env_file:
- ./.env
networks:
- private
volumes:
- ${DATA_DIR}/objects:/data
redis:
image: redis:7
container_name: redis
restart: always
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 1s
timeout: 3s
retries: 30
networks:
- private
entrypoint: redis-server --maxmemory 2048mb --maxmemory-policy allkeys-lru
postgis:
image: ${REGISTRY}/tator_postgis:${GIT_VERSION}
container_name: postgis
healthcheck:
test: ["CMD", "pg_isready"]
interval: 5s
timeout: 5s
retries: 5
env_file:
- ./.env
environment:
- PGDATA=/var/lib/postgresql/data/db-files
- POSTGRES_DB=tator_online
networks:
- private
volumes:
- ${DATA_DIR}/postgis:/var/lib/postgresql/data
- ${DATA_DIR}/backup:/backup
shm_size: '2gb'
###################################################################
# Tator services
###################################################################
gunicorn:
image: ${REGISTRY}/tator_online:${GIT_VERSION}
container_name: gunicorn
entrypoint: gunicorn --workers 3 --worker-connections 100 --worker-class=gthread --threads=10 --timeout 600 --reload -b :80 tator_online.wsgi
depends_on:
- postgis
- redis
- minio
restart: always
environment:
- "DEFAULT_LIVE_CONFIG={\"aws_access_key_id\": \"${DEFAULT_LIVE_ACCESS_KEY}\", \"aws_secret_access_key\": \"${DEFAULT_LIVE_SECRET_KEY}\", \"endpoint_url\": \"${DEFAULT_LIVE_ENDPOINT_URL}\", \"region_name\": \"${DEFAULT_LIVE_REGION_NAME}\"}"
env_file:
- ./.env
networks:
- private
volumes:
- ${DATA_DIR}/static:/static
- ${DATA_DIR}/migrations:/tator_online/main/migrations
- ${DATA_DIR}/media:/media
- ${DATA_DIR}/backup:/backup
extra_hosts:
- localhost:${MASQUERADE_LOCALHOST_IP:-127.0.0.1}
transcode:
image: ${REGISTRY}/tator_transcode:${GIT_VERSION}
container_name: transcode
entrypoint: uvicorn main:app --host 0.0.0.0 --port 80 --reload
env_file:
- ./.env
depends_on:
- redis
restart: always
networks:
- private
transcode-worker:
image: ${REGISTRY}/tator_client:${GIT_VERSION}
container_name: transcode-worker
entrypoint: rq worker --url redis://redis transcodes
env_file:
- ./.env
depends_on:
- redis
restart: always
networks:
- private
extra_hosts:
- localhost:${MASQUERADE_LOCALHOST_IP:-127.0.0.1}
ui:
image: ${REGISTRY}/tator_ui:${GIT_VERSION}
container_name: ui
entrypoint: npm run serve -- --backend='' --host=0.0.0.0 --max_age=${STATIC_MAX_AGE} --static_path=/static/${GIT_VERSION}
restart: always
networks:
- private
db-worker:
image: ${REGISTRY}/tator_online:${GIT_VERSION}
container_name: db-worker
entrypoint: python3 /tator_online/main/worker.py db_jobs
depends_on:
- redis
restart: always
env_file:
- ./.env
networks:
- private
image-worker:
image: ${REGISTRY}/tator_online:${GIT_VERSION}
container_name: image-worker
entrypoint: python3 /tator_online/main/worker.py image_jobs
depends_on:
- redis
restart: always
environment:
- "DEFAULT_LIVE_CONFIG={\"aws_access_key_id\": \"${DEFAULT_LIVE_ACCESS_KEY}\", \"aws_secret_access_key\": \"${DEFAULT_LIVE_SECRET_KEY}\", \"endpoint_url\": \"${DEFAULT_LIVE_ENDPOINT_URL}\", \"region_name\": \"${DEFAULT_LIVE_REGION_NAME}\"}"
env_file:
- ./.env
networks:
- private
###################################################################
# Pre-install configuration
###################################################################
create-bucket:
image: minio/mc:RELEASE.2022-07-15T09-20-55Z
container_name: create-bucket
depends_on:
- minio
env_file:
- ./.env
networks:
- private
entrypoint: >
/bin/sh -c "
mc alias set tator http://minio:9000 ${MINIO_ACCESS_KEY} ${MINIO_SECRET_KEY};
mc mb --ignore-existing tator/${DEFAULT_LIVE_BUCKET_NAME};
mc admin user add tator ${DEFAULT_LIVE_ACCESS_KEY} ${DEFAULT_LIVE_SECRET_KEY};
mc admin policy list tator;
mc admin policy set tator readwrite user=${DEFAULT_LIVE_ACCESS_KEY};
exit 0;
"
create-extensions:
image: ${REGISTRY}/tator_postgis:${GIT_VERSION}
container_name: create-extensions
depends_on:
- postgis
env_file:
- ./.env
environment:
- PGPASSWORD=${POSTGRES_PASSWORD}
networks:
- private
entrypoint: >
/bin/sh -c "
psql -U ${POSTGRES_USER} -h postgis -d tator_online -c 'CREATE EXTENSION IF NOT EXISTS ltree';
psql -U ${POSTGRES_USER} -h postgis -d tator_online -c 'CREATE EXTENSION IF NOT EXISTS postgis';
psql -U ${POSTGRES_USER} -h postgis -d tator_online -c 'CREATE EXTENSION IF NOT EXISTS vector';
psql -U ${POSTGRES_USER} -h postgis -d tator_online -c 'CREATE EXTENSION IF NOT EXISTS pg_trgm';
exit 0;
"
migrate:
image: ${REGISTRY}/tator_online:${GIT_VERSION}
container_name: migrate
depends_on:
- gunicorn
env_file:
- ./.env
networks:
- private
volumes:
- ${DATA_DIR}/migrations:/tator_online/main/migrations
entrypoint: >
/bin/sh -c "
python3 manage.py makemigrations main;
python3 manage.py makemigrations;
python3 manage.py migrate;
exit 0;
"
###################################################################
# Cron jobs
###################################################################
gunicorn-cron:
image: ${REGISTRY}/tator_online:${GIT_VERSION}
container_name: gunicorn-cron
depends_on:
- gunicorn
restart: always
env_file:
- ./.env
environment:
- "DEFAULT_LIVE_CONFIG={\"aws_access_key_id\": \"${DEFAULT_LIVE_ACCESS_KEY}\", \"aws_secret_access_key\": \"${DEFAULT_LIVE_SECRET_KEY}\", \"endpoint_url\": \"${DEFAULT_LIVE_ENDPOINT_URL}\", \"region_name\": \"${DEFAULT_LIVE_REGION_NAME}\"}"
networks:
- private
volumes:
- ./compose/gunicorn.cron:/etc/cron.d/crontab
- ${DATA_DIR}/static:/static
- ${DATA_DIR}/migrations:/tator_online/main/migrations
- ${DATA_DIR}/media:/media
- ${DATA_DIR}/backup:/backup
entrypoint: >
/bin/sh -c "
env >> /etc/environment;
crontab /etc/cron.d/crontab;
cron -f;
"
postgis-cron:
image: ${REGISTRY}/tator_postgis:${GIT_VERSION}
container_name: postgis-cron
depends_on:
- postgis
restart: always
env_file:
- ./.env
environment:
- PGPASSWORD=${POSTGRES_PASSWORD}
networks:
- private
volumes:
- ./compose/postgis.cron:/etc/cron.d/crontab
entrypoint: >
/bin/sh -c "
env >> /etc/environment;
crontab /etc/cron.d/crontab;
cron -f;
"
networks:
public:
external: true
private:
external: false