Repository navigation
Expand file tree
/
Copy pathcompose.yaml
More file actions
280 lines (263 loc) · 9.28 KB
/
Copy pathcompose.yaml
File metadata and controls
280 lines (263 loc) · 9.28 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
name: fastrag
x-app-environment: &app-environment
FASTRAG_ENVIRONMENT: production
FASTRAG_RELEASE: ${FASTRAG_RELEASE:-dev}
FASTRAG_QUERY_API_KEY: ${FASTRAG_QUERY_API_KEY:?set FASTRAG_QUERY_API_KEY}
FASTRAG_ADMIN_API_KEY: ${FASTRAG_ADMIN_API_KEY:?set FASTRAG_ADMIN_API_KEY}
FASTRAG_LLM_BASE_URL: ${FASTRAG_LLM_BASE_URL:?set FASTRAG_LLM_BASE_URL}
FASTRAG_LLM_API_KEY: ${FASTRAG_LLM_API_KEY:?set FASTRAG_LLM_API_KEY}
FASTRAG_LLM_MODEL: ${FASTRAG_LLM_MODEL:?set FASTRAG_LLM_MODEL}
FASTRAG_DENSE_MODEL_REVISION: ${FASTRAG_DENSE_MODEL_REVISION:?pin embedding revision}
FASTRAG_DENSE_MODEL_SHA256: ${FASTRAG_DENSE_MODEL_SHA256:?pin embedding artifact}
FASTRAG_DENSE_MODEL_PATH: /models/dense
FASTRAG_RERANKER_REVISION: ${FASTRAG_RERANKER_REVISION:?pin reranker revision}
FASTRAG_RERANKER_SHA256: ${FASTRAG_RERANKER_SHA256:?pin reranker artifact}
FASTRAG_RERANKER_MODEL_PATH: /models/reranker
FASTRAG_QDRANT_URL: http://qdrant:6333
FASTRAG_REDIS_URL: redis://:${APP_REDIS_PASSWORD}@app-redis:6379/0
FASTRAG_DATABASE_URL: postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/fastrag
FASTRAG_LANGFUSE_PUBLIC_KEY: ${LANGFUSE_PUBLIC_KEY}
FASTRAG_LANGFUSE_SECRET_KEY: ${LANGFUSE_SECRET_KEY}
FASTRAG_LANGFUSE_BASE_URL: ${LANGFUSE_BASE_URL:-https://cloud.langfuse.com}
FASTRAG_DATA_DIR: /data
# Only consumed by the optional `langfuse` profile. Langfuse Cloud's free tier
# covers the same need without ClickHouse, MinIO, and a second Redis, so the
# default stack points FASTRAG_LANGFUSE_BASE_URL there instead.
x-langfuse-environment: &langfuse-environment
NEXTAUTH_URL: https://${LANGFUSE_DOMAIN:-langfuse.localhost}
DATABASE_URL: postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/langfuse
SALT: ${LANGFUSE_SALT:-}
ENCRYPTION_KEY: ${LANGFUSE_ENCRYPTION_KEY:-}
CLICKHOUSE_MIGRATION_URL: clickhouse://clickhouse:9000
CLICKHOUSE_URL: http://clickhouse:8123
CLICKHOUSE_USER: clickhouse
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD:-replace-me}
CLICKHOUSE_CLUSTER_ENABLED: "false"
REDIS_HOST: langfuse-redis
REDIS_PORT: "6379"
REDIS_AUTH: ${LANGFUSE_REDIS_PASSWORD:-}
LANGFUSE_S3_EVENT_UPLOAD_BUCKET: langfuse
LANGFUSE_S3_EVENT_UPLOAD_REGION: auto
LANGFUSE_S3_EVENT_UPLOAD_ACCESS_KEY_ID: minio
LANGFUSE_S3_EVENT_UPLOAD_SECRET_ACCESS_KEY: ${MINIO_ROOT_PASSWORD}
LANGFUSE_S3_EVENT_UPLOAD_ENDPOINT: http://minio:9000
LANGFUSE_S3_EVENT_UPLOAD_FORCE_PATH_STYLE: "true"
LANGFUSE_S3_MEDIA_UPLOAD_BUCKET: langfuse
LANGFUSE_S3_MEDIA_UPLOAD_REGION: auto
LANGFUSE_S3_MEDIA_UPLOAD_ACCESS_KEY_ID: minio
LANGFUSE_S3_MEDIA_UPLOAD_SECRET_ACCESS_KEY: ${MINIO_ROOT_PASSWORD}
LANGFUSE_S3_MEDIA_UPLOAD_ENDPOINT: http://minio:9000
LANGFUSE_S3_MEDIA_UPLOAD_FORCE_PATH_STYLE: "true"
TELEMETRY_ENABLED: "false"
services:
proxy:
image: caddy:2.10.0-alpine
restart: unless-stopped
environment:
FASTRAG_DOMAIN: ${FASTRAG_DOMAIN:-localhost}
LANGFUSE_DOMAIN: ${LANGFUSE_DOMAIN:-langfuse.localhost}
ports:
- "80:80"
- "443:443"
volumes:
- ./deploy/Caddyfile:/etc/caddy/Caddyfile:ro
- caddy_data:/data
depends_on:
api:
condition: service_healthy
api:
build: .
image: fastrag:${FASTRAG_RELEASE:-dev}
restart: unless-stopped
extra_hosts:
- "host.docker.internal:host-gateway"
environment: *app-environment
volumes:
- rag_data:/data
- model_data:/models:ro
- ./config/calibration.json:/app/config/calibration.json:ro
depends_on:
app-redis:
condition: service_healthy
postgres:
condition: service_healthy
qdrant:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health/live')"]
interval: 10s
timeout: 3s
retries: 10
read_only: true
tmpfs: [/tmp]
security_opt: [no-new-privileges:true]
worker:
image: fastrag:${FASTRAG_RELEASE:-dev}
restart: unless-stopped
command: ["rq", "worker", "--url", "redis://:${APP_REDIS_PASSWORD}@app-redis:6379/0", "ingestion"]
environment: *app-environment
volumes:
- rag_data:/data
- model_data:/models:ro
depends_on:
app-redis:
condition: service_healthy
postgres:
condition: service_healthy
qdrant:
condition: service_healthy
security_opt: [no-new-privileges:true]
model-init:
profiles: [tools]
image: fastrag:${FASTRAG_RELEASE:-dev}
command: ["python", "-m", "fastrag.download_models"]
environment: *app-environment
user: "0:0"
volumes:
- model_data:/models
qdrant:
image: qdrant/qdrant:v1.15.4
restart: unless-stopped
volumes:
- qdrant_data:/qdrant/storage
healthcheck:
test: ["CMD-SHELL", "bash -c ':> /dev/tcp/127.0.0.1/6333'"]
interval: 10s
timeout: 3s
retries: 10
app-redis:
image: redis:8.2.1-alpine
restart: unless-stopped
command: ["redis-server", "--appendonly", "yes", "--requirepass", "${APP_REDIS_PASSWORD}", "--maxmemory-policy", "volatile-lfu"]
volumes:
- app_redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "-a", "${APP_REDIS_PASSWORD}", "ping"]
interval: 5s
timeout: 3s
retries: 10
postgres:
image: postgres:17.6-alpine
restart: unless-stopped
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD}
TZ: UTC
PGTZ: UTC
volumes:
- postgres_data:/var/lib/postgresql/data
- ./deploy/postgres-init.sql:/docker-entrypoint-initdb.d/00-init.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 3s
retries: 20
langfuse-web:
profiles: [langfuse]
image: langfuse/langfuse:3.185.0
restart: unless-stopped
environment:
<<: *langfuse-environment
NEXTAUTH_SECRET: ${LANGFUSE_NEXTAUTH_SECRET:-}
LANGFUSE_INIT_ORG_ID: fastrag
LANGFUSE_INIT_ORG_NAME: FastRAG
LANGFUSE_INIT_PROJECT_ID: fastrag-production
LANGFUSE_INIT_PROJECT_NAME: FastRAG Production
LANGFUSE_INIT_PROJECT_PUBLIC_KEY: ${LANGFUSE_PUBLIC_KEY}
LANGFUSE_INIT_PROJECT_SECRET_KEY: ${LANGFUSE_SECRET_KEY}
LANGFUSE_INIT_USER_EMAIL: ${LANGFUSE_INIT_USER_EMAIL}
LANGFUSE_INIT_USER_PASSWORD: ${LANGFUSE_INIT_USER_PASSWORD}
LANGFUSE_INIT_USER_NAME: FastRAG Admin
depends_on: &langfuse-dependencies
postgres: {condition: service_healthy}
clickhouse: {condition: service_healthy}
langfuse-redis: {condition: service_healthy}
minio: {condition: service_healthy}
healthcheck:
test: ["CMD-SHELL", "wget -q --spider http://localhost:3000/api/public/health || exit 1"]
interval: 10s
timeout: 5s
retries: 20
langfuse-worker:
profiles: [langfuse]
image: langfuse/langfuse-worker:3.185.0
restart: unless-stopped
environment: *langfuse-environment
depends_on: *langfuse-dependencies
clickhouse:
profiles: [langfuse]
image: clickhouse/clickhouse-server:25.12
restart: unless-stopped
user: "101:101"
environment:
CLICKHOUSE_USER: clickhouse
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD:-replace-me}
volumes:
- clickhouse_data:/var/lib/clickhouse
- clickhouse_logs:/var/log/clickhouse-server
healthcheck:
test: ["CMD-SHELL", "wget -q --spider http://localhost:8123/ping || exit 1"]
interval: 5s
timeout: 5s
retries: 20
langfuse-redis:
profiles: [langfuse]
image: redis:7.4.5-alpine
restart: unless-stopped
command: ["redis-server", "--appendonly", "yes", "--requirepass", "${LANGFUSE_REDIS_PASSWORD}", "--maxmemory-policy", "noeviction"]
volumes:
- langfuse_redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "-a", "${LANGFUSE_REDIS_PASSWORD}", "ping"]
interval: 5s
timeout: 3s
retries: 10
minio:
profiles: [langfuse]
image: quay.io/minio/minio:RELEASE.2025-04-22T22-12-26Z
restart: unless-stopped
command: server --address :9000 --console-address :9001 /data
environment:
MINIO_ROOT_USER: minio
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-}
volumes:
- minio_data:/data
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 5s
timeout: 5s
retries: 10
prometheus:
image: prom/prometheus:v3.5.0
restart: unless-stopped
command: ["--config.file=/etc/prometheus/prometheus.yml", "--storage.tsdb.retention.time=30d"]
volumes:
- ./deploy/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- ./deploy/alerts.yml:/etc/prometheus/alerts.yml:ro
- prometheus_data:/prometheus
depends_on:
api: {condition: service_healthy}
grafana:
image: grafana/grafana:12.1.0
restart: unless-stopped
environment:
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_ADMIN_PASSWORD:?set GRAFANA_ADMIN_PASSWORD}
GF_USERS_ALLOW_SIGN_UP: "false"
volumes:
- grafana_data:/var/lib/grafana
- ./deploy/grafana/provisioning:/etc/grafana/provisioning:ro
- ./deploy/grafana/dashboards:/var/lib/grafana/dashboards:ro
depends_on:
prometheus: {condition: service_started}
volumes:
rag_data:
qdrant_data:
app_redis_data:
postgres_data:
clickhouse_data:
clickhouse_logs:
langfuse_redis_data:
minio_data:
prometheus_data:
grafana_data:
caddy_data:
model_data: