-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
111 lines (104 loc) · 3.28 KB
/
docker-compose.yml
File metadata and controls
111 lines (104 loc) · 3.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
services:
postgres:
image: pgvector/pgvector:pg17
restart: unless-stopped
container_name: memorizer-postgres
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=postgmem
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
pgadmin:
image: dpage/pgadmin4
restart: unless-stopped
container_name: memorizer-pgadmin
environment:
- PGADMIN_DEFAULT_EMAIL=admin@example.com
- PGADMIN_DEFAULT_PASSWORD=admin
ports:
- "5050:80"
depends_on:
- postgres
ollama:
image: ollama/ollama
restart: unless-stopped
container_name: memorizer-ollama
ports:
- "11434:11434"
volumes:
- ollama-data:/root/.ollama
# Initialize Ollama with the required models
ollama-init:
image: curlimages/curl:latest
container_name: memorizer-ollama-init
entrypoint: ["/bin/sh", "-c"]
depends_on:
- ollama
command: >
"
echo 'Waiting for Ollama service to start...' &&
sleep 15 &&
echo 'Pulling embedding model...' &&
for i in 1 2 3 4 5; do
echo 'Attempting to pull embedding model (try '$$i'/5)...' &&
if curl -s -X POST http://ollama:11434/api/pull -d '{\"name\": \"all-minilm:33m-l12-v2-fp16\"}'; then
echo 'Embedding model pull initiated successfully' &&
break
fi &&
echo 'Ollama not ready yet for embedding model, waiting...' &&
sleep 10
done &&
echo 'Pulling lightweight LLM model...' &&
for i in 1 2 3 4 5; do
echo 'Attempting to pull LLM model (try '$$i'/5)...' &&
if curl -s -X POST http://ollama:11434/api/pull -d '{\"name\": \"qwen2:0.5b\"}'; then
echo 'LLM model pull initiated successfully' &&
echo 'All models pulled successfully' &&
exit 0
fi &&
echo 'Failed to pull LLM model, retrying...' &&
sleep 10
done &&
echo 'Failed to pull models after multiple attempts' &&
exit 1
"
# memorizer application
memorizer:
image: petabridge/memorizer:latest
restart: unless-stopped
container_name: memorizer
environment:
- ConnectionStrings__Storage=Host=postgres;Port=5432;Database=postgmem;Username=postgres;Password=postgres
- MEMORIZER_Embeddings__ApiUrl=http://ollama:11434
- MEMORIZER_Embeddings__Model=all-minilm:33m-l12-v2-fp16
- MEMORIZER_LLM__ApiUrl=http://ollama:11434
- MEMORIZER_LLM__Model=qwen2:0.5b
- MEMORIZER_LLM__Timeout=00:02:00
- MEMORIZER_LLM__Chunking__MinCharactersForChunking=2000
- MEMORIZER_LLM__Chunking__TargetChunkSize=1500
- MEMORIZER_Server__CanonicalUrl=http://localhost:5000
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "5000:8080"
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:8080/healthz || exit 1"]
interval: 5s
timeout: 5s
retries: 3
start_period: 10s
depends_on:
postgres:
condition: service_healthy
ollama-init:
condition: service_completed_successfully
volumes:
postgres-data:
ollama-data: