-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Expand file tree
/
Copy pathdocker-compose.ghcr.yml
More file actions
636 lines (616 loc) · 23 KB
/
Copy pathdocker-compose.ghcr.yml
File metadata and controls
636 lines (616 loc) · 23 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
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
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
# QuantDinger Docker Compose - GHCR prebuilt images (zero-repo deploy)
#
# Pulls backend, frontend, and mobile H5 images from GitHub Container Registry. The
# repository does NOT need to be cloned - only this file plus the unified
# project-root .env is required.
#
# Minimal install (Linux / macOS):
#
# curl -O https://raw.githubusercontent.com/OpenByteInc/QuantDinger/main/docker-compose.ghcr.yml
# curl -O https://raw.githubusercontent.com/OpenByteInc/QuantDinger/main/.env.example
# cp .env.example .env
# # Edit .env and set ADMIN_USER / ADMIN_PASSWORD before first start.
# docker compose -f docker-compose.ghcr.yml up -d
# # open http://localhost:8888 (web) or http://localhost:8889 (mobile H5)
#
# One-file configuration:
# - .env contains backend runtime settings and Docker Compose orchestration knobs.
# - The env-sync service imports missing legacy values before startup.
#
# Database schema is bootstrapped automatically: the backend re-applies
# `migrations/init.sql` idempotently on every start, so no host-side SQL
# mount is needed (unlike docker-compose.yml).
#
# Orchestration override knobs (project-root .env, all optional):
# IMAGE_TAG - unified tag for backend AND frontend (optional; see per-side defaults below)
# BACKEND_TAG - per-side override: pins backend only (default: $IMAGE_TAG)
# FRONTEND_TAG - per-side override: pins frontend only (default: $IMAGE_TAG)
# BACKEND_IMAGE - backend image path (default: ghcr.io/openbyteinc/quantdinger-backend)
# FRONTEND_IMAGE - frontend image path (default: ghcr.io/openbyteinc/quantdinger-frontend)
# MOBILE_IMAGE - mobile H5 image path (default: ghcr.io/openbyteinc/quantdinger-mobile)
# IMAGE_PREFIX - postgres/redis registry prefix (e.g. docker.m.daocloud.io/library/)
# TRADING_DB_POOL_MAX - trading-worker pool limit (default: 32)
# PG_MAX_CONNECTIONS - PostgreSQL server limit (default: 150)
#
# Normal use: set IMAGE_TAG once and both services move in lockstep.
# Per-side overrides only kick in when BACKEND_TAG / FRONTEND_TAG are
# explicitly set - useful for testing a frontend hotfix against a
# stable backend, or vice versa.
x-backend-runtime: &backend-runtime
init: true
security_opt:
- no-new-privileges:true
pids_limit: ${BACKEND_PIDS_LIMIT:-512}
stop_grace_period: ${BACKEND_STOP_GRACE_PERIOD:-45s}
logging:
driver: json-file
options:
max-size: ${CONTAINER_LOG_MAX_SIZE:-20m}
max-file: ${CONTAINER_LOG_MAX_FILES:-5}
services:
env-sync:
image: ${BACKEND_IMAGE:-ghcr.io/openbyteinc/quantdinger-backend}:${BACKEND_TAG:-${IMAGE_TAG:-latest}}
pull_policy: always
container_name: quantdinger-env-sync
restart: "no"
entrypoint: ["python", "-m", "app.commands.sync_env", "--workspace", "/workspace"]
volumes:
- ./:/workspace
networks:
- quantdinger-network
postgres:
image: ${POSTGRES_IMAGE:-${IMAGE_PREFIX:-}postgres:18.3-alpine}
container_name: quantdinger-db
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-quantdinger}
POSTGRES_USER: ${POSTGRES_USER:-quantdinger}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-quantdinger123}
PGDATA: ${POSTGRES_PGDATA:-/var/lib/postgresql/18/docker}
TZ: ${TZ:-Asia/Shanghai}
command:
- "postgres"
- "-c"
- "max_connections=${PG_MAX_CONNECTIONS:-150}"
- "-c"
- "shared_buffers=${PG_SHARED_BUFFERS:-256MB}"
volumes:
- ${POSTGRES_DATA_SOURCE:-postgres_data}:${POSTGRES_PGDATA:-/var/lib/postgresql/18/docker}
ports:
- "${DB_PORT:-127.0.0.1:5432}:5432"
networks:
- quantdinger-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-quantdinger} -d ${POSTGRES_DB:-quantdinger}"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: ${REDIS_IMAGE:-${IMAGE_PREFIX:-}redis:8-alpine}
container_name: quantdinger-redis
restart: unless-stopped
environment:
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
command:
- sh
- -ec
- |
if [ -n "$$REDIS_PASSWORD" ]; then set -- --requirepass "$$REDIS_PASSWORD"; fi
exec redis-server --maxmemory "${REDIS_CACHE_MAXMEMORY:-128mb}" --maxmemory-policy allkeys-lru "$$@"
ports:
- "${REDIS_BIND:-127.0.0.1:6379}:6379"
networks:
- quantdinger-network
healthcheck:
test: ["CMD-SHELL", "if [ -n \"$$REDIS_PASSWORD\" ]; then redis-cli --no-auth-warning -a \"$$REDIS_PASSWORD\" ping; else redis-cli ping; fi"]
interval: 10s
timeout: 5s
retries: 5
redis-jobs:
image: ${REDIS_IMAGE:-${IMAGE_PREFIX:-}redis:8-alpine}
container_name: quantdinger-redis-jobs
restart: unless-stopped
environment:
REDIS_PASSWORD: ${CELERY_REDIS_PASSWORD:-}
command:
- sh
- -ec
- |
if [ -n "$$REDIS_PASSWORD" ]; then set -- --requirepass "$$REDIS_PASSWORD"; fi
exec redis-server --appendonly yes --appendfsync everysec --save 60 1000 --maxmemory "${REDIS_JOBS_MAXMEMORY:-512mb}" --maxmemory-policy noeviction "$$@"
volumes:
- celery_redis_data:/data
networks:
- quantdinger-network
healthcheck:
test: ["CMD-SHELL", "if [ -n \"$$REDIS_PASSWORD\" ]; then redis-cli --no-auth-warning -a \"$$REDIS_PASSWORD\" ping; else redis-cli ping; fi"]
interval: 10s
timeout: 5s
retries: 5
kafka:
image: ${KAFKA_IMAGE:-apache/kafka:4.3.1}
container_name: quantdinger-kafka
restart: unless-stopped
environment:
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: broker,controller
KAFKA_LISTENERS: CONTROLLER://:9093,PLAINTEXT://:9092,PLAINTEXT_HOST://:29092
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:9093
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
KAFKA_LOG_DIRS: /var/lib/kafka/data
CLUSTER_ID: MkU3OEVBNTcwNTJENDM2Qk
volumes:
- kafka_data:/var/lib/kafka/data
ports:
- "${KAFKA_PORT:-127.0.0.1:29092}:29092"
networks:
- quantdinger-network
healthcheck:
test: ["CMD-SHELL", "/opt/kafka/bin/kafka-broker-api-versions.sh --bootstrap-server localhost:9092 >/dev/null 2>&1"]
interval: 10s
timeout: 10s
retries: 12
start_period: 20s
kafka-init:
<<: *backend-runtime
image: ${BACKEND_IMAGE:-ghcr.io/openbyteinc/quantdinger-backend}:${BACKEND_TAG:-${IMAGE_TAG:-latest}}
pull_policy: always
container_name: quantdinger-kafka-init
restart: "no"
command: ["python", "-m", "app.commands.kafka_topics"]
depends_on:
env-sync:
condition: service_completed_successfully
kafka:
condition: service_healthy
volumes:
- ./.env:/app/.env
environment:
- KAFKA_BOOTSTRAP_SERVERS=kafka:9092
- KAFKA_REPLICATION_FACTOR=${KAFKA_REPLICATION_FACTOR:-1}
- KAFKA_MARKET_PARTITIONS=${KAFKA_MARKET_PARTITIONS:-48}
- KAFKA_STRATEGY_PARTITIONS=${KAFKA_STRATEGY_PARTITIONS:-128}
- KAFKA_ORDER_PARTITIONS=${KAFKA_ORDER_PARTITIONS:-96}
- KAFKA_DLQ_PARTITIONS=${KAFKA_DLQ_PARTITIONS:-24}
networks:
- quantdinger-network
migration:
<<: *backend-runtime
image: ${BACKEND_IMAGE:-ghcr.io/openbyteinc/quantdinger-backend}:${BACKEND_TAG:-${IMAGE_TAG:-latest}}
pull_policy: always
container_name: quantdinger-migration
restart: "no"
command: ["python", "-m", "app.commands.migrate"]
depends_on:
postgres:
condition: service_healthy
volumes:
- backend_logs:/app/logs
- backend_data:/app/data
- ./.env:/app/.env
environment:
- DATABASE_URL=postgresql://${POSTGRES_USER:-quantdinger}:${POSTGRES_PASSWORD:-quantdinger123}@postgres:5432/${POSTGRES_DB:-quantdinger}
- DB_TYPE=postgresql
- DB_POOL_MIN=1
- DB_POOL_MAX=2
- DB_APPLICATION_NAME=quantdinger-migration
networks:
- quantdinger-network
backend:
<<: *backend-runtime
# Tag resolution: BACKEND_TAG > IMAGE_TAG > latest. See header comment.
image: ${BACKEND_IMAGE:-ghcr.io/openbyteinc/quantdinger-backend}:${BACKEND_TAG:-${IMAGE_TAG:-latest}}
pull_policy: always
container_name: quantdinger-backend
restart: unless-stopped
ulimits:
nofile:
soft: 65535
hard: 65535
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
redis-jobs:
condition: service_healthy
migration:
condition: service_completed_successfully
ports:
- "${BACKEND_PORT:-127.0.0.1:5000}:5000"
volumes:
- backend_logs:/app/logs
- backend_data:/app/data
# Backend runtime config. Must exist as a *file* on the host - if missing,
# docker silently creates a directory at the mount target and shadows
# /app/.env. The entrypoint will auto-generate SECRET_KEY on first start
# and write it back through the bind mount, so the host file gets the
# generated key persistently.
- ./.env:/app/.env
environment:
- PYTHON_API_HOST=0.0.0.0
- PYTHON_API_PORT=5000
- GIT_TAG=${GIT_TAG:-${BACKEND_TAG:-${IMAGE_TAG:-}}}
- TZ=${TZ:-Asia/Shanghai}
- DATABASE_URL=postgresql://${POSTGRES_USER:-quantdinger}:${POSTGRES_PASSWORD:-quantdinger123}@postgres:5432/${POSTGRES_DB:-quantdinger}
- DB_TYPE=postgresql
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=${REDIS_PASSWORD:-}
- REDIS_CACHE_NAMESPACE=${REDIS_CACHE_NAMESPACE:-quantdinger:cache:v1}
- CACHE_ENABLED=true
- QD_PROCESS_ROLE=api
- LOG_FORMAT=${LOG_FORMAT:-json}
- PROMETHEUS_MULTIPROC_DIR=/tmp/quantdinger-prometheus
- STRATEGY_COMMANDS_ENABLED=true
- CELERY_TASKS_ENABLED=true
- CELERY_REDIS_HOST=redis-jobs
- CELERY_REDIS_PORT=6379
- CELERY_REDIS_PASSWORD=${CELERY_REDIS_PASSWORD:-}
- CELERY_BROKER_DB=0
- CELERY_RESULT_DB=1
- CELERY_BROKER_URL=${CELERY_BROKER_URL:-}
- CELERY_RESULT_BACKEND=${CELERY_RESULT_BACKEND:-}
- SKIP_AUTO_MIGRATE=true
- DB_POOL_MIN=${DB_POOL_MIN:-2}
- DB_POOL_MAX=${DB_POOL_MAX:-12}
- DB_POOL_ACQUIRE_TIMEOUT=${DB_POOL_ACQUIRE_TIMEOUT:-10}
- DB_POOL_HEALTH_CHECK=${DB_POOL_HEALTH_CHECK:-true}
- DB_APPLICATION_NAME=quantdinger-api
- MARKET_EXECUTOR_WORKERS=${MARKET_EXECUTOR_WORKERS:-6}
- PORTFOLIO_EXECUTOR_WORKERS=${PORTFOLIO_EXECUTOR_WORKERS:-3}
- RESOURCE_FD_COOLDOWN_SEC=${RESOURCE_FD_COOLDOWN_SEC:-180}
- PORTFOLIO_MONITOR_DUE_BATCH_LIMIT=${PORTFOLIO_MONITOR_DUE_BATCH_LIMIT:-5}
- GUNICORN_WORKERS=${GUNICORN_WORKERS:-2}
- GUNICORN_THREADS=${GUNICORN_THREADS:-4}
- ALLOW_LOCAL_DESKTOP_BROKERS=${ALLOW_LOCAL_DESKTOP_BROKERS:-true}
- FRONTEND_URL=${FRONTEND_URL:-http://localhost:8888,http://localhost:8889}
networks:
- quantdinger-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5000/api/health"]
interval: 30s
timeout: 10s
retries: 3
trading-worker:
<<: *backend-runtime
image: ${BACKEND_IMAGE:-ghcr.io/openbyteinc/quantdinger-backend}:${BACKEND_TAG:-${IMAGE_TAG:-latest}}
pull_policy: always
restart: unless-stopped
deploy:
replicas: ${TRADING_WORKER_REPLICAS:-1}
command: ["python", "-m", "app.commands.trading_worker"]
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
migration:
condition: service_completed_successfully
volumes:
- backend_logs:/app/logs
- backend_data:/app/data
- ./.env:/app/.env
environment:
- QD_PROCESS_ROLE=trading
- LOG_FORMAT=${LOG_FORMAT:-json}
- STRATEGY_COMMANDS_ENABLED=false
- DATABASE_URL=postgresql://${POSTGRES_USER:-quantdinger}:${POSTGRES_PASSWORD:-quantdinger123}@postgres:5432/${POSTGRES_DB:-quantdinger}
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=${REDIS_PASSWORD:-}
- REDIS_CACHE_NAMESPACE=${REDIS_CACHE_NAMESPACE:-quantdinger:cache:v1}
- CACHE_ENABLED=true
- DB_POOL_MIN=${TRADING_DB_POOL_MIN:-4}
- DB_POOL_MAX=${TRADING_DB_POOL_MAX:-32}
- DB_APPLICATION_NAME=quantdinger-trading
- SKIP_AUTO_MIGRATE=true
- ALLOW_LOCAL_DESKTOP_BROKERS=${ALLOW_LOCAL_DESKTOP_BROKERS:-true}
- KAFKA_BOOTSTRAP_SERVERS=kafka:9092
- KAFKA_CLIENT_ID=quantdinger-trading
networks:
- quantdinger-network
healthcheck:
test: ["CMD", "python", "-m", "app.commands.worker_health", "trading"]
interval: 15s
timeout: 5s
retries: 3
start_period: 30s
kafka-audit-worker:
<<: *backend-runtime
image: ${BACKEND_IMAGE:-ghcr.io/openbyteinc/quantdinger-backend}:${BACKEND_TAG:-${IMAGE_TAG:-latest}}
pull_policy: always
container_name: quantdinger-kafka-audit-worker
restart: unless-stopped
command: ["python", "-m", "app.commands.kafka_audit_worker"]
depends_on:
env-sync:
condition: service_completed_successfully
postgres:
condition: service_healthy
migration:
condition: service_completed_successfully
kafka-init:
condition: service_completed_successfully
volumes:
- backend_logs:/app/logs
- ./.env:/app/.env
environment:
- QD_PROCESS_ROLE=kafka-audit
- LOG_FORMAT=${LOG_FORMAT:-json}
- DATABASE_URL=postgresql://${POSTGRES_USER:-quantdinger}:${POSTGRES_PASSWORD:-quantdinger123}@postgres:5432/${POSTGRES_DB:-quantdinger}
- DB_TYPE=postgresql
- DB_POOL_MIN=1
- DB_POOL_MAX=3
- DB_APPLICATION_NAME=quantdinger-kafka-audit
- SKIP_AUTO_MIGRATE=true
- KAFKA_BOOTSTRAP_SERVERS=kafka:9092
- KAFKA_AUDIT_GROUP_ID=quantdinger-runtime-audit-v1
networks:
- quantdinger-network
healthcheck:
test: ["CMD", "python", "-m", "app.commands.worker_health", "kafka-audit"]
interval: 15s
timeout: 5s
retries: 3
start_period: 30s
strategy-dispatcher-worker:
<<: *backend-runtime
image: ${BACKEND_IMAGE:-ghcr.io/openbyteinc/quantdinger-backend}:${BACKEND_TAG:-${IMAGE_TAG:-latest}}
pull_policy: always
restart: unless-stopped
deploy:
replicas: ${STRATEGY_DISPATCHER_REPLICAS:-1}
command: ["python", "-m", "app.commands.strategy_dispatcher_worker"]
depends_on:
postgres:
condition: service_healthy
migration:
condition: service_completed_successfully
kafka-init:
condition: service_completed_successfully
volumes:
- backend_logs:/app/logs
- ./.env:/app/.env
environment:
- QD_PROCESS_ROLE=strategy-dispatcher
- LOG_FORMAT=${LOG_FORMAT:-json}
- DATABASE_URL=postgresql://${POSTGRES_USER:-quantdinger}:${POSTGRES_PASSWORD:-quantdinger123}@postgres:5432/${POSTGRES_DB:-quantdinger}
- DB_TYPE=postgresql
- DB_POOL_MIN=1
- DB_POOL_MAX=4
- DB_APPLICATION_NAME=quantdinger-strategy-dispatcher
- SKIP_AUTO_MIGRATE=true
- KAFKA_BOOTSTRAP_SERVERS=kafka:9092
- KAFKA_CLIENT_ID=quantdinger-strategy-dispatcher
- KAFKA_STRATEGY_DISPATCH_GROUP_ID=quantdinger-strategy-dispatch-v1
networks:
- quantdinger-network
healthcheck:
test: ["CMD", "python", "-m", "app.commands.worker_health", "strategy-dispatcher"]
interval: 15s
timeout: 5s
retries: 3
start_period: 30s
strategy-evaluator-worker:
<<: *backend-runtime
image: ${BACKEND_IMAGE:-ghcr.io/openbyteinc/quantdinger-backend}:${BACKEND_TAG:-${IMAGE_TAG:-latest}}
pull_policy: always
restart: unless-stopped
deploy:
replicas: ${STRATEGY_EVALUATOR_REPLICAS:-1}
command: ["python", "-m", "app.commands.strategy_evaluator_worker"]
depends_on:
postgres:
condition: service_healthy
migration:
condition: service_completed_successfully
kafka-init:
condition: service_completed_successfully
volumes:
- backend_logs:/app/logs
- ./.env:/app/.env
environment:
- QD_PROCESS_ROLE=strategy-evaluator
- LOG_FORMAT=${LOG_FORMAT:-json}
- DATABASE_URL=postgresql://${POSTGRES_USER:-quantdinger}:${POSTGRES_PASSWORD:-quantdinger123}@postgres:5432/${POSTGRES_DB:-quantdinger}
- DB_TYPE=postgresql
- DB_POOL_MIN=1
- DB_POOL_MAX=4
- DB_APPLICATION_NAME=quantdinger-strategy-evaluator
- SKIP_AUTO_MIGRATE=true
- KAFKA_BOOTSTRAP_SERVERS=kafka:9092
- KAFKA_CLIENT_ID=quantdinger-strategy-evaluator
- KAFKA_STRATEGY_EVALUATOR_GROUP_ID=${KAFKA_STRATEGY_EVALUATOR_GROUP_ID:-quantdinger-strategy-evaluator-active-v1}
networks:
- quantdinger-network
healthcheck:
test: ["CMD", "python", "-m", "app.commands.worker_health", "strategy-evaluator"]
interval: 15s
timeout: 5s
retries: 3
start_period: 30s
scheduler-worker:
<<: *backend-runtime
image: ${BACKEND_IMAGE:-ghcr.io/openbyteinc/quantdinger-backend}:${BACKEND_TAG:-${IMAGE_TAG:-latest}}
pull_policy: always
container_name: quantdinger-scheduler-worker
restart: unless-stopped
command: ["python", "-m", "app.commands.scheduler"]
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
migration:
condition: service_completed_successfully
volumes:
- backend_logs:/app/logs
- backend_data:/app/data
- ./.env:/app/.env
environment:
- QD_PROCESS_ROLE=scheduler
- LOG_FORMAT=${LOG_FORMAT:-json}
- DATABASE_URL=postgresql://${POSTGRES_USER:-quantdinger}:${POSTGRES_PASSWORD:-quantdinger123}@postgres:5432/${POSTGRES_DB:-quantdinger}
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=${REDIS_PASSWORD:-}
- REDIS_CACHE_NAMESPACE=${REDIS_CACHE_NAMESPACE:-quantdinger:cache:v1}
- CACHE_ENABLED=true
- DB_POOL_MIN=${WORKER_DB_POOL_MIN:-2}
- DB_POOL_MAX=${WORKER_DB_POOL_MAX:-12}
- DB_APPLICATION_NAME=quantdinger-scheduler
- SKIP_AUTO_MIGRATE=true
networks:
- quantdinger-network
healthcheck:
test: ["CMD", "python", "-m", "app.commands.worker_health", "scheduler"]
interval: 15s
timeout: 5s
retries: 3
start_period: 30s
celery-worker:
<<: *backend-runtime
image: ${BACKEND_IMAGE:-ghcr.io/openbyteinc/quantdinger-backend}:${BACKEND_TAG:-${IMAGE_TAG:-latest}}
pull_policy: always
container_name: quantdinger-celery-worker
restart: unless-stopped
command: ["celery", "-A", "app.celery_app:celery_app", "worker", "--loglevel=INFO", "-Q", "jobs,ai,maintenance", "--concurrency=${CELERY_CONCURRENCY:-2}"]
depends_on:
postgres:
condition: service_healthy
redis-jobs:
condition: service_healthy
migration:
condition: service_completed_successfully
volumes:
- backend_logs:/app/logs
- backend_data:/app/data
- ./.env:/app/.env
environment:
- QD_PROCESS_ROLE=celery
- LOG_FORMAT=${LOG_FORMAT:-json}
- CELERY_TASKS_ENABLED=true
- CELERY_REDIS_HOST=redis-jobs
- CELERY_REDIS_PORT=6379
- CELERY_REDIS_PASSWORD=${CELERY_REDIS_PASSWORD:-}
- CELERY_BROKER_DB=0
- CELERY_RESULT_DB=1
- CELERY_BROKER_URL=${CELERY_BROKER_URL:-}
- CELERY_RESULT_BACKEND=${CELERY_RESULT_BACKEND:-}
- DATABASE_URL=postgresql://${POSTGRES_USER:-quantdinger}:${POSTGRES_PASSWORD:-quantdinger123}@postgres:5432/${POSTGRES_DB:-quantdinger}
- REDIS_HOST=redis
- REDIS_PORT=6379
- DB_POOL_MIN=${WORKER_DB_POOL_MIN:-2}
- DB_POOL_MAX=${WORKER_DB_POOL_MAX:-12}
- DB_APPLICATION_NAME=quantdinger-celery-worker
- SKIP_AUTO_MIGRATE=true
networks:
- quantdinger-network
healthcheck:
test: ["CMD", "python", "-m", "app.commands.worker_health", "celery"]
interval: 15s
timeout: 5s
retries: 3
start_period: 45s
celery-beat:
<<: *backend-runtime
image: ${BACKEND_IMAGE:-ghcr.io/openbyteinc/quantdinger-backend}:${BACKEND_TAG:-${IMAGE_TAG:-latest}}
pull_policy: always
container_name: quantdinger-celery-beat
restart: unless-stopped
command: ["celery", "-A", "app.celery_app:celery_app", "beat", "--loglevel=INFO", "--schedule=/app/data/celerybeat-schedule"]
depends_on:
postgres:
condition: service_healthy
redis-jobs:
condition: service_healthy
migration:
condition: service_completed_successfully
volumes:
- backend_logs:/app/logs
- backend_data:/app/data
- ./.env:/app/.env
environment:
- QD_PROCESS_ROLE=celery
- LOG_FORMAT=${LOG_FORMAT:-json}
- CELERY_REDIS_HOST=redis-jobs
- CELERY_REDIS_PORT=6379
- CELERY_REDIS_PASSWORD=${CELERY_REDIS_PASSWORD:-}
- CELERY_BROKER_DB=0
- CELERY_RESULT_DB=1
- CELERY_BROKER_URL=${CELERY_BROKER_URL:-}
- CELERY_RESULT_BACKEND=${CELERY_RESULT_BACKEND:-}
- DATABASE_URL=postgresql://${POSTGRES_USER:-quantdinger}:${POSTGRES_PASSWORD:-quantdinger123}@postgres:5432/${POSTGRES_DB:-quantdinger}
- REDIS_HOST=redis
- REDIS_PORT=6379
- DB_POOL_MIN=${WORKER_DB_POOL_MIN:-2}
- DB_POOL_MAX=${WORKER_DB_POOL_MAX:-12}
- DB_APPLICATION_NAME=quantdinger-celery-beat
- SKIP_AUTO_MIGRATE=true
networks:
- quantdinger-network
healthcheck:
test: ["CMD-SHELL", "kill -0 1"]
interval: 30s
timeout: 5s
retries: 3
frontend:
# Tag resolution: FRONTEND_TAG > IMAGE_TAG > latest. See header comment.
image: ${FRONTEND_IMAGE:-ghcr.io/openbyteinc/quantdinger-frontend}:${FRONTEND_TAG:-${IMAGE_TAG:-latest}}
pull_policy: always
container_name: quantdinger-frontend
restart: unless-stopped
ports:
- "${FRONTEND_HOST:-127.0.0.1}:${FRONTEND_PORT:-8888}:80"
environment:
- BACKEND_URL=${BACKEND_URL:-http://backend:5000}
depends_on:
- backend
networks:
- quantdinger-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/health"]
interval: 30s
timeout: 10s
retries: 3
mobile:
# Tag resolution: MOBILE_TAG > IMAGE_TAG > latest. See header comment.
image: ${MOBILE_IMAGE:-ghcr.io/openbyteinc/quantdinger-mobile}:${MOBILE_TAG:-${IMAGE_TAG:-latest}}
pull_policy: always
container_name: quantdinger-mobile
restart: unless-stopped
ports:
- "${MOBILE_HOST:-127.0.0.1}:${MOBILE_PORT:-8889}:80"
environment:
- BACKEND_URL=${BACKEND_URL:-http://backend:5000}
depends_on:
- backend
networks:
- quantdinger-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/health"]
interval: 30s
timeout: 10s
retries: 3
volumes:
postgres_data:
driver: local
backend_logs:
driver: local
backend_data:
driver: local
celery_redis_data:
driver: local
kafka_data:
driver: local
networks:
quantdinger-network:
driver: bridge