-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
301 lines (280 loc) · 9.84 KB
/
docker-compose.yml
File metadata and controls
301 lines (280 loc) · 9.84 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
# ==============================================================================
# Thoth AI Research Assistant - Production Configuration
#
# IMPORTANT: Letta services are now INDEPENDENT!
# Start Letta first: docker compose -f docker-compose.letta.yml up -d
# Then start Thoth: docker compose up -d
#
# MICROSERVICES ARCHITECTURE:
# - Runs each service in separate containers
# - 5 containers: api, mcp, monitor, dashboard, discovery
# - Connects to external Letta services
# - Resource usage: ~4GB RAM
#
# ==============================================================================
# ==============================================================================
# Shared Configuration
# ==============================================================================
x-thoth-common: &thoth-common
# NOTE: Individual services override build config with service-specific Dockerfiles
# This common config is for shared runtime settings only
user: "${USER_ID:-1000}:${GROUP_ID:-1000}"
environment: &thoth-env
# Database connections (connects to external Letta postgres)
- DATABASE_URL=postgresql://thoth:thoth_password@letta-postgres:5432/thoth
# Vault-relative path configuration
- OBSIDIAN_VAULT_PATH=/vault
- THOTH_SETTINGS_FILE=/vault/thoth/_thoth/settings.json
# Operational settings
- THOTH_LOG_LEVEL=INFO
- THOTH_DOCKER=1
- DOCKER_ENV=true
- PYTHONPATH=/app/src
# Fix Letta filesystem permissions
- LETTA_LOG_FILE=/vault/thoth/_thoth/logs/letta.log
- HOME=/vault/thoth/_thoth
- THOTH_LOG_FILE=/vault/thoth/_thoth/logs/thoth.log
# API Keys
- API_MISTRAL_KEY=${API_MISTRAL_KEY:-}
- API_OPENROUTER_KEY=${API_OPENROUTER_KEY:-}
- API_OPENCITATIONS_KEY=${API_OPENCITATIONS_KEY:-}
- API_GOOGLE_KEY=${API_GOOGLE_KEY:-}
- API_SEMANTIC_SCHOLAR_KEY=${API_SEMANTIC_SCHOLAR_KEY:-}
- API_WEB_SEARCH_KEY=${API_WEB_SEARCH_KEY:-}
# Playwright browser path (fixed location, independent of HOME)
- PLAYWRIGHT_BROWSERS_PATH=/app/.cache/ms-playwright
# Discovery settings
- THOTH_DISCOVERY_AUTO_START_SCHEDULER=false
- THOTH_DISCOVERY_DEFAULT_MAX_ARTICLES=50
# Agent settings
- THOTH_RESEARCH_AGENT_MEMORY_ENABLED=true
- THOTH_AGENT_MAX_TOOL_CALLS=20
- THOTH_AGENT_TIMEOUT_SECONDS=300
# Multi-user mode (set THOTH_MULTI_USER=true to enable)
# When enabled, each user gets an isolated vault under THOTH_VAULTS_ROOT
# and all data is scoped by user_id in the database.
- THOTH_MULTI_USER=${THOTH_MULTI_USER:-false}
- THOTH_VAULTS_ROOT=${THOTH_VAULTS_ROOT:-/vaults}
- THOTH_ALLOW_REGISTRATION=${THOTH_ALLOW_REGISTRATION:-false}
volumes: &thoth-volumes
- ${OBSIDIAN_VAULT_PATH:?Please set OBSIDIAN_VAULT_PATH to your Obsidian vault root directory}:/vault:rw
- thoth-tmp-cache:/tmp/cache
- ./templates:/app/templates:ro
- thoth-app-home:/home/thoth
# Multi-user vault root: mounted only when THOTH_MULTI_USER=true.
# Set THOTH_VAULTS_ROOT on the host and it will be bind-mounted at /vaults.
# In single-user mode this mount is harmless (unused directory).
- ${THOTH_VAULTS_ROOT:-./vaults}:/vaults:rw
networks:
- thoth-network
- letta-network # Connect to external Letta network
restart: unless-stopped
services:
# ==============================================================================
# Thoth API Server
# Main REST API for frontend and external integrations
# ==============================================================================
thoth-api:
<<: *thoth-common
image: ghcr.io/acertainknight/project-thoth/api:latest
build:
context: .
dockerfile: docker/api/Dockerfile
target: production
pull_policy: always
container_name: thoth-api
command: ["python", "-m", "thoth", "server", "start", "--api-host", "0.0.0.0", "--api-port", "8000"]
ports:
- "8080:8000"
# NO DEPENDENCIES - connects to external Letta
healthcheck:
test: ["CMD", "python", "-c", "import requests; requests.get('http://localhost:8000/health', timeout=5)"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
deploy:
resources:
limits:
memory: 1G
cpus: '0.5'
reservations:
memory: 256M
cpus: '0.1'
# ==============================================================================
# Thoth MCP Server
# Model Context Protocol server for Claude integration
# ==============================================================================
thoth-mcp:
<<: *thoth-common
image: ghcr.io/acertainknight/project-thoth/mcp:latest
build:
context: .
dockerfile: docker/mcp/Dockerfile
target: production
pull_policy: always
container_name: thoth-mcp
# HTTP-only mode (includes /mcp POST and /sse streaming endpoints)
command: ["python", "-m", "thoth", "mcp", "http", "--host", "0.0.0.0", "--port", "8000"]
# NO DEPENDENCIES - connects to external Letta
environment:
# Base Thoth environment
- DATABASE_URL=postgresql://thoth:thoth_password@letta-postgres:5432/thoth
- OBSIDIAN_VAULT_PATH=/vault
- THOTH_SETTINGS_FILE=/vault/thoth/_thoth/settings.json
- THOTH_LOG_LEVEL=INFO
- THOTH_DOCKER=1
- DOCKER_ENV=true
- PYTHONPATH=/app/src
- LETTA_LOG_FILE=/vault/thoth/_thoth/logs/letta.log
- HOME=/vault/thoth/_thoth
- THOTH_LOG_FILE=/vault/thoth/_thoth/logs/thoth.log
# MCP-specific settings
- MCP_HOST=0.0.0.0
- MCP_HTTP_PORT=8000
- MCP_ENABLE_FILES=true
ports:
- "8082:8000" # HTTP transport (includes /mcp and /sse endpoints)
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
# networks inherited from thoth-common (thoth-network + letta-network)
deploy:
resources:
limits:
memory: 512M
cpus: '0.25'
reservations:
memory: 128M
cpus: '0.05'
# ==============================================================================
# Thoth PDF Monitor
# Watches vault directory for new PDFs and processes them automatically
# ==============================================================================
thoth-monitor:
<<: *thoth-common
image: ghcr.io/acertainknight/project-thoth/pdf-monitor:latest
build:
context: .
dockerfile: docker/pdf-monitor/Dockerfile
target: production
pull_policy: always
container_name: thoth-monitor
command: ["python", "-m", "thoth", "monitor", "--optimized", "--recursive", "--watch-dir", "/vault/thoth/papers"]
depends_on:
thoth-api:
condition: service_started
healthcheck:
test: ["CMD-SHELL", "kill -0 1"]
interval: 60s
timeout: 10s
retries: 3
start_period: 30s
deploy:
resources:
limits:
memory: 2G
cpus: '1.5'
reservations:
memory: 512M
cpus: '0.25'
# ==============================================================================
# Thoth Discovery Dashboard
# Automatically exports new discovery results and imports sentiment changes
# ==============================================================================
thoth-dashboard:
<<: *thoth-common
build:
context: .
dockerfile: Dockerfile
args:
SERVICE_EXTRAS: "service-dashboard"
container_name: thoth-dashboard
command: [
"python", "-m", "thoth", "research", "start-dashboard",
"--check-interval", "60"
]
depends_on:
thoth-api:
condition: service_started
healthcheck:
test: [
"CMD", "python", "-c",
"from pathlib import Path; import sys; sys.exit(0 if Path('/vault/Research/Dashboard').exists() else 1)"
]
interval: 60s
timeout: 10s
retries: 3
start_period: 30s
deploy:
resources:
limits:
memory: 512M
cpus: '0.25'
reservations:
memory: 128M
cpus: '0.05'
# ==============================================================================
# Thoth Discovery Scheduler
# Runs automated daily paper discovery searches for research questions
# ==============================================================================
thoth-discovery:
<<: *thoth-common
image: ghcr.io/acertainknight/project-thoth/discovery:latest
build:
context: .
dockerfile: docker/discovery/Dockerfile
target: production
pull_policy: always
container_name: thoth-discovery
command: [
"python", "-m", "thoth", "research", "scheduler"
]
depends_on:
thoth-api:
condition: service_started
healthcheck:
test: [
"CMD", "python", "-c",
"from thoth.services.discovery_scheduler import ResearchQuestionScheduler; import sys; sys.exit(0)"
]
interval: 60s
timeout: 10s
retries: 3
start_period: 30s
deploy:
resources:
limits:
memory: 512M
cpus: '0.25'
reservations:
memory: 128M
cpus: '0.05'
# ==============================================================================
# Persistent Volumes
# ==============================================================================
volumes:
# Thoth-specific volumes
thoth-app-home:
driver: local
name: thoth-app-home
thoth-tmp-cache:
driver: local
name: thoth-tmp-cache
# ==============================================================================
# Networks
# ==============================================================================
networks:
thoth-network:
driver: bridge
name: thoth-network
ipam:
config:
- subnet: 172.20.0.0/16
# External Letta network - must be created by docker-compose.letta.yml
letta-network:
external: true
name: letta-network