-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yaml
More file actions
231 lines (221 loc) · 8.33 KB
/
Copy pathcompose.yaml
File metadata and controls
231 lines (221 loc) · 8.33 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
name: madosho
services:
postgres:
image: postgres:17
environment:
POSTGRES_USER: madosho
POSTGRES_PASSWORD: madosho # dev only
POSTGRES_DB: madosho
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U madosho -d madosho"]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
qdrant:
image: qdrant/qdrant:latest # pin a concrete tag in production
volumes:
- qdrant_storage:/qdrant/storage
healthcheck:
# Qdrant images ship no curl/wget; probe the HTTP port with bash /dev/tcp
test: ["CMD-SHELL", "bash -c ':> /dev/tcp/127.0.0.1/6333' || exit 1"]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
init:
build:
context: .
dockerfile: Dockerfile
image: madosho:local # built once here; app + worker reuse it
command: ["madosho-init"]
environment:
DATABASE_URL: postgresql+psycopg://madosho:madosho@postgres:5432/madosho
QDRANT_URL: http://qdrant:6333
# Headless first-admin: if both are set in .env and no active admin exists,
# the init one-shot seeds one. Idempotent; safe to leave configured.
MADOSHO_BOOTSTRAP_ADMIN_USER: ${MADOSHO_BOOTSTRAP_ADMIN_USER:-}
MADOSHO_BOOTSTRAP_ADMIN_PASSWORD: ${MADOSHO_BOOTSTRAP_ADMIN_PASSWORD:-}
depends_on:
postgres:
condition: service_healthy
qdrant:
condition: service_healthy
restart: "no"
app:
image: madosho:local
command: ["madosho-server"]
ports:
- "8000:8000"
environment:
DATABASE_URL: postgresql+psycopg://madosho:madosho@postgres:5432/madosho
QDRANT_URL: http://qdrant:6333
FILESTORE_DIR: /data/filestore
CORPORA_DIR: /data/corpora
KB_DIR: /data/kbs
HF_HOME: /models
# Index-time LLM (contextual chunker) + shared LLM creds. Seeds the
# llm_endpoint registry on first boot; blank leaves the registry empty.
MADOSHO_INDEX_LLM_PROVIDER: ${MADOSHO_INDEX_LLM_PROVIDER:-}
MADOSHO_INDEX_LLM_MODEL: ${MADOSHO_INDEX_LLM_MODEL:-}
MADOSHO_LLM_API_KEY: ${MADOSHO_LLM_API_KEY:-}
MADOSHO_LLM_API_BASE: ${MADOSHO_LLM_API_BASE:-}
# Auth config (read by both the control and query planes). SESSION_SECRET
# MUST match query's so a cookie minted here validates there; unset falls
# back to a per-process random value (sessions die on restart / across
# replicas). AUTH_ENABLED defaults on. COOKIE_INSECURE=1 only for non-TLS dev.
MADOSHO_AUTH_ENABLED: ${MADOSHO_AUTH_ENABLED:-}
MADOSHO_SESSION_SECRET: ${MADOSHO_SESSION_SECRET:-}
MADOSHO_COOKIE_INSECURE: ${MADOSHO_COOKIE_INSECURE:-}
# Control plane forwards KB semantic search here (query plane owns the embedder).
MADOSHO_QUERY_URL: http://query:8001
volumes:
- filestore:/data/filestore
- corpora:/data/corpora
- kbs:/data/kbs
- hf_cache:/models
depends_on:
init:
condition: service_completed_successfully
postgres:
condition: service_healthy
qdrant:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "python -c \"import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8000/health').status==200 else 1)\""]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
query:
image: madosho:local
command: ["madosho-query"]
ports:
- "8001:8001"
environment:
DATABASE_URL: postgresql+psycopg://madosho:madosho@postgres:5432/madosho
QDRANT_URL: http://qdrant:6333
FILESTORE_DIR: /data/filestore # required by Settings; query plane never reads it (filestore volume intentionally not mounted)
CORPORA_DIR: /data/corpora
HF_HOME: /models
# Pluggable provider (no default). Set these in the shell/.env to enable
# the answer/proxy path; blank keeps retrieval-only /query working.
MADOSHO_INDEX_LLM_PROVIDER: ${MADOSHO_INDEX_LLM_PROVIDER:-}
MADOSHO_INDEX_LLM_MODEL: ${MADOSHO_INDEX_LLM_MODEL:-}
MADOSHO_LLM_API_KEY: ${MADOSHO_LLM_API_KEY:-}
MADOSHO_LLM_API_BASE: ${MADOSHO_LLM_API_BASE:-}
# Must match app's auth config: the query plane validates the SAME session
# cookie, so SESSION_SECRET has to be identical (.env provides one value to both).
MADOSHO_AUTH_ENABLED: ${MADOSHO_AUTH_ENABLED:-}
MADOSHO_SESSION_SECRET: ${MADOSHO_SESSION_SECRET:-}
MADOSHO_COOKIE_INSECURE: ${MADOSHO_COOKIE_INSECURE:-}
volumes:
- corpora:/data/corpora
- kbs:/data/kbs # KB pages: query plane reads them for KB semantic search
- hf_cache:/models
depends_on:
init:
condition: service_completed_successfully
postgres:
condition: service_healthy
qdrant:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "python -c \"import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8001/health').status==200 else 1)\""]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
toolserver:
image: madosho:local
command: ["madosho-toolserver"]
ports:
- "8088:8088"
environment:
# Pure HTTP client - reaches the planes by service name (same vars the CLI reads).
MADOSHO_CONTROL_URL: http://app:8000
MADOSHO_QUERY_URL: http://query:8001
depends_on:
app:
condition: service_healthy
query:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "python -c \"import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8088/health').status==200 else 1)\""]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
worker:
image: madosho:local
command: ["madosho-worker"]
environment:
DATABASE_URL: postgresql+psycopg://madosho:madosho@postgres:5432/madosho
QDRANT_URL: http://qdrant:6333
FILESTORE_DIR: /data/filestore
CORPORA_DIR: /data/corpora
HF_HOME: /models
# The research worker spawns `python -m madosho_cli`, which reads these to
# reach the running planes; and builds the agent LLM endpoint from the creds.
MADOSHO_CONTROL_URL: http://app:8000
MADOSHO_QUERY_URL: http://query:8001
MADOSHO_LLM_API_KEY: ${MADOSHO_LLM_API_KEY:-}
MADOSHO_LLM_API_BASE: ${MADOSHO_LLM_API_BASE:-}
# The worker is a server-side service that calls the gated planes via
# madosho_cli; it carries a service key (MADOSHO_AUTH_ENABLED defaults on).
MADOSHO_API_KEY: ${MADOSHO_API_KEY:-}
volumes:
- filestore:/data/filestore # SAME volume as app: worker reads uploaded files
- corpora:/data/corpora
- kbs:/data/kbs # KB pages: worker embeds them for semantic search
- hf_cache:/models
depends_on:
init:
condition: service_completed_successfully
postgres:
condition: service_healthy
qdrant:
condition: service_healthy
ui:
build:
context: ./frontend
dockerfile: Dockerfile
image: madosho-ui:local
ports:
- "8080:8080"
depends_on:
app:
condition: service_healthy
query:
condition: service_healthy
open-webui:
image: ghcr.io/open-webui/open-webui:main
profiles: ["frontend"] # opt-in: `docker compose --profile frontend up`
ports:
- "3000:8080"
environment:
# Mode A (OWUI -> query :8001/v1): OWUI's connection key must be a madosho key.
# Auth is enforced upstream (MADOSHO_AUTH_ENABLED defaults on). Set
# MADOSHO_API_KEY in the shell or .env before bringing the stack up.
OPENAI_API_BASE_URL: http://query:8001/v1
OPENAI_API_KEY: ${MADOSHO_API_KEY:-}
# Mode B (OWUI -> toolserver :8088): set the bearer key in the OWUI UI under
# Admin Settings > Tools when registering the tool server URL. The tool server
# forwards that bearer to the backend planes - no compose env var is needed here.
# See examples/chat-frontends/README.md for the full Mode B walkthrough.
WEBUI_AUTH: "false" # demo-only, trusted-network (umbrella decision 4)
volumes:
- open_webui:/app/backend/data
depends_on:
query:
condition: service_healthy
volumes:
pgdata:
qdrant_storage:
filestore:
corpora:
kbs:
hf_cache:
open_webui: