-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
209 lines (199 loc) · 7.42 KB
/
docker-compose.yml
File metadata and controls
209 lines (199 loc) · 7.42 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
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
name: carrot-mapper-dev
x-airflow-common: &airflow-common
volumes:
- ./app/airflow/dags:/opt/airflow/dags
depends_on:
db:
condition: service_started
api:
condition: service_healthy
environment: &airflow-common-env
AIRFLOW__CORE__EXECUTOR: LocalExecutor
# Database connection here needs to be in URI format. With real values, which have special characters, they need to be encoded using the ref. in https://www.w3schools.com/tags/ref_urlencode.ASP.
AIRFLOW__DATABASE__SQL_ALCHEMY_CONN: postgresql+psycopg2://postgres:postgres@db:5432/postgres?options=-csearch_path%3Dairflow
AIRFLOW__DATABASE__SQL_ALCHEMY_SCHEMA: airflow
AIRFLOW__CORE__LOAD_EXAMPLES: "false"
AIRFLOW__WEBSERVER__EXPOSE_CONFIG: "False"
AIRFLOW__WEBSERVER__WEB_SERVER_PORT: 8080
AIRFLOW__WEBSERVER__SECRET_KEY: secret
AIRFLOW__API__AUTH_BACKEND: airflow.api.auth.backend.basic_auth
# This connection can be in separate variables (then don't need to do URL encoding), but it can reuse the same connection string with SQL_ALCHEMY_CONN (without extras)
AIRFLOW_CONN_POSTGRES_DB_CONN: postgresql+psycopg2://postgres:postgres@db:5432/postgres
# The blob storage where Airflow get/put necessary files
STORAGE_TYPE: ${STORAGE_TYPE:-minio}
# Minio connection variables (don't need to do URL encoding here)
AIRFLOW_VAR_MINIO_ENDPOINT: http://minio:9000
AIRFLOW_VAR_MINIO_ACCESS_KEY: minioadmin
AIRFLOW_VAR_MINIO_SECRET_KEY: minioadmin
# WASB connection string (don't need to do URL encoding here)
AIRFLOW_VAR_WASB_CONNECTION_STRING: DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;QueueEndpoint=http://azurite:10001/devstoreaccount1;TableEndpoint=http://azurite:10002/devstoreaccount1
services:
db:
image: postgres:14
restart: always
ports:
- 5432:5432
environment:
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
volumes:
- db_data:/var/lib/postgresql/data
omop-lite:
image: ghcr.io/health-informatics-uon/omop-lite
volumes:
- ./vocabs:/vocabs
depends_on:
- db
environment:
- DB_PASSWORD=postgres
- DB_NAME=postgres
- SCHEMA_NAME=omop
- DATA_DIR=vocabs
frontend:
image: carrot-frontend
build:
context: app/next-client-app
dockerfile: Dockerfile
target: dev
command: npm run dev
ports:
- 3000:3000
environment:
- BACKEND_URL=http://api:8000
- BACKEND_ORIGIN=localhost:8000
- NEXTAUTH_URL=http://localhost:3000/
- NEXTAUTH_SECRET=verycomplexsecretkey
- NEXTAUTH_BACKEND_URL=http://api:8000/api/
- NODE_ENV=development
- WATCHPACK_POLLING=true
- NEXT_PUBLIC_ENABLE_REUSE_TRIGGER_OPTION=true
- NEXT_PUBLIC_ENABLE_AI_RECOMMENDATION=true
- NEXT_PUBLIC_RECOMMENDATION_SERVICE=unison
- RECOMMENDATION_SERVICE_BASE_URL=https://api.hyperunison.com/api/public/suggester/generate
- RECOMMENDATION_SERVICE_API_KEY=unison-api-key
- NEXT_PUBLIC_BODY_SIZE_LIMIT=31457280
volumes:
- ./app/next-client-app:/app
- /app/node_modules
- /app/.next
depends_on:
api:
condition: service_healthy
api:
image: carrot-backend
build:
context: app
dockerfile: api/Dockerfile
ports:
- 8000:8000
environment:
- FRONTEND_URL=http://frontend:3000
- ALLOWED_HOSTS=['localhost', '127.0.0.1','api']
- DB_ENGINE=django.db.backends.postgresql
- DB_HOST=db
- DB_PORT=5432
- DB_NAME=postgres
- DB_USER=postgres
- DB_PASSWORD=postgres
- DEBUG=True
- RULES_QUEUE_NAME=rules-queue
- SECRET_KEY=secret
- STORAGE_CONN_STRING=DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;QueueEndpoint=http://azurite:10001/devstoreaccount1;TableEndpoint=http://azurite:10002/devstoreaccount1;
- SIGNING_KEY=secret
- STORAGE_TYPE=${STORAGE_TYPE:-minio}
- MINIO_ENDPOINT=minio:9000
- MINIO_ACCESS_KEY=minioadmin
- MINIO_SECRET_KEY=minioadmin
- WORKER_SERVICE_TYPE=airflow
# TODO: update to API v2 when updating Airflow to 3.0.0
- AIRFLOW_BASE_URL=http://airflow-webserver:8080/api/v1/
- AIRFLOW_AUTO_MAPPING_DAG_ID=auto_mapping
- AIRFLOW_SCAN_REPORT_PROCESSING_DAG_ID=scan_report_processing
- AIRFLOW_RULES_EXPORT_DAG_ID=rules_export
- AIRFLOW_ADMIN_USERNAME=admin
- AIRFLOW_ADMIN_PASSWORD=admin
# To match with the capacity of the production environment
- DATA_UPLOAD_MAX_MEMORY_SIZE=31457280
# Default superuser credentials for dev environment
- SUPERUSER_DEFAULT_PASSWORD=admin
- SUPERUSER_DEFAULT_EMAIL=admin@carrot.com
- SUPERUSER_DEFAULT_USERNAME=admin
volumes:
- ./app/api:/api
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
depends_on:
omop-lite:
condition: service_completed_successfully
azurite:
profiles: ["azure"]
image: mcr.microsoft.com/azure-storage/azurite
restart: always
ports:
- 10000:10000
- 10001:10001
- 10002:10002
command: azurite --blobHost azurite --queueHost azurite --tableHost azurite --location /data --debug /data/debug.log --loose --skipApiVersionCheck
hostname: azurite
environment:
- AZURITE_ACCOUNTS=devstoreaccount1:Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==
minio:
profiles: ["main"]
image: minio/minio
restart: always
command: server /data --console-address ":9001"
ports:
- "9000:9000"
- "9001:9001"
environment:
MINIO_ROOT_USER: "minioadmin"
MINIO_ROOT_PASSWORD: "minioadmin"
MINIO_BROWSER: "on"
MINIO_DOMAIN: "minio"
volumes:
- minio_data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 10s
timeout: 5s
retries: 5
airflow-webserver:
<<: *airflow-common
build:
context: app/airflow
dockerfile: Dockerfile
args:
AIRFLOW_COMPONENT: webserver
ports:
- "8080:8080"
environment:
<<: *airflow-common-env
# Admin user configuration to access the Airlfow API
# TODO: add optional admin user configuration in the docs
AIRFLOW_ADMIN_USERNAME: admin
AIRFLOW_ADMIN_PASSWORD: admin
scheduler:
<<: *airflow-common
build:
context: app/airflow
dockerfile: Dockerfile
args:
AIRFLOW_COMPONENT: scheduler
environment:
<<: *airflow-common-env
AIRFLOW__CORE__EXECUTE_TASKS_NEW_PYTHON_INTERPRETER: True
AIRFLOW_DEBUG_MODE: False
# Search recommendations feature flag - controls whether search recommendations task is included in auto_mapping DAG
SEARCH_ENABLED: False
AIRFLOW_DAGRUN_TIMEOUT: 60 # Timeout for each dagrun in minutes
TEMP_TABLE_CLEANUP_DELAY: 60 # delay between cleanup attempts on failure
AIRFLOW_VAR_JSON_VERSION: v2
EXECUTE_VALUES_PAGE_SIZE: 1000000 # page size for bulk database inserts (execute_values)
volumes:
db_data:
minio_data: