Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
175 lines (160 loc) · 5.1 KB
/
Copy pathdocker-compose.yml
File metadata and controls
175 lines (160 loc) · 5.1 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
# Lincoln Development Environment
#
# Usage:
# docker compose up -d # Start DB + ML service (default)
# docker compose --profile full up # Include Elixir app in Docker
# docker compose --profile test up # Include test database
# docker compose down # Stop all services
#
# Services:
# db - PostgreSQL 16 with pgvector (port 5432)
# db-test - Isolated test database (port 5433) [profile: test]
# ml_service - Python embedding service (port 8000)
# lincoln - Phoenix app [profile: full] (port 4000)
services:
# ===========================================================================
# Database Services
# ===========================================================================
db:
image: pgvector/pgvector:pg16
container_name: lincoln_db
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: lincoln_dev
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
restart: unless-stopped
db-test:
image: pgvector/pgvector:pg16
container_name: lincoln_db_test
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: lincoln_test
ports:
- "5433:5432"
volumes:
- postgres_test_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
profiles:
- test
- full
# ===========================================================================
# ML Service (Python)
# ===========================================================================
ml_service:
build:
context: ./apps/ml_service
dockerfile: Dockerfile
container_name: lincoln_ml
ports:
- "8000:8000"
volumes:
- ml_model_cache:/home/appuser/.cache/huggingface
environment:
- TRANSFORMERS_CACHE=/home/appuser/.cache/huggingface
- HF_HOME=/home/appuser/.cache/huggingface
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 10s
timeout: 10s
retries: 5
start_period: 30s # Model loading takes time
restart: unless-stopped
# ===========================================================================
# SearXNG (Self-hosted Search)
# ===========================================================================
searxng:
image: searxng/searxng:latest
container_name: lincoln_searxng
ports:
- "8888:8080"
volumes:
- searxng_data:/etc/searxng
- ./config/searxng/settings.yml:/etc/searxng/settings.yml:ro
restart: unless-stopped
profiles:
- search
# ===========================================================================
# Elixir App (Optional - use profile: full)
# ===========================================================================
lincoln:
build:
context: ./apps/lincoln
dockerfile: Dockerfile
container_name: lincoln_app
ports:
- "127.0.0.1:4000:4000"
environment:
- DATABASE_URL=postgres://postgres:postgres@db:5432/lincoln_dev
- ML_SERVICE_URL=http://ml_service:8000
- LLM_PROVIDER=${LLM_PROVIDER:-anthropic}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
- OPENAI_API_KEY=${OPENAI_API_KEY:-}
- OLLAMA_URL=${OLLAMA_URL:-http://ollama:11434}
- OLLAMA_MODEL=${OLLAMA_MODEL:-qwen2.5:7b}
- SECRET_KEY_BASE=${SECRET_KEY_BASE:?Set SECRET_KEY_BASE in .env (mix phx.gen.secret)}
- PHX_HOST=localhost
- PORT=4000
depends_on:
db:
condition: service_healthy
ml_service:
condition: service_healthy
profiles:
- full
restart: unless-stopped
# ===========================================================================
# Ollama (Optional - use profile: ollama)
# ===========================================================================
ollama:
image: ollama/ollama:latest
container_name: lincoln_ollama
ports:
- "11434:11434"
volumes:
- ollama_data:/root/.ollama
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:11434/api/tags"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
profiles:
- ollama
restart: unless-stopped
# ===========================================================================
# Volumes
# ===========================================================================
volumes:
postgres_data:
name: lincoln_postgres_data
postgres_test_data:
name: lincoln_postgres_test_data
ml_model_cache:
name: lincoln_ml_model_cache
searxng_data:
name: lincoln_searxng_data
ollama_data:
name: lincoln_ollama_data
# ===========================================================================
# Networks (optional, for isolation)
# ===========================================================================
networks:
default:
name: lincoln_network