-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
174 lines (165 loc) · 4.94 KB
/
Copy pathdocker-compose.yml
File metadata and controls
174 lines (165 loc) · 4.94 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
# Local development only: this is not a production deployment manifest.
services:
ollama:
image: ollama/ollama
ports:
- "127.0.0.1:11434:11434"
volumes:
- ollama_data:/root/.ollama
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:11434/api/tags"]
interval: 10s
timeout: 5s
retries: 12
start_period: 30s
restart: unless-stopped
ollama-init:
image: ollama/ollama
depends_on:
ollama:
condition: service_healthy
volumes:
- ollama_data:/root/.ollama
entrypoint: ["ollama", "pull", "qwen2.5:7b"]
environment:
- OLLAMA_HOST=http://ollama:11434
restart: "no"
postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: rag_assistant
POSTGRES_USER: rag
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-rag_dev_password}
ports:
- "127.0.0.1:5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U rag -d rag_assistant"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
restart: unless-stopped
ports:
- "127.0.0.1:6379:6379"
volumes:
- redisdata:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
jaeger:
image: jaegertracing/all-in-one:1.59
restart: unless-stopped
ports:
- "127.0.0.1:16686:16686"
- "127.0.0.1:4317:4317"
- "127.0.0.1:4318:4318"
app:
build: .
ports:
- "127.0.0.1:8000:8000"
env_file:
- .env
environment:
- RAG_ENV=development
- OLLAMA_BASE_URL=http://ollama:11434
- DATABASE_URL=postgresql://rag:${POSTGRES_PASSWORD:-rag_dev_password}@postgres:5432/rag_assistant
- REDIS_URL=redis://redis:6379/0
- OTEL_ENABLED=${OTEL_ENABLED:-false}
- OTEL_EXPORTER_OTLP_ENDPOINT=http://jaeger:4317
- OTEL_SERVICE_NAME=rag-support-assistant
volumes:
- ./data:/app/data
depends_on:
ollama-init:
condition: service_completed_successfully
postgres:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
# Exactly one Celery ingestion worker (concurrency 1). Shares /app/data with
# the app. Not a second Uvicorn web process — web stays --workers 1 / one
# replica until session/confirm-action state is externalised.
# Also executes plan §4.6 escalation outbox retry tasks when beat schedules them.
worker:
build: .
command:
- celery
- -A
- tasks.celery_app:celery_app
- worker
- --concurrency=1
- --hostname=ingest@%h
- --loglevel=INFO
env_file:
- .env
environment:
- RAG_ENV=development
- OLLAMA_BASE_URL=http://ollama:11434
- DATABASE_URL=postgresql://rag:${POSTGRES_PASSWORD:-rag_dev_password}@postgres:5432/rag_assistant
- REDIS_URL=redis://redis:6379/0
- OTEL_ENABLED=${OTEL_ENABLED:-false}
- OTEL_EXPORTER_OTLP_ENDPOINT=http://jaeger:4317
- OTEL_SERVICE_NAME=rag-support-assistant
- RAG_OUTBOX_RETRY_BEAT=${RAG_OUTBOX_RETRY_BEAT:-true}
- RAG_OUTBOX_RETRY_INTERVAL_SEC=${RAG_OUTBOX_RETRY_INTERVAL_SEC:-300}
- RAG_OUTBOX_RETRY_BATCH_LIMIT=${RAG_OUTBOX_RETRY_BATCH_LIMIT:-50}
volumes:
- ./data:/app/data
depends_on:
ollama-init:
condition: service_completed_successfully
postgres:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
# Long warm-shutdown: no Celery task_time_limit is configured in-repo, and
# embedding/indexing a large document can run for many minutes.
stop_grace_period: 3600s
healthcheck:
test: ["CMD", "python", "-m", "tasks.worker_health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Plan §4.6: Celery beat schedules escalation outbox retry (failed inbox
# deliveries). One replica only — multiple beat processes duplicate schedules.
# Operator/cron alternative: python scripts/outbox_retry.py
worker-beat:
build: .
command:
- celery
- -A
- tasks.celery_app:celery_app
- beat
- --loglevel=INFO
- --pidfile=
- --schedule=/tmp/celerybeat-schedule
env_file:
- .env
environment:
- RAG_ENV=development
- DATABASE_URL=postgresql://rag:${POSTGRES_PASSWORD:-rag_dev_password}@postgres:5432/rag_assistant
- REDIS_URL=redis://redis:6379/0
- RAG_OUTBOX_RETRY_BEAT=${RAG_OUTBOX_RETRY_BEAT:-true}
- RAG_OUTBOX_RETRY_INTERVAL_SEC=${RAG_OUTBOX_RETRY_INTERVAL_SEC:-300}
- RAG_OUTBOX_RETRY_BATCH_LIMIT=${RAG_OUTBOX_RETRY_BATCH_LIMIT:-50}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
worker:
condition: service_started
restart: unless-stopped
volumes:
ollama_data:
pgdata:
redisdata: