-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
315 lines (298 loc) · 9.06 KB
/
docker-compose.yml
File metadata and controls
315 lines (298 loc) · 9.06 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
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
networks:
core:
driver: bridge
djqs-network:
driver: bridge
djrs-network:
driver: bridge
services:
dj:
container_name: ${DJ_CONTAINER_PREFIX:-dj}
stdin_open: true
tty: true
networks:
- core
environment:
- DOTENV_FILE=${DOTENV_FILE:-/code/.env}
- OAUTHLIB_INSECURE_TRANSPORT=1
# Allow the slot's UI origin through CORS. The default whitelist only
# permits :3000 so slots running on other ports are blocked without this.
- CORS_ORIGIN_WHITELIST=["http://localhost:${DJ_UI_PORT:-3000}"]
build:
context: ./datajunction-server
args:
RELOAD: "--reload"
volumes:
- ./datajunction-server:/code
- /code/.venv # Isolate container venv from local
command: /bin/sh -c "uv sync --extra uvicorn --extra transpilation --no-dev && uv run opentelemetry-instrument uvicorn datajunction_server.api.main:app --host 0.0.0.0 --port 8000 --reload"
ports:
- "${DJ_PORT:-8000}:8000"
depends_on:
- db-migration
- postgres_metadata
extra_hosts:
- "host.docker.internal:host-gateway"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health/"]
interval: 30s
retries: 3
start_period: 10s
timeout: 5s
dj-seed:
image: python:3.11-slim
container_name: ${DJ_CONTAINER_PREFIX:-dj}-seed
profiles: ["demo"]
depends_on:
- dj
networks:
- core
working_dir: /dj-seed
volumes:
- ./datajunction-clients/python:/dj-seed
command: >
/bin/bash -c "
pip install -e . && python seed/init_system_nodes.py
"
postgres_metadata:
container_name: ${DJ_CONTAINER_PREFIX:-dj}-postgres
image: postgres:latest
shm_size: 1g
networks:
- core
hostname: postgres_metadata
entrypoint: >
sh -c "docker-entrypoint.sh postgres &
echo 'Waiting for Postgres...';
until pg_isready -h localhost -U dj; do sleep 1; done;
echo 'Creating readonly user...';
/docker-entrypoint-initdb.d/create-readonly-user.sh;
echo 'Creating database for DJQS...';
psql -U dj -c 'CREATE DATABASE djqs';
wait"
volumes:
- ./postgres_metadata:/var/lib/postgresql
- ./db-init/create-readonly-user.sh:/docker-entrypoint-initdb.d/create-readonly-user.sh
environment:
- POSTGRES_PASSWORD=dj
- POSTGRES_USER=dj
- POSTGRES_DB=dj
- PGUSER=dj
ports:
- "${DJ_PG_PORT:-5432}:5432"
healthcheck:
test: [ "CMD", "pg_isready" ]
interval: 10s
timeout: 5s
retries: 5
djui:
container_name: ${DJ_CONTAINER_PREFIX:-dj}-ui
image: node:20
working_dir: /usr/src/app
ports:
- "${DJ_UI_PORT:-3000}:3000"
stdin_open: true
volumes:
- ./datajunction-ui:/usr/src/app/
- ./datajunction-ui/node_modules:/usr/src/app/node_modules
environment:
- NODE_OPTIONS=--max-old-space-size=4096
- WATCHPACK_POLLING=true
- CHOKIDAR_USEPOLLING=true
# Point the UI at the slot's own DJ backend, otherwise the default baked
# into datajunction-ui/.env (http://localhost:8000) collides with other
# slots running on the same host.
- REACT_APP_DJ_URL=http://localhost:${DJ_PORT:-8000}
mem_limit: 6g
command: sh -c "yarn && yarn webpack-start --host 0.0.0.0 --port 3000"
djqs:
container_name: ${DJ_CONTAINER_PREFIX:-dj}-qs
profiles: ["demo"]
stdin_open: true
tty: true
networks:
- core
- djqs-network
build:
context: ./datajunction-query
volumes:
- ./datajunction-query:/code
- /code/.venv # Isolate container venv from local
command: /bin/bash -c "uv sync --extra uvicorn --no-dev && uv run uvicorn djqs.api.main:app --host 0.0.0.0 --port 8001 --reload"
ports:
- "${DJ_QS_PORT:-8001}:8001"
depends_on:
- djqs-db-migration
- postgres_metadata
db-migration:
container_name: ${DJ_CONTAINER_PREFIX:-dj}-db-migration
networks:
- core
build:
context: ./datajunction-server
volumes:
- ./datajunction-server:/code
- /code/.venv # Isolate container venv from local
working_dir: /code/datajunction_server
command: /bin/bash -c "uv sync --no-dev && uv run alembic -x uri="postgresql+psycopg://dj:dj@postgres_metadata:5432/dj" upgrade head"
restart: on-failure
depends_on:
postgres_metadata:
condition: service_healthy
extra_hosts:
- "host.docker.internal:host-gateway"
db-seed:
container_name: ${DJ_CONTAINER_PREFIX:-dj}-db-seed
networks:
- core
image: postgres:latest
depends_on:
db-migration:
condition: service_completed_successfully
environment:
- PGPASSWORD=dj
volumes:
- ./db-init:/db-init
command: >
/bin/bash -c "
psql -h postgres_metadata -U dj -d dj -f /db-init/create-dj-user.sql
"
djqs-db-migration:
container_name: ${DJ_CONTAINER_PREFIX:-dj}-qs-db-migration
profiles: ["demo"]
networks:
- core
- djqs-network
build:
context: ./datajunction-query
volumes:
- ./datajunction-query:/code
- /code/.venv # Isolate container venv from local
command: /bin/bash -c "uv sync --no-dev && uv run alembic -x uri="postgresql+psycopg://dj:dj@postgres_metadata:5432/djqs" upgrade head"
restart: on-failure
depends_on:
postgres_metadata:
condition: service_healthy
djrs-redis:
container_name: ${DJ_CONTAINER_PREFIX:-dj}-rs-redis
profiles: ["demo"]
image: redis:6-alpine
ports:
- "${DJ_REDIS_PORT:-6379}:6379"
networks:
- djrs-network
djrs-worker:
container_name: ${DJ_CONTAINER_PREFIX:-dj}-rs-worker
profiles: ["demo"]
build:
context: ./datajunction-reflection
command: /bin/bash -c "uv sync --no-dev && uv run celery -A datajunction_reflection.worker.app worker --loglevel INFO"
networks:
- core
- djrs-network
volumes:
- ./datajunction-reflection:/code
- /code/.venv # Isolate container venv from local
depends_on:
- djrs-redis
- dj
djrs-beat:
container_name: ${DJ_CONTAINER_PREFIX:-dj}-rs-beat
profiles: ["demo"]
build:
context: ./datajunction-reflection
command: /bin/bash -c "uv sync --no-dev && uv run celery --app datajunction_reflection.worker.app beat --loglevel INFO"
networks:
- djrs-network
depends_on:
- djrs-redis
- dj
restart: "no"
volumes:
- ./datajunction-reflection:/code
- /code/.venv # Isolate container venv from local
jupyter-notebook:
image: jupyter/scipy-notebook
container_name: ${DJ_CONTAINER_PREFIX:-dj}-jupyter
profiles: ["demo"]
networks:
- core
ports:
- "${DJ_JUPYTER_PORT:-8181}:8888"
volumes:
- ./notebooks:/home/jovyan/notebooks
- ./datajunction-clients/python:/home/jovyan/notebooks/djclient
environment:
JUPYTER_ENABLE_LAB: "yes"
depends_on:
dj:
condition: service_healthy
command: >
/bin/bash -c "
pip install --no-cache-dir -e /home/jovyan/notebooks/djclient && \
if [ ! -f /home/jovyan/notebooks/.notebook_executed ]; then \
jupyter execute '/home/jovyan/notebooks/Modeling the Roads Example Database.ipynb' && \
touch /home/jovyan/notebooks/.notebook_executed; \
fi && \
start-notebook.sh --NotebookApp.token='' --NotebookApp.password=''
"
dj-trino:
container_name: ${DJ_CONTAINER_PREFIX:-dj}-trino
profiles: ["demo"]
image: 'trinodb/trino:latest'
hostname: trino-coordinator
ports:
- '${DJ_TRINO_PORT:-8080}:8080'
networks:
- djqs-network
superset:
image: apache/superset:latest
restart: always
depends_on:
- superset-db
- superset-redis
environment:
- SUPERSET_SECRET_KEY=your_secret_key_here
- ADMIN_USERNAME=admin
- ADMIN_EMAIL=admin@datajunction.io
- ADMIN_PASSWORD=admin
ports:
- "8088:8088"
volumes:
- ./superset_home:/app/superset_home
profiles: ["superset"]
superset-db:
image: postgres:latest
restart: always
environment:
POSTGRES_DB: superset
POSTGRES_PASSWORD: superset
POSTGRES_USER: superset
volumes:
- ./postgres_superset:/var/lib/postgresql
ports:
- "5433:5432"
profiles: ["superset"]
superset-init:
image: apache/superset:latest
depends_on:
- superset-db
- superset-redis
command: >
bash -c "pip install psycopg2-binary &&
superset db upgrade &&
superset fab create-admin --username admin --firstname DataJunction --lastname Admin --email admin@datajunction.io --password admin &&
superset init"
environment:
- SUPERSET_SECRET_KEY=your_secret_key_here
- ADMIN_USERNAME=admin
- ADMIN_EMAIL=admin@datajunction.io
- ADMIN_PASSWORD=admin
volumes:
- ./superset_home:/app/superset_home
profiles: ["superset"]
superset-redis:
image: redis:7
container_name: ${DJ_CONTAINER_PREFIX:-dj}-superset-redis
restart: always
profiles: ["superset"]