-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
245 lines (237 loc) · 8.32 KB
/
Copy pathdocker-compose.yaml
File metadata and controls
245 lines (237 loc) · 8.32 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
# CAAL Voice Framework - Docker Compose Stack
# ============================================
#
# Quick Start:
# 1. cp .env.example .env && nano .env # Set CAAL_HOST_IP
# 2. docker compose up -d
# 3. Access: https://<CAAL_HOST_IP>:3443
#
# HTTPS is enabled by default with auto-generated self-signed certificates.
#
# See .env.example for configuration options.
services:
# ===========================================================================
# LiveKit Server - WebRTC Infrastructure
# ===========================================================================
# Auto-detects mode: if HTTPS_DOMAIN is set, enables TURN/TLS
livekit:
image: livekit/livekit-server:latest
container_name: caal-livekit
entrypoint: ["/bin/sh", "-c"]
command:
- |
if [ -n "$${HTTPS_DOMAIN}" ]; then
echo "HTTPS mode: enabling TURN/TLS for $${HTTPS_DOMAIN}"
apk add --no-cache gettext > /dev/null 2>&1
envsubst < /etc/livekit.yaml.template > /etc/livekit.yaml
else
echo "LAN mode: using basic config"
cp /etc/livekit-lan.yaml /etc/livekit.yaml
fi
exec /livekit-server --config /etc/livekit.yaml --node-ip $${CAAL_HOST_IP}
ports:
- "7880:7880" # WebSocket
- "7881:7881" # TCP for WebRTC
- "7881:7881/udp" # UDP for WebRTC
- "${TURN_TLS_PORT:-443}:${TURN_TLS_PORT:-443}" # TURN/TLS (only used in Tailscale mode)
- "3478:3478/udp" # TURN/UDP (only used in Tailscale mode)
- "30000-30100:30000-30100/udp" # TURN relay ports
- "51000-51100:51000-51100/udp" # WebRTC media ports (changed from 50000 to avoid Chrome conflicts)
volumes:
- ./livekit.yaml:/etc/livekit-lan.yaml:ro
- ./livekit-tailscale.yaml.template:/etc/livekit.yaml.template:ro
- ./certs:/etc/livekit/certs:ro
environment:
- HTTPS_DOMAIN=${HTTPS_DOMAIN:-}
- CAAL_HOST_IP=${CAAL_HOST_IP}
- TURN_TLS_PORT=${TURN_TLS_PORT:-443}
networks:
- caal-network
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:7880"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
# ===========================================================================
# CAAL Agent - Voice Processing Pipeline
# ===========================================================================
agent:
build:
context: .
dockerfile: Dockerfile
labels:
org.opencontainers.image.source: https://github.com/CoreWorxLab/caal
org.opencontainers.image.description: CAAL Voice Assistant Agent
container_name: caal-agent
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
- "8889:8889" # Webhook server for announcements and tool reload
env_file:
- ./.env
environment:
- LIVEKIT_URL=ws://livekit:7880
- SPEACHES_URL=http://speaches:8000
- KOKORO_URL=http://kokoro:8880
- CAAL_MEMORY_DIR=/app/data
volumes:
- caal-memory:/app/data
- caal-config:/app/config # Runtime config (settings.json, mcp_servers.json)
- ./prompt:/app/prompt # Prompt files (custom.md is gitignored)
networks:
- caal-network
depends_on:
livekit:
condition: service_healthy
speaches:
condition: service_healthy
kokoro:
condition: service_healthy
restart: unless-stopped
# ===========================================================================
# Speaches - STT (Faster-Whisper)
# ===========================================================================
speaches:
image: ghcr.io/speaches-ai/speaches:latest-cuda-12.6.3
container_name: caal-speaches
ports:
- "${SPEACHES_PORT:-8000}:8000"
volumes:
- speaches-cache:/home/ubuntu/.cache/huggingface
deploy:
resources:
reservations:
devices:
- driver: nvidia
device_ids: ['${SPEACHES_GPU_ID:-0}']
capabilities: [gpu]
restart: unless-stopped
networks:
- caal-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 10s
timeout: 5s
retries: 3
start_period: 60s
# ===========================================================================
# Kokoro - TTS (remsky/kokoro-fastapi)
# ===========================================================================
# Using v0.2.4-master for RTX 50 series (Blackwell/sm_120) GPU support
# See: https://github.com/remsky/Kokoro-FastAPI/releases/tag/v0.2.4-master
kokoro:
image: ghcr.io/remsky/kokoro-fastapi-gpu:v0.2.4-master
container_name: caal-kokoro
ports:
- "${KOKORO_PORT:-8880}:8880"
volumes:
- kokoro-cache:/root/.cache
deploy:
resources:
reservations:
devices:
- driver: nvidia
device_ids: ['${KOKORO_GPU_ID:-0}']
capabilities: [gpu]
restart: unless-stopped
networks:
- caal-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8880/health"]
interval: 10s
timeout: 5s
retries: 3
start_period: 60s
# ===========================================================================
# Frontend - Next.js Web Interface
# ===========================================================================
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
labels:
org.opencontainers.image.source: https://github.com/CoreWorxLab/caal
org.opencontainers.image.description: CAAL Voice Assistant Frontend
args:
- NEXT_PUBLIC_LIVEKIT_URL=wss://${HTTPS_DOMAIN:-${CAAL_HOST_IP}}:7443
- NEXT_PUBLIC_PORCUPINE_ACCESS_KEY=${PORCUPINE_ACCESS_KEY:-}
container_name: caal-frontend
ports:
- "3000:3000"
environment:
- LIVEKIT_URL=ws://livekit:7880
- LIVEKIT_API_KEY=${LIVEKIT_API_KEY:-devkey}
- LIVEKIT_API_SECRET=${LIVEKIT_API_SECRET:-secret}
- NEXT_PUBLIC_LIVEKIT_URL=wss://${HTTPS_DOMAIN:-${CAAL_HOST_IP}}:7443
- WEBHOOK_URL=http://agent:8889
networks:
- caal-network
depends_on:
livekit:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1:3000"]
interval: 10s
timeout: 5s
retries: 3
start_period: 30s
# ===========================================================================
# nginx - HTTPS Reverse Proxy (auto-generates self-signed certs if missing)
# ===========================================================================
nginx:
image: nginx:alpine
container_name: caal-nginx
entrypoint: ["/bin/sh", "-c"]
command:
- |
# Generate self-signed cert if none exists
if [ ! -f /etc/nginx/certs/server.crt ]; then
echo "No certificate found, generating self-signed cert..."
mkdir -p /etc/nginx/certs
apk add --no-cache openssl > /dev/null 2>&1
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /etc/nginx/certs/server.key \
-out /etc/nginx/certs/server.crt \
-subj "/CN=$${CAAL_HOST_IP:-localhost}" \
-addext "subjectAltName=DNS:localhost,IP:$${CAAL_HOST_IP:-127.0.0.1},IP:127.0.0.1" 2>/dev/null
echo "Self-signed certificate generated for $${CAAL_HOST_IP:-localhost}"
else
echo "Using existing certificate"
fi
exec nginx -g "daemon off;"
ports:
- "3443:3443"
- "7443:7443"
environment:
- CAAL_HOST_IP=${CAAL_HOST_IP}
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./certs:/etc/nginx/certs
networks:
- caal-network
depends_on:
- frontend
- livekit
restart: unless-stopped
# =============================================================================
# Networks
# =============================================================================
networks:
caal-network:
name: caal-network
driver: bridge
# =============================================================================
# Volumes
# =============================================================================
volumes:
caal-memory:
name: caal-memory
caal-config:
name: caal-config
speaches-cache:
name: caal-speaches-cache
kokoro-cache:
name: caal-kokoro-cache