Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
234 lines (222 loc) · 10.6 KB
/
Copy pathdocker-compose.yml
File metadata and controls
234 lines (222 loc) · 10.6 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
# Secrets come from .env, generated once by `./scripts/init.sh` — the repo
# ships none. A missing variable fails compose with the hint below instead
# of silently running on credentials the whole internet can read.
services:
livekit:
image: livekit/livekit-server
command: --config /etc/livekit.yaml --bind 0.0.0.0 --node-ip 127.0.0.1
volumes:
- ./livekit.yaml:/etc/livekit.yaml # generated by scripts/init.sh
ports:
- "7880:7880" # signalling (HTTP / WebSocket)
- "7881:7881" # TCP fallback for media
- "50000-50100:50000-50100/udp" # media — keep this range SMALL
postgres:
image: postgres:16
environment:
POSTGRES_USER: arya
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?missing — run ./scripts/init.sh first}
POSTGRES_DB: arya
volumes:
- pg-data:/var/lib/postgresql/data
ports:
- "5432:5432"
qdrant:
image: qdrant/qdrant
ports:
- "6333:6333" # REST + web dashboard (/dashboard)
volumes:
- qdrant-data:/qdrant/storage
seaweedfs:
image: chrislusf/seaweedfs
command: server -s3 -dir=/data -s3.config=/etc/seaweedfs/s3.json
ports:
- "8333:8333" # S3 gateway
- "8888:8888" # filer web UI (browse uploaded docs)
volumes:
- seaweed-data:/data
- ./seaweedfs-s3.json:/etc/seaweedfs/s3.json:ro # generated by scripts/init.sh
ollama:
image: ollama/ollama
ports:
- "11434:11434"
environment:
# Never evict idle models: the default 5m eviction made the first
# RAG query after an idle period reload nomic (~1 min on CPU) and
# blow the 1.5s in-call retrieval budget. The model is 274 MB.
OLLAMA_KEEP_ALIVE: "-1"
volumes:
- ollama-data:/root/.ollama
# One-shot: pull the local models into the ollama volume — embeddings
# (nomic, for RAG) and the open-source chat model (for the "local"
# provider). Already-pulled models are skipped instantly.
ollama-init:
image: ollama/ollama
depends_on:
- ollama
environment:
OLLAMA_HOST: http://ollama:11434
# The trailing `run` loads the chat model into RAM with no client
# timeout (a cold 2B load takes ~20-60s on CPU — longer than API
# clients wait); OLLAMA_KEEP_ALIVE=-1 then keeps it resident.
# Keep this tag in sync with catalog.py local_defaults.llm_model.
entrypoint: ["/bin/sh", "-c", "sleep 3 && ollama pull nomic-embed-text && ollama pull qwen3.5:2b && ollama run qwen3.5:2b 'Reply with exactly: ok'"]
restart: "no"
# Local Whisper STT + Kokoro TTS (faster-whisper + Kokoro, both behind
# Speaches' single OpenAI-compatible API) — the ears AND voice of the
# open-source provider. Container port 8000 is remapped to 8010 because
# the Arya API owns 8000. One container instead of two dedicated
# ones (the old setup ran a separate ~5 GB Kokoro-FastAPI image) — same
# Kokoro voices, and a newer Kokoro build (v1.0 vs v0.9.4) as a bonus.
speaches:
image: ghcr.io/speaches-ai/speaches:latest-cpu
ports:
- "8010:8000"
environment:
# Never evict idle models: the same pathology as Ollama's default 5m
# eviction (see the ollama service below) — an idle-then-cold TTS or
# STT model would stall the first reply of the next call by tens of
# seconds. -1 keeps whatever's been used resident indefinitely.
STT_MODEL_TTL: "-1"
TTS_MODEL_TTL: "-1"
volumes:
- hf-hub-cache:/home/ubuntu/.cache/huggingface/hub
# One-shot: pre-download the Whisper STT model and the Kokoro TTS model
# so the first local call doesn't stall on a multi-hundred-MB download.
# Best-effort — if the endpoint shape changes, each model simply
# downloads on first use instead.
speaches-init:
image: curlimages/curl
depends_on:
- speaches
entrypoint: ["/bin/sh", "-c", "sleep 10; curl -sf -X POST http://speaches:8000/v1/models/Systran/faster-whisper-base || true; curl -sf -X POST http://speaches:8000/v1/models/speaches-ai/Kokoro-82M-v1.0-ONNX || true"]
restart: "no"
# FastAPI backend + built frontend, one port: http://localhost:8000
api:
build: .
command: ["uv", "run", "uvicorn", "api:app", "--app-dir", "src", "--host", "0.0.0.0", "--port", "8000"]
ports:
- "8000:8000"
environment:
LIVEKIT_URL: ${LIVEKIT_URL:-ws://localhost:7880} # returned to the BROWSER — must be reachable from it
LIVEKIT_INTERNAL_URL: http://livekit:7880 # used by the API for server-to-server calls
ARYA_AGENT_NAME: arya # explicit-dispatch name; must match agent-worker
ARYA_RUNTIME_ONLY: ${ARYA_RUNTIME_ONLY:-} # engine-only mode (see docs/DEPLOYMENT.md)
ARYA_ADMIN_TOKEN: ${ARYA_ADMIN_TOKEN:-} # locks the admin API when set
PUBLIC_BASE_URL: ${PUBLIC_BASE_URL:-} # generates share links/snippets
ARYA_WEBHOOK_BASE_URL: ${ARYA_WEBHOOK_BASE_URL:-} # public origin that reaches arya-whatsapp (tunnel or proxy)
ARYA_VISITOR_SECRET: ${ARYA_VISITOR_SECRET:-} # signs widget visitor tokens; empty = derived from the LiveKit secret
ARYA_BRIDGE_TOKEN: ${ARYA_BRIDGE_TOKEN:-} # must match arya-whatsapp; empty = derived from the LiveKit secret on both
LIVEKIT_API_KEY: ${LIVEKIT_API_KEY:?missing — run ./scripts/init.sh first}
LIVEKIT_API_SECRET: ${LIVEKIT_API_SECRET:?missing — run ./scripts/init.sh first}
DATABASE_URL: postgresql://arya:${POSTGRES_PASSWORD}@postgres:5432/arya
QDRANT_URL: http://qdrant:6333
OLLAMA_URL: http://ollama:11434
EMBEDDINGS_URL: http://ollama:11434 # RAG embeddings stay on the bundled Ollama even if OLLAMA_URL is repointed
ARYA_MCP_URL: http://arya-mcp:8020 # Arya's own MCP servers (sidecar connectors)
S3_ENDPOINT: seaweedfs:8333
S3_ACCESS_KEY: ${S3_ACCESS_KEY:?missing — run ./scripts/init.sh first}
S3_SECRET_KEY: ${S3_SECRET_KEY:?missing — run ./scripts/init.sh first}
S3_BUCKET: arya-docs
volumes:
- ./backend/data:/app/backend/data # active-agent.json + keys.json, shared with the worker
depends_on:
- postgres
- qdrant
- seaweedfs
- livekit
# Arya's own MCP servers (src/mcp_server.py): the connectors for systems
# nobody hosts an MCP server for, starting with the business owner's own
# read-only Postgres. Same image as api/agent-worker, so it adds no
# download and ~40 MB of RAM.
#
# Published on 127.0.0.1 ONLY, and deliberately not on the compose network
# alone: agent-worker runs with network_mode: host and reaches it over
# localhost. That is safe because this service stores no credentials at
# all: every request carries the connection string it should use (see the
# module docstring), so it can only reach what the caller could already
# reach directly.
#
# api and agent-worker have NO depends_on to it, same rule as ollama and
# speaches: a user with no external database can start the stack without
# it and every connector of another type keeps working.
arya-mcp:
build: .
command: ["uv", "run", "python", "src/mcp_server.py"]
ports:
- "127.0.0.1:8020:8020"
environment:
ARYA_MCP_PORT: "8020"
# WhatsApp channel bridge: Meta's webhook in, a LiveKit room out. Same
# image as api/agent-worker.
#
# network_mode: host for exactly the agent-worker reason below: it joins
# rooms as a participant, so it needs the media path to look the way it
# does from the host. That also means it reaches postgres and the API
# over localhost rather than by service name.
#
# Published on 127.0.0.1 only. Meta must reach /webhooks/whatsapp from
# the internet, so put a tunnel (development) or the reverse proxy that
# already fronts the API (production) in front of this port and set
# ARYA_WEBHOOK_BASE_URL on the api service to that public origin.
#
# No depends_on from api or agent-worker: an installation with no
# WhatsApp number runs the whole stack without this container.
arya-whatsapp:
build: .
command: ["uv", "run", "python", "src/whatsapp_bridge.py"]
network_mode: host
environment:
ARYA_WHATSAPP_PORT: "8030"
ARYA_API_URL: http://localhost:8000
LIVEKIT_URL: ws://localhost:7880
# The bridge token lets session requests name the WhatsApp customer.
# LIVEKIT_API_SECRET is here only for the fallback derivation when
# ARYA_BRIDGE_TOKEN is empty (an install that rebuilt without
# re-running init.sh); both sides derive the same value from it.
ARYA_BRIDGE_TOKEN: ${ARYA_BRIDGE_TOKEN:-}
LIVEKIT_API_SECRET: ${LIVEKIT_API_SECRET:?missing — run ./scripts/init.sh first}
DATABASE_URL: postgresql://arya:${POSTGRES_PASSWORD}@localhost:5432/arya
volumes:
- ./backend/data:/app/backend/data
depends_on:
- postgres
- livekit
# LiveKit agent worker. network_mode: host so the worker reaches the media
# ports exactly like a process on the host — livekit runs with
# --node-ip 127.0.0.1, so a bridge-network worker would receive ICE
# candidates pointing at its own loopback and audio would silently fail.
# Requires "host networking" enabled in Docker Desktop settings (4.34+).
# Fallback (see README): run the worker on the host with
# cd backend && uv run python src/agent.py dev
agent-worker:
build: .
command: ["uv", "run", "python", "src/agent.py", "start"]
network_mode: host
environment:
LIVEKIT_URL: ws://localhost:7880
ARYA_AGENT_NAME: arya # must match the api service
LIVEKIT_API_KEY: ${LIVEKIT_API_KEY:?missing — run ./scripts/init.sh first}
LIVEKIT_API_SECRET: ${LIVEKIT_API_SECRET:?missing — run ./scripts/init.sh first}
DATABASE_URL: postgresql://arya:${POSTGRES_PASSWORD}@localhost:5432/arya
# The demo shop behind the order desk (demo/shop). Empty keeps the
# built-in fake desk; scripts/seed_demo_shop.sh prints the value.
ARYA_SHOP_DSN: ${ARYA_SHOP_DSN:-}
QDRANT_URL: http://localhost:6333
OLLAMA_URL: http://localhost:11434
EMBEDDINGS_URL: http://localhost:11434 # RAG embeddings stay on the bundled Ollama even if OLLAMA_URL is repointed
SPEACHES_URL: http://localhost:8010
OPENAI_STT_REALTIME: ${OPENAI_STT_REALTIME:-1} # 0 = batch transcription on the openai provider (see providers.py)
ARYA_MCP_URL: http://localhost:8020 # host networking: the sidecar's published loopback port
volumes:
- ./backend/data:/app/backend/data
depends_on:
- livekit
- postgres
- qdrant
volumes:
pg-data:
qdrant-data:
seaweed-data:
ollama-data:
hf-hub-cache: