-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
374 lines (358 loc) · 14.1 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
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# Copyright (c) University College London Hospitals NHS Foundation Trust
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################
# Common
x-http-proxy: &http-proxy ${HTTP_PROXY}
x-https-proxy: &https-proxy ${HTTPS_PROXY}
x-no-proxy: &no-proxy localhost,0.0.0.0,127.0.0.1,uclvlddpragae07,hasher-api,orthanc-raw,export-api,orthanc-anon
x-proxy-common: &proxy-common
HTTP_PROXY: *http-proxy
http_proxy: *http-proxy
HTTPS_PROXY: *https-proxy
https_proxy: *https-proxy
NO_PROXY: *no-proxy
no_proxy: *no-proxy
x-build-args-common: &build-args-common
<<: [*proxy-common]
x-pixl-common-env: &pixl-common-env
DEBUG: ${DEBUG}
LOG_LEVEL: ${LOG_LEVEL}
TZ: ${TZ:-Europe/London}
x-pixl-rabbit-mq: &pixl-rabbit-mq
RABBITMQ_HOST: "queue" # Name of the queue service
RABBITMQ_PORT: "5672"
RABBITMQ_USERNAME: ${RABBITMQ_USERNAME}
RABBITMQ_PASSWORD: ${RABBITMQ_PASSWORD}
x-pixl-db: &pixl-db
PIXL_DB_HOST: ${PIXL_DB_HOST}
PIXL_DB_PORT: ${PIXL_DB_PORT}
PIXL_DB_USER: ${PIXL_DB_USER}
PIXL_DB_PASSWORD: ${PIXL_DB_PASSWORD}
PIXL_DB_NAME: ${PIXL_DB_NAME}
x-azure-keyvault: &azure-keyvault
AZURE_CLIENT_ID: ${EXPORT_AZ_CLIENT_ID}
AZURE_CLIENT_SECRET: ${EXPORT_AZ_CLIENT_PASSWORD}
AZURE_TENANT_ID: ${EXPORT_AZ_TENANT_ID}
AZURE_KEY_VAULT_NAME: ${EXPORT_AZ_KEY_VAULT_NAME}
x-logs-volume: &logs-volume
type: volume
source: logs
target: /logs
volumes:
logs:
orthanc-anon-data:
orthanc-raw-data:
postgres-data:
exports:
rabbitmq:
networks:
pixl-net:
################################################################################
# Services
services:
hasher-api:
build:
context: .
dockerfile: ./docker/hasher-api/Dockerfile
args:
<<: *build-args-common
environment:
<<: [*proxy-common, *pixl-common-env]
AZURE_CLIENT_ID: ${HASHER_API_AZ_CLIENT_ID}
AZURE_CLIENT_SECRET: ${HASHER_API_AZ_CLIENT_PASSWORD}
AZURE_TENANT_ID: ${HASHER_API_AZ_TENANT_ID}
AZURE_KEY_VAULT_NAME: ${HASHER_API_AZ_KEY_VAULT_NAME}
AZURE_KEY_VAULT_SECRET_NAME: ${HASHER_API_AZ_KEY_VAULT_SECRET_NAME}
env_file:
- ./docker/common.env
ports:
- "127.0.0.1:${HASHER_API_PORT}:8000"
volumes:
- *logs-volume
networks:
- pixl-net
healthcheck:
test: ["CMD", "curl", "-f", "http://hasher-api:8000/heart-beat"]
interval: 10s
timeout: 30s
retries: 5
restart: "no"
orthanc-anon:
build:
context: .
dockerfile: ./docker/orthanc-anon/Dockerfile
args:
<<: *build-args-common
ORTHANC_CONCURRENT_JOBS: ${ORTHANC_CONCURRENT_JOBS}
platform: linux/amd64
command: /run/secrets
restart: always
environment:
<<: [*pixl-db, *proxy-common, *pixl-common-env, *azure-keyvault]
ORTHANC_NAME: "PIXL: Anon"
ORTHANC_USERNAME: ${ORTHANC_ANON_USERNAME}
ORTHANC_PASSWORD: ${ORTHANC_ANON_PASSWORD}
ORTHANC_ANON_AE_TITLE: ${ORTHANC_ANON_AE_TITLE}
ORTHANC_AUTOROUTE_ANON_TO_ENDPOINT: ${ORTHANC_AUTOROUTE_ANON_TO_ENDPOINT}
ORTHANC_RAW_AE_TITLE: ${ORTHANC_RAW_AE_TITLE}
ORTHANC_RAW_DICOM_PORT: "4242"
ORTHANC_RAW_HOSTNAME: "orthanc-raw"
ORTHANC_RAW_URL: ${ORTHANC_RAW_URL}
ORTHANC_RAW_USERNAME: ${ORTHANC_RAW_USERNAME}
ORTHANC_RAW_PASSWORD: ${ORTHANC_RAW_PASSWORD}
PIXL_DICOM_TRANSFER_TIMEOUT: ${PIXL_DICOM_TRANSFER_TIMEOUT}
PIXL_MAX_MESSAGES_IN_FLIGHT: ${PIXL_MAX_MESSAGES_IN_FLIGHT}
# For the export API
ORTHANC_ANON_URL: "http://localhost:8042"
ORTHANC_ANON_USERNAME: ${ORTHANC_ANON_USERNAME}
ORTHANC_ANON_PASSWORD: ${ORTHANC_ANON_PASSWORD}
DICOM_WEB_PLUGIN_ENABLED: ${ENABLE_DICOM_WEB}
HASHER_API_AZ_NAME: "hasher-api"
HASHER_API_PORT: 8000
AZ_DICOM_ENDPOINT_NAME: ${AZ_DICOM_ENDPOINT_NAME}
AZ_DICOM_ENDPOINT_URL: ${AZ_DICOM_ENDPOINT_URL}
AZ_DICOM_ENDPOINT_TOKEN: ${AZ_DICOM_ENDPOINT_TOKEN}
AZ_DICOM_ENDPOINT_CLIENT_ID: ${AZ_DICOM_ENDPOINT_CLIENT_ID}
AZ_DICOM_ENDPOINT_CLIENT_SECRET: ${AZ_DICOM_ENDPOINT_CLIENT_SECRET}
AZ_DICOM_ENDPOINT_TENANT_ID: ${AZ_DICOM_ENDPOINT_TENANT_ID}
AZ_DICOM_TOKEN_REFRESH_SECS: "600"
TIME_OFFSET: "${STUDY_TIME_OFFSET}"
SALT_VALUE: ${SALT_VALUE}"
PROJECT_CONFIGS_DIR: /${PROJECT_CONFIGS_DIR:-/projects/configs}
ports:
- "${ORTHANC_ANON_DICOM_PORT}:4242"
- "${ORTHANC_ANON_WEB_PORT}:8042"
volumes:
- type: volume
source: orthanc-anon-data
target: /var/lib/orthanc/db
- ${PWD}/projects/configs:/${PROJECT_CONFIGS_DIR:-/projects/configs}:ro
networks:
- pixl-net
# needed for same reason as export-api
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
postgres:
condition: service_healthy
healthcheck:
test:
[
"CMD-SHELL",
"/probes/test-aliveness.py --user=$ORTHANC_USERNAME --pwd=$ORTHANC_PASSWORD",
]
start_period: 10s
retries: 2
interval: 3s
timeout: 2s
orthanc-raw:
build:
context: .
dockerfile: ./docker/orthanc-raw/Dockerfile
args:
<<: *build-args-common
ORTHANC_RAW_MAXIMUM_STORAGE_SIZE: ${ORTHANC_RAW_MAXIMUM_STORAGE_SIZE}
ORTHANC_RAW_JOB_HISTORY_SIZE: ${ORTHANC_RAW_JOB_HISTORY_SIZE}
ORTHANC_CONCURRENT_JOBS: ${ORTHANC_CONCURRENT_JOBS}
PIXL_DICOM_TRANSFER_TIMEOUT: ${PIXL_DICOM_TRANSFER_TIMEOUT}
platform: linux/amd64
command: /run/secrets
environment:
<<: [*pixl-db, *proxy-common, *pixl-common-env]
ORTHANC_NAME: "PIXL: Raw"
ORTHANC_USERNAME: ${ORTHANC_RAW_USERNAME}
ORTHANC_PASSWORD: ${ORTHANC_RAW_PASSWORD}
ORTHANC_RAW_AE_TITLE: ${ORTHANC_RAW_AE_TITLE}
ORTHANC_RAW_RECORD_HEADERS: ${ORTHANC_RAW_RECORD_HEADERS}
ORTHANC_RAW_HEADER_LOG_PATH: ${ORTHANC_RAW_HEADER_LOG_PATH}
PRIMARY_DICOM_SOURCE_AE_TITLE: ${PRIMARY_DICOM_SOURCE_AE_TITLE}
PRIMARY_DICOM_SOURCE_PORT: ${PRIMARY_DICOM_SOURCE_PORT}
PRIMARY_DICOM_SOURCE_IP_ADDR: ${PRIMARY_DICOM_SOURCE_IP_ADDR}
SECONDARY_DICOM_SOURCE_AE_TITLE: ${SECONDARY_DICOM_SOURCE_AE_TITLE:-$PRIMARY_DICOM_SOURCE_AE_TITLE}
SECONDARY_DICOM_SOURCE_PORT: ${SECONDARY_DICOM_SOURCE_PORT:-$PRIMARY_DICOM_SOURCE_PORT}
SECONDARY_DICOM_SOURCE_IP_ADDR: ${SECONDARY_DICOM_SOURCE_IP_ADDR:-$PRIMARY_DICOM_SOURCE_IP_ADDR}
ORTHANC_ANON_AE_TITLE: ${ORTHANC_ANON_AE_TITLE}
ORTHANC_ANON_DICOM_PORT: "4242"
ORTHANC_ANON_HOSTNAME: "orthanc-anon"
PROJECT_CONFIGS_DIR: /${PROJECT_CONFIGS_DIR:-/projects/configs}
ports:
- "${ORTHANC_RAW_DICOM_PORT}:4242"
- "${ORTHANC_RAW_WEB_PORT}:8042"
volumes:
- type: volume
source: orthanc-raw-data
target: /var/lib/orthanc/db
- ${PWD}/projects/configs:/${PROJECT_CONFIGS_DIR:-/projects/configs}:ro
networks:
- pixl-net
depends_on:
postgres:
condition: service_healthy
orthanc-anon:
condition: service_started
healthcheck:
test:
[
"CMD-SHELL",
"/probes/test-aliveness.py --user=$ORTHANC_USERNAME --pwd=$ORTHANC_PASSWORD",
]
start_period: 10s
retries: 10
interval: 3s
timeout: 2s
restart: "always"
queue:
image: rabbitmq:3.13.6-management@sha256:54f115b7c9c619e59b703e326ebfc7fc762f8c7321eee34f6fc0646457fffe20
hostname: queue-host
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_USERNAME}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASSWORD}
RABBITMQ_NODENAME: "rabbit@queue-host"
TZ: ${TZ:-Europe/London}
healthcheck:
test: rabbitmq-diagnostics -q check_running
interval: 30s
timeout: 30s
retries: 3
ports:
- "127.0.0.1:${RABBITMQ_PORT}:5672"
- "${RABBITMQ_ADMIN_PORT}:15672"
networks:
- pixl-net
volumes:
- rabbitmq:/var/lib/rabbitmq/mnesia
export-api:
build:
context: .
dockerfile: ./docker/export-api/Dockerfile
args:
<<: *build-args-common
environment:
<<:
[
*pixl-db,
*proxy-common,
*pixl-common-env,
*pixl-rabbit-mq,
*azure-keyvault,
]
ORTHANC_ANON_URL: "http://orthanc-anon:8042"
ORTHANC_ANON_USERNAME: ${ORTHANC_ANON_USERNAME}
ORTHANC_ANON_PASSWORD: ${ORTHANC_ANON_PASSWORD}
PROJECT_CONFIGS_DIR: /${PROJECT_CONFIGS_DIR:-/projects/configs}
PIXL_MAX_MESSAGES_IN_FLIGHT: ${PIXL_MAX_MESSAGES_IN_FLIGHT}
HTTP_TIMEOUT: ${PIXL_DICOM_TRANSFER_TIMEOUT}
XNAT_OVERWRITE: ${XNAT_OVERWRITE}
XNAT_DESTINATION: ${XNAT_DESTINATION}
env_file:
- ./docker/common.env
depends_on:
queue:
condition: service_healthy
postgres:
condition: service_healthy
hasher-api:
condition: service_healthy
ports:
- "127.0.0.1:${PIXL_EXPORT_API_PORT}:8000"
healthcheck:
interval: 10s
timeout: 30s
retries: 5
networks:
- pixl-net
# needed for testing under GHA (linux), so this container
# can reach the test FTP server running on the docker host
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ${PWD}/projects/exports:/run/projects/exports
- ${PWD}/projects/configs:/${PROJECT_CONFIGS_DIR:-/projects/configs}:ro
imaging-api:
build:
context: .
dockerfile: ./docker/imaging-api/Dockerfile
args:
<<: *build-args-common
depends_on:
queue:
condition: service_healthy
orthanc-raw:
condition: service_healthy
orthanc-anon:
condition: service_healthy
healthcheck:
test: curl -f http://0.0.0.0:8000/heart-beat
interval: 10s
timeout: 30s
retries: 5
networks:
- pixl-net
environment:
<<: [*pixl-rabbit-mq, *proxy-common, *pixl-common-env]
ORTHANC_RAW_URL: ${ORTHANC_RAW_URL}
ORTHANC_RAW_USERNAME: ${ORTHANC_RAW_USERNAME}
ORTHANC_RAW_PASSWORD: ${ORTHANC_RAW_PASSWORD}
ORTHANC_RAW_AE_TITLE: ${ORTHANC_RAW_AE_TITLE}
ORTHANC_AUTOROUTE_RAW_TO_ANON: ${ORTHANC_AUTOROUTE_RAW_TO_ANON}
PRIMARY_DICOM_SOURCE_MODALITY: ${PRIMARY_DICOM_SOURCE_MODALITY}
PRIMARY_DICOM_SOURCE_AE_TITLE: ${PRIMARY_DICOM_SOURCE_AE_TITLE}
SECONDARY_DICOM_SOURCE_MODALITY: ${SECONDARY_DICOM_SOURCE_MODALITY}
SECONDARY_DICOM_SOURCE_AE_TITLE: ${SECONDARY_DICOM_SOURCE_AE_TITLE:-$PRIMARY_DICOM_SOURCE_AE_TITLE}
ORTHANC_ANON_URL: ${ORTHANC_ANON_URL}
ORTHANC_ANON_USERNAME: ${ORTHANC_ANON_USERNAME}
ORTHANC_ANON_PASSWORD: ${ORTHANC_ANON_PASSWORD}
ORTHANC_ANON_AE_TITLE: ${ORTHANC_ANON_AE_TITLE}
ORTHANC_AUTOROUTE_ANON_TO_ENDPOINT: ${ORTHANC_AUTOROUTE_ANON_TO_ENDPOINT}
SKIP_ALEMBIC: ${SKIP_ALEMBIC}
PIXL_DB_HOST: ${PIXL_DB_HOST}
PIXL_DB_PORT: ${PIXL_DB_PORT}
PIXL_DB_NAME: ${PIXL_DB_NAME}
PIXL_DB_USER: ${PIXL_DB_USER}
PIXL_DB_PASSWORD: ${PIXL_DB_PASSWORD}
PIXL_DICOM_TRANSFER_TIMEOUT: ${PIXL_DICOM_TRANSFER_TIMEOUT}
PIXL_QUERY_TIMEOUT: ${PIXL_QUERY_TIMEOUT}
PIXL_MAX_MESSAGES_IN_FLIGHT: ${PIXL_MAX_MESSAGES_IN_FLIGHT}
ports:
- "127.0.0.1:${PIXL_IMAGING_API_PORT}:8000"
################################################################################
# Data Stores
postgres:
build:
context: .
dockerfile: ./docker/postgres/Dockerfile
args:
<<: *build-args-common
environment:
POSTGRES_USER: ${PIXL_DB_USER}
POSTGRES_PASSWORD: ${PIXL_DB_PASSWORD}
POSTGRES_DB: ${PIXL_DB_NAME}
PGTZ: ${TZ:-Europe/London}
env_file:
- ./docker/common.env
command: postgres -c 'config_file=/etc/postgresql/postgresql.conf'
volumes:
- type: volume
source: postgres-data
target: /var/lib/postgresql/data
ports:
- "${POSTGRES_PORT}:5432"
healthcheck:
test: ["CMD", "pg_isready", "-U", "${PIXL_DB_USER}", "--dbname", "${PIXL_DB_NAME}"]
interval: 10s
timeout: 30s
retries: 5
restart: always
networks:
- pixl-net