-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
121 lines (115 loc) · 3.09 KB
/
docker-compose.yml
File metadata and controls
121 lines (115 loc) · 3.09 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
---
# LangCore API — Docker Compose
#
# Services: API (FastAPI), Worker (Celery)
# Infrastructure (Redis, Flower) lives in ../contract-analysis-api/docker-compose.db.yml
#
# Usage:
# 1. Start infra : cd ../contract-analysis-api && docker compose -f docker-compose.db.yml up -d
# 2. Development : docker compose up --build
# 3. Production : docker compose --profile production up --build -d
x-dev-common: &dev-common
image: langcore:dev
volumes:
- .:/app
env_file:
- .env
networks:
- langcore-net
services:
# ── FastAPI application ──────────────────────────────────────────────────
api:
<<: *dev-common
build:
context: .
dockerfile: docker/Dockerfile
target: dev
ports:
- "8000:8000"
environment:
APP_ROLE: web
WEB_WORKERS: 1
REDIS_HOST: redis-server
REDIS_PORT: 6379
REDIS_DB: 0
CELERY_BROKER_URL: redis://redis-server:6379/0
LOG_LEVEL: info
# ── Celery worker ───────────────────────────────────────────────────────
worker:
<<: *dev-common
environment:
APP_ROLE: worker
WORKER_CONCURRENCY: 1
MAX_TASKS_PER_CHILD: 100
REDIS_HOST: redis-server
REDIS_PORT: 6379
REDIS_DB: 0
CELERY_BROKER_URL: redis://redis-server:6379/0
LOG_LEVEL: info
# ── Production API (use --profile production) ────────────────────────────
api-prod:
build:
context: .
dockerfile: docker/Dockerfile
target: production
image: langcore:prod
profiles:
- production
restart: always
ports:
- "8000:8000"
env_file:
- .env
environment:
APP_ROLE: web
WEB_WORKERS: 4
REDIS_HOST: redis-server
REDIS_PORT: 6379
REDIS_DB: 0
CELERY_BROKER_URL: redis://redis-server:6379/0
LOG_LEVEL: warning
networks:
- langcore-net
deploy:
resources:
limits:
cpus: "1.0"
memory: 512M
reservations:
cpus: "0.25"
memory: 256M
# ── Production Worker (use --profile production) ─────────────────────────
worker-prod:
image: langcore:prod
profiles:
- production
restart: always
env_file:
- .env
environment:
APP_ROLE: worker
WORKER_CONCURRENCY: 4
MAX_TASKS_PER_CHILD: 200
REDIS_HOST: redis-server
REDIS_PORT: 6379
REDIS_DB: 0
CELERY_BROKER_URL: redis://redis-server:6379/0
LOG_LEVEL: warning
networks:
- langcore-net
depends_on:
api-prod:
condition: service_started
deploy:
replicas: 2
resources:
limits:
cpus: "1.0"
memory: 1G
reservations:
cpus: "0.5"
memory: 512M
networks:
langcore-net:
external: true
name: langcore-net