-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
306 lines (295 loc) · 8.64 KB
/
docker-compose.yml
File metadata and controls
306 lines (295 loc) · 8.64 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
services:
# Ollama service - AI model runtime
ollama:
image: ollama/ollama:latest
container_name: vuhitra-ollama
profiles:
- ollama
ports:
- "${OLLAMA_HOST_PORT:-11434}:${OLLAMA_CONTAINER_PORT:-11434}"
volumes:
- ollama_data:/root/.ollama
environment:
- OLLAMA_HOST=0.0.0.0
- SENTRY_DSN=${SENTRY_DSN:-}
- ENVIRONMENT=${ENVIRONMENT:-DEV}
healthcheck:
test: ["CMD", "ollama", "list"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
restart: unless-stopped
networks:
- vuhitra-network
# Optional: GPU support (uncomment if NVIDIA GPU available)
# deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: all
# capabilities: [gpu]
# Ollama model initialization - pulls tinyllama on first start
ollama-setup:
image: curlimages/curl:latest
container_name: vuhitra-ollama-setup
profiles:
- ollama
depends_on:
ollama:
condition: service_healthy
entrypoint: /bin/sh
command: >
-c "
echo 'Waiting for Ollama service to be ready...' &&
sleep 5 &&
echo 'Pulling tinyllama model (lightweight, ~1GB, CPU-friendly)...' &&
curl -X POST http://ollama:${OLLAMA_CONTAINER_PORT:-11434}/api/pull -d '{\"name\":\"tinyllama\"}' &&
echo '' &&
echo 'Model pull request sent successfully!' &&
echo 'Waiting for model to finish downloading...' &&
sleep 30 &&
echo 'Testing model with a simple prompt...' &&
curl -X POST http://ollama:${OLLAMA_CONTAINER_PORT:-11434}/api/generate -d '{\"model\":\"tinyllama\",\"prompt\":\"Say hello\",\"stream\":false}' &&
echo '' &&
echo 'Ollama setup complete!'
"
networks:
- vuhitra-network
restart: "no"
# PostgreSQL database - official image
postgres:
image: postgres:14
container_name: vuhitra-postgres
ports:
- "${POSTGRES_HOST_PORT:-35432}:5432"
environment:
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
- POSTGRES_DB=${POSTGRES_DB:-vuhitra}
volumes:
- postgres_data:/var/lib/postgresql/data
- ./src/postgresql/init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- vuhitra-network
# Flask API for PostgreSQL
postgres-api:
build:
context: .
dockerfile: src/postgresql/flask-app/Dockerfile
container_name: vuhitra-postgres-api
ports:
- "${FLASK_HOST_PORT:-15000}:5000"
volumes:
- ./config.yaml:/app/config.yaml:ro
- ./secrets.yaml:/app/secrets.yaml:ro
environment:
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
- POSTGRES_DB=${POSTGRES_DB:-vuhitra}
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- TRANSFORMER_API_URL=http://transformer:${TRANSFORMER_CONTAINER_PORT:-5050}
- OLLAMA_API_URL=${OLLAMA_API_URL:-http://ollama:11434}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
- SENTRY_DSN=${SENTRY_DSN:-}
- ENVIRONMENT=${ENVIRONMENT:-DEV}
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5000/health', timeout=5)"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- vuhitra-network
# PyPI server for local packages
pypi-server:
build:
context: .
dockerfile: pypi-server/Dockerfile
image: vuhitra-pypi-server:latest
container_name: vuhitra-pypi-server
profiles:
- app
ports:
- "8080:8080"
networks:
- vuhitra-network
healthcheck:
test: ["CMD", "curl", "-s", "-f", "http://localhost:8080/simple/"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
# Transformer service for embeddings
transformer:
build:
context: .
dockerfile: src/transformer/Dockerfile
image: vuhitra-transformer:latest
container_name: vuhitra-transformer
profiles:
- app
ports:
- "${TRANSFORMER_HOST_PORT:-16050}:${TRANSFORMER_CONTAINER_PORT:-5050}"
volumes:
- transformer_models:/root/.cache/huggingface
environment:
- FLASK_DEBUG=false
- ENVIRONMENT=${ENVIRONMENT:-DEV}
- SENTRY_DSN=${SENTRY_DSN:-}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:${TRANSFORMER_CONTAINER_PORT:-5050}/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 120s
restart: unless-stopped
networks:
- vuhitra-network
# Redis service for RAG vector storage
redis:
image: redis:7-alpine
container_name: vuhitra-redis
profiles:
- app
ports:
- "${REDIS_HOST_PORT:-26379}:6379"
command: redis-server --appendonly yes
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- vuhitra-network
# Flask API for Redis vector storage
redis-api:
build:
context: .
dockerfile: src/redis/flask-app/Dockerfile
container_name: vuhitra-redis-api
profiles:
- app
ports:
- "${REDIS_API_PORT:-17000}:5000"
environment:
- REDIS_HOST=redis
- REDIS_PORT=6379
- TRANSFORMER_API_URL=http://transformer:${TRANSFORMER_CONTAINER_PORT:-5050}
- SENTRY_DSN=${SENTRY_DSN:-}
- ENVIRONMENT=${ENVIRONMENT:-DEV}
depends_on:
redis:
condition: service_healthy
transformer:
condition: service_healthy
healthcheck:
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5000/health', timeout=5)"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- vuhitra-network
# Bugsink - Self-hosted error tracking
bugsink:
image: bugsink/bugsink:latest
container_name: vuhitra-bugsink
restart: always
environment:
- SECRET_KEY=${BUGSINK_SECRET_KEY:-Plx41LNO5AAov9UPsZB0NrObuSHEla0RI7rqLyHiFL09mnc7kl}
- CREATE_SUPERUSER=${BUGSINK_SUPERUSER:-admin:admin}
- PORT=8000
volumes:
- bugsink_data:/data
networks:
- vuhitra-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
# Ollama API Service - Ollama-compatible API with enhanced features
# OpenWebUI compatible + MCP tools + RAG + Code execution
ollama-api:
build:
context: .
dockerfile: ollama_api_service/Dockerfile
container_name: vuhitra-ollama-api
profiles:
- ollama
ports:
- "${OLLAMA_API_PORT:-8080}:8080"
volumes:
# Mount src/ directory (read-only) - GOLDEN RULE: no modifications to CLI code
- ./src:/app/src:ro
# Mount config.yaml (read-only)
- ./config.yaml:/app/config.yaml:ro
# Mount system_mcps for MCP server access
- ./system_mcps:/app/system_mcps:ro
# Mount ollama_api_service for development (allows hot reload)
- ./ollama_api_service:/app/ollama_api_service:ro
environment:
# Service URLs
- OLLAMA_API_URL=${OLLAMA_API_URL:-http://ollama:11434}
- POSTGRES_API_URL=http://postgres-api:5000
- TRANSFORMER_API_URL=http://transformer:${TRANSFORMER_CONTAINER_PORT:-5050}
- REDIS_API_URL=http://redis-api:5000
# Sentry
- SENTRY_DSN=${SENTRY_DSN:-}
- ENVIRONMENT=${ENVIRONMENT:-DEV}
# MCP debug
- MCP_DEBUG=${MCP_DEBUG:-false}
depends_on:
ollama:
condition: service_healthy
postgres-api:
condition: service_healthy
redis-api:
condition: service_healthy
transformer:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
restart: unless-stopped
networks:
- vuhitra-network
networks:
vuhitra-network:
driver: bridge
name: vuhitra-network
volumes:
ollama_data:
driver: local
name: vuhitra-ollama-data
postgres_data:
driver: local
name: vuhitra-postgres-data
transformer_models:
driver: local
name: vuhitra-transformer-models
redis_data:
driver: local
name: vuhitra-redis-data
bugsink_data:
driver: local
name: vuhitra-bugsink-data