forked from FNNDSC/ChRIS_ultron_backEnd
-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose_dev.yml
executable file
·247 lines (234 loc) · 6.83 KB
/
docker-compose_dev.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
# https://docs.docker.com/compose/yml/
# Each service defined in docker-compose.yml must specify exactly one of
# image or build. Other keys are optional, and are analogous to their
# docker run command-line counterparts.
#
# As with docker run, options specified in the Dockerfile (e.g., CMD,
# EXPOSE, VOLUME, ENV) are respected by default - you don't need to
# specify them again in docker-compose.yml.
#
# Fedora (and RHEL, CentOS) use SELinux.
# Docker needs :z volume mount options to provide a context label.
# See man docker-run
version: '3.9'
services:
chrisomatic:
image: ghcr.io/fnndsc/chrisomatic:0.3.1
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
- chris_store
profiles:
- tools
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:/home/localuser/chris_backend:z
environment:
- DJANGO_SETTINGS_MODULE=config.settings.local
- DJANGO_DB_MIGRATE=on
- DJANGO_COLLECTSTATIC=off
command: python manage.py runserver 0.0.0.0:8000
ports:
- "8000:8000"
depends_on:
- chris_dev_db
- swift_service
- queue
- chris_store
networks:
local:
aliases:
- chrisdev.local
remote: # bc special automated tests worker runs within CUBE, not needed in prod
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:/home/localuser/chris_backend:z
environment:
- DJANGO_SETTINGS_MODULE=config.settings.local
- DJANGO_DB_MIGRATE=off
- DJANGO_COLLECTSTATIC=off
- CELERY_RDB_HOST=0.0.0.0
- CELERY_RDB_PORT=6900
command: celery -A core worker -c 3 -l DEBUG -Q main1,main2
ports:
- "6900-6905:6900-6905"
depends_on:
- chris_dev_db
- swift_service
- queue
# 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
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:/home/localuser/chris_backend:z
environment:
- DJANGO_SETTINGS_MODULE=config.settings.local
- DJANGO_DB_MIGRATE=off
- DJANGO_COLLECTSTATIC=off
command: celery -A core worker -c 1 -l DEBUG -Q periodic
depends_on:
- chris_dev_db
- queue
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:/home/localuser/chris_backend:z
environment:
- DJANGO_SETTINGS_MODULE=config.settings.local
- DJANGO_DB_MIGRATE=off
- DJANGO_COLLECTSTATIC=off
command: celery -A core beat -l info --pidfile /home/localuser/celerybeat.pid --scheduler django_celery_beat.schedulers:DatabaseScheduler
depends_on:
- chris_dev_db
- queue
# 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:13
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"
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_ORIGIN_ALLOW_ALL=true
- DJANGO_CORS_ORIGIN_WHITELIST=babymri.org
- DJANGO_SECURE_PROXY_SSL_HEADER=
- DJANGO_USE_X_FORWARDED_HOST=false
- DATABASE_HOST=chris_store_db
- DATABASE_PORT=5432
- SWIFT_AUTH_URL=http://swift_service:8080/auth/v1.0
- POSTGRES_DB=chris_store
- POSTGRES_USER=chris
- POSTGRES_PASSWORD=Chris1234
- SWIFT_USERNAME=chris:chris1234
- SWIFT_KEY=testing
- SWIFT_CONTAINER_NAME=store_users
ports:
- "8010:8010"
depends_on:
- chris_store_db
- swift_service
networks:
local:
aliases:
- chris-store.local
labels:
name: "ChRIS_store"
role: "Chris store service"
chris_store_db:
image: postgres:13
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"
swift_service:
image: ${SWIFTREPO}/docker-swift-onlyone
init: true
volumes:
- swift_storage_dev:/srv
environment:
- SWIFT_USERNAME=chris:chris1234
- SWIFT_KEY=testing
ports:
- "8080:8080"
networks:
- local
labels:
name: "Swift"
role: "Swift object storage service"
networks:
local:
remote:
external: ${REMOTENETWORK:-true}
volumes:
chris_dev_db_data:
chris_store_db_data:
queue_data:
swift_storage_dev: