forked from FNNDSC/ChRIS_ultron_backEnd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose_noswift.yml
executable file
·288 lines (273 loc) · 7.82 KB
/
docker-compose_noswift.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
# An alternative docker-compose_dev.yml which uses a local volume to store files
# instead of Swift Object Storage. For development purposes!
#
# To use:
# 1. Run rm docker-compose_dev.yml && ln -sv docker-compose_noswift.yml docker-compose_dev.yml
# 2. Edit chris_backend/config/settings/local.py, include the configs
#
# DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
# MEDIA_ROOT = '/data'
#
# 3. Run ./make.sh -s -i
#
# For more information: https://github.com/FNNDSC/ChRIS_ultron_backEnd/wiki/Storage-Backends
#
#version: '3.9'
services:
chrisomatic:
image: ghcr.io/fnndsc/chrisomatic:0.8.2
volumes:
- "./chrisomatic:/etc/chrisomatic:ro"
- "/var/run/docker.sock:/var/run/docker.sock:rw"
working_dir: /etc/chrisomatic
userns_mode: host
networks:
- local
depends_on:
- chris_dev
profiles:
- tools
db_migrate:
image: ${CHRISREPO}/chris:dev
build:
context: .
args:
ENVIRONMENT: local
volumes:
- ./chris_backend:/opt/app-root/src:z
- ${STOREBASE:?}:/data
environment:
- DJANGO_SETTINGS_MODULE=config.settings.local
- STORAGE_ENV
command: python manage.py migrate --noinput
user: ${UID}:${GID}
depends_on:
chris_dev_db:
condition: service_healthy
networks:
local:
chris_dev:
image: ${CHRISREPO}/chris:dev
build:
context: .
args:
ENVIRONMENT: local
stdin_open: true # docker run -i
tty: true # docker run -t
volumes:
- ./chris_backend:/opt/app-root/src:z
- ${STOREBASE:?}:/data
user: ${UID}:${GID}
environment:
- DJANGO_SETTINGS_MODULE=config.settings.local
- STORAGE_ENV
command: python manage.py runserver 0.0.0.0:8000
ports:
- "8000:8000"
depends_on:
db_migrate:
condition: service_completed_successfully
queue:
condition: service_started
chris_store:
condition: service_started
networks:
local:
aliases:
- chrisdev.local
remote: # bc special automated tests worker runs within CUBE, not needed in prod
minikube:
extra_hosts:
- "${PFCONDNS:-lhost}:${PFCONIP:-127.0.0.1}" # used only for kubernetes, not needed in prod
labels:
name: "ChRIS_ultron_backEnd"
role: "Backend development server"
org.chrisproject.role: "ChRIS_ultron_backEnd"
worker:
image: ${CHRISREPO}/chris:dev
build:
context: .
args:
ENVIRONMENT: local
volumes:
- ./chris_backend:/opt/app-root/src:z
- ${STOREBASE:?}:/data
user: ${UID}:${GID}
environment:
- DJANGO_SETTINGS_MODULE=config.settings.local
- CELERY_RDB_HOST=0.0.0.0
- CELERY_RDB_PORT=6900
- STORAGE_ENV
command: celery -A core worker -c 3 -l DEBUG -Q main1,main2
ports:
- "6900-6905:6900-6905"
depends_on:
db_migrate:
condition: service_completed_successfully
queue:
condition: service_started
# service also depends on pfcon service defined in swarm/docker-compose_remote.yml
networks:
- local
- remote
# When the remote ancillary service pfcon is deployed using kubernetes it can not
# use (connect to) an external docker overlay network: remote. In that case we
# instead use extra_hosts to let the worker know pfcon's IP address. The required
# shell variables referenced here must then be set like this: PFCONDNS=pfcon.remote,
# PFCONIP=<actual IP address of localhost> and REMOTENETWORK=false
# if you are using minikube to run the kubernetes cluster, Set the environment variable in make.sh
# MINIKUBENETWORK to true and the HOSTIP will be minikube's ip, to get this, you can run the
# command 'minikube ip' on the terminal
extra_hosts:
- "${PFCONDNS:-lhost}:${PFCONIP:-127.0.0.1}"
labels:
name: "ChRIS_ultron_backEnd Asynchronous Tasks Worker"
role: "Backend development async task worker"
worker_periodic:
image: ${CHRISREPO}/chris:dev
build:
context: .
args:
ENVIRONMENT: local
volumes:
- ./chris_backend:/opt/app-root/src:z
- ${STOREBASE:?}:/data
user: ${UID}:${GID}
environment:
- DJANGO_SETTINGS_MODULE=config.settings.local
- STORAGE_ENV
command: celery -A core worker -c 1 -l DEBUG -Q periodic
depends_on:
db_migrate:
condition: service_completed_successfully
queue:
condition: service_started
networks:
- local
labels:
name: "ChRIS_ultron_backEnd Periodic Task Worker"
role: "Backend development periodic task worker"
scheduler:
image: ${CHRISREPO}/chris:dev
build:
context: .
args:
ENVIRONMENT: local
volumes:
- ./chris_backend:/opt/app-root/src:z
- ${STOREBASE:?}:/data
user: ${UID}:${GID}
environment:
- DJANGO_SETTINGS_MODULE=config.settings.local
- STORAGE_ENV
command: celery -A core beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
depends_on:
db_migrate:
condition: service_completed_successfully
queue:
condition: service_started
# restart until Django DB migrations are ready
deploy:
restart_policy:
condition: on-failure
networks:
- local
labels:
name: "ChRIS_ultron_backEnd Periodic Tasks Scheduler"
role: "Backend development periodic tasks scheduler"
chris_dev_db:
image: postgres:16
volumes:
- chris_dev_db_data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=chris_dev
- POSTGRES_USER=chris
- POSTGRES_PASSWORD=Chris1234
networks:
- local
labels:
name: "ChRIS_ultron_backEnd PostgreSQL Database"
role: "Backend development database"
healthcheck:
test: ["CMD", "pg_isready"]
interval: 2s
timeout: 4s
retries: 3
start_period: 60s
queue:
image: rabbitmq:3
hostname: 'queue'
volumes:
- queue_data:/var/lib/rabbitmq
networks:
- local
labels:
name: "ChRIS_ultron_backEnd Asynchronous Task Queue"
role: "Backend development async task queue"
chris_store:
image: ${STOREREPO}/chris_store
environment:
- DJANGO_SETTINGS_MODULE=config.settings.production
- DJANGO_DB_MIGRATE=on
- DJANGO_ALLOWED_HOSTS=*
- DJANGO_SECRET_KEY="w1kxu^l=@pnsf!5piqz6!!5kdcdpo79y6jebbp+2244yjm*#+k"
- DJANGO_CORS_ALLOW_ALL_ORIGINS=true
- DJANGO_CORS_ALLOWED_ORIGINS=https://babymri.org
- DJANGO_SECURE_PROXY_SSL_HEADER=
- DJANGO_USE_X_FORWARDED_HOST=false
- DATABASE_HOST=chris_store_db
- DATABASE_PORT=5432
- POSTGRES_DB=chris_store
- POSTGRES_USER=chris
- POSTGRES_PASSWORD=Chris1234
ports:
- "8010:8010"
depends_on:
- chris_store_db
networks:
local:
aliases:
- chris-store.local
labels:
name: "ChRIS_store"
role: "Chris store service"
chris_store_db:
image: postgres:16
volumes:
- chris_store_db_data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=chris_store
- POSTGRES_USER=chris
- POSTGRES_PASSWORD=Chris1234
networks:
- local
labels:
name: "ChRIS_store PostgreSQL Database"
role: "Chris store database"
lldap:
image: nitnelave/lldap:stable
ports:
- "3890:3890"
- "17170:17170"
volumes:
- "lldap_data:/data"
environment:
- UID=10100
- GID=10100
- TZ=America/New_York
- LLDAP_JWT_SECRET=super_secret_random_string
- LLDAP_LDAP_USER_PASS=chris1234
- LLDAP_LDAP_BASE_DN=dc=example,dc=org
networks:
local:
networks:
local:
remote:
external: ${REMOTENETWORK:-true}
minikube:
external: ${MINIKUBENETWORK:-false}
volumes:
chris_dev_db_data:
chris_store_db_data:
queue_data:
lldap_data: