-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
165 lines (159 loc) · 5 KB
/
Copy pathdocker-compose.yml
File metadata and controls
165 lines (159 loc) · 5 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
services:
ollama:
image: ollama/ollama:latest
volumes:
- ollama_data:/root/.ollama
restart: unless-stopped
postgres:
image: postgres:15-alpine
environment:
POSTGRES_DB: rag_db
POSTGRES_USER: rag
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set}"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U rag"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
qdrant:
image: qdrant/qdrant:latest
volumes:
- qdrant_data:/qdrant/storage
restart: unless-stopped
redis:
image: redis:7-alpine
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
rag:
image: ghcr.io/jemplayer82/rag:latest
pull_policy: always
ports:
- "${RAG_PORT:-8000}:8000"
environment:
DATABASE_URL: postgresql://rag:${POSTGRES_PASSWORD}@postgres:5432/rag_db
QDRANT_HOST: qdrant
QDRANT_PORT: "6333"
REDIS_URL: redis://redis:6379/0
# JWT_SECRET and ENCRYPTION_KEY auto-generate on first boot if unset.
# Override here to pin specific values; otherwise they persist in the
# data volume at /app/data/.secrets.env.
JWT_SECRET: ${JWT_SECRET:-}
ENCRYPTION_KEY: ${ENCRYPTION_KEY:-}
ADMIN_USERNAME: ${ADMIN_USERNAME:-}
LLM_PROVIDER: ${LLM_PROVIDER:-ollama}
LLM_MODEL: ${LLM_MODEL:-}
# Ollama is always part of the stack — point at the in-stack container.
# Hardcoded (not env-overridable) so a stray .env value can't aim it at a
# dead host. Admins can still override per-provider in the UI if needed.
LLM_BASE_URL: http://ollama:11434
OLLAMA_BASE_URL: http://ollama:11434
LLM_TEMPERATURE: ${LLM_TEMPERATURE:-0.3}
LLM_TOP_P: ${LLM_TOP_P:-0.9}
LLM_MAX_TOKENS: ${LLM_MAX_TOKENS:-2048}
OPENAI_API_KEY: ${OPENAI_API_KEY:-}
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}
EMBED_MODEL: ${EMBED_MODEL:-BAAI/bge-large-en-v1.5}
EMBED_DEVICE: ${EMBED_DEVICE:-cpu}
CHUNK_SIZE: ${CHUNK_SIZE:-600}
CHUNK_OVERLAP: ${CHUNK_OVERLAP:-100}
TOP_K: ${TOP_K:-8}
RERANK_TOP_K: ${RERANK_TOP_K:-5}
DEBUG: ${DEBUG:-false}
volumes:
- uploads_data:/app/data
depends_on:
postgres:
condition: service_healthy
qdrant:
condition: service_started
redis:
condition: service_healthy
ollama:
condition: service_started
restart: unless-stopped
rag-worker:
image: ghcr.io/jemplayer82/rag:latest
pull_policy: always
command: ["python", "worker.py"]
healthcheck:
test: ["CMD-SHELL", "rq info --url $$REDIS_URL --raw 2>/dev/null | grep -q '^worker ' || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
environment:
DATABASE_URL: postgresql://rag:${POSTGRES_PASSWORD}@postgres:5432/rag_db
QDRANT_HOST: qdrant
QDRANT_PORT: "6333"
REDIS_URL: redis://redis:6379/0
JWT_SECRET: ${JWT_SECRET:-}
ENCRYPTION_KEY: ${ENCRYPTION_KEY:-}
EMBED_MODEL: ${EMBED_MODEL:-BAAI/bge-large-en-v1.5}
EMBED_DEVICE: ${EMBED_DEVICE:-cpu}
CHUNK_SIZE: ${CHUNK_SIZE:-600}
CHUNK_OVERLAP: ${CHUNK_OVERLAP:-100}
volumes:
- uploads_data:/app/data
depends_on:
postgres:
condition: service_healthy
qdrant:
condition: service_started
redis:
condition: service_healthy
ollama:
condition: service_started
restart: unless-stopped
# Named volumes with the "local" driver's bind option.
# Portainer lists these under the stack and can create/remove them from its
# UI, but the actual data lives at ${DATA_ROOT}/<name> on the host. Override
# DATA_ROOT in your .env or Portainer env vars if /storage/rag is wrong for
# your host (e.g. DATA_ROOT=/var/lib/rag or DATA_ROOT=/opt/rag/data). The
# directories must exist before the first `docker compose up`:
#
# sudo mkdir -p "${DATA_ROOT:-/storage/rag}"/{postgres,qdrant,redis,uploads,ollama}
#
# Data survives `docker compose down` and stack removal. `docker compose
# down -v` removes the volume references but will not delete the host files
# (Docker doesn't own the path) — so the data persists until you `rm -rf`
# the host directory manually.
volumes:
postgres_data:
driver: local
driver_opts:
type: none
o: bind
device: ${DATA_ROOT:-/storage/rag}/postgres
qdrant_data:
driver: local
driver_opts:
type: none
o: bind
device: ${DATA_ROOT:-/storage/rag}/qdrant
redis_data:
driver: local
driver_opts:
type: none
o: bind
device: ${DATA_ROOT:-/storage/rag}/redis
uploads_data:
driver: local
driver_opts:
type: none
o: bind
device: ${DATA_ROOT:-/storage/rag}/uploads
ollama_data:
driver: local
driver_opts:
type: none
o: bind
device: ${DATA_ROOT:-/storage/rag}/ollama