Skip to content

Commit f8372d7

Browse files
Merge pull request #199 from chronicler-ai/fix/openmemory-cache
Fix deepgram/parakeet workers bug
2 parents 4178235 + 5e2220b commit f8372d7

7 files changed

Lines changed: 60 additions & 84 deletions

File tree

backends/advanced/Caddyfile.template

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ localhost TAILSCALE_IP {
1919

2020
# WebSocket endpoints - proxy to backend with upgrade support
2121
handle /ws* {
22-
reverse_proxy friend-backend:8000 {
22+
reverse_proxy chronicle-backend:8000 {
2323
# Caddy automatically handles WebSocket upgrades
2424
header_up X-Real-IP {remote_host}
2525
header_up X-Forwarded-For {remote_host}
@@ -29,31 +29,31 @@ localhost TAILSCALE_IP {
2929

3030
# API endpoints - proxy to backend
3131
handle /api/* {
32-
reverse_proxy friend-backend:8000
32+
reverse_proxy chronicle-backend:8000
3333
}
3434

3535
# Auth endpoints - proxy to backend
3636
handle /auth/* {
37-
reverse_proxy friend-backend:8000
37+
reverse_proxy chronicle-backend:8000
3838
}
3939

4040
# Health checks - proxy to backend
4141
handle /health {
42-
reverse_proxy friend-backend:8000
42+
reverse_proxy chronicle-backend:8000
4343
}
4444

4545
handle /readiness {
46-
reverse_proxy friend-backend:8000
46+
reverse_proxy chronicle-backend:8000
4747
}
4848

4949
# Users endpoints - proxy to backend
5050
handle /users/* {
51-
reverse_proxy friend-backend:8000
51+
reverse_proxy chronicle-backend:8000
5252
}
5353

5454
# Audio files - proxy to backend
5555
handle /audio/* {
56-
reverse_proxy friend-backend:8000
56+
reverse_proxy chronicle-backend:8000
5757
}
5858

5959
# Everything else - proxy to webui
@@ -68,36 +68,36 @@ localhost TAILSCALE_IP {
6868
#
6969
# # WebSocket endpoints
7070
# handle /ws* {
71-
# reverse_proxy friend-backend:8000
71+
# reverse_proxy chronicle-backend:8000
7272
# }
7373
#
7474
# # API endpoints
7575
# handle /api/* {
76-
# reverse_proxy friend-backend:8000
76+
# reverse_proxy chronicle-backend:8000
7777
# }
7878
#
7979
# # Auth endpoints
8080
# handle /auth/* {
81-
# reverse_proxy friend-backend:8000
81+
# reverse_proxy chronicle-backend:8000
8282
# }
8383
#
8484
# # Health checks
8585
# handle /health {
86-
# reverse_proxy friend-backend:8000
86+
# reverse_proxy chronicle-backend:8000
8787
# }
8888
#
8989
# handle /readiness {
90-
# reverse_proxy friend-backend:8000
90+
# reverse_proxy chronicle-backend:8000
9191
# }
9292
#
9393
# # Users endpoints
9494
# handle /users/* {
95-
# reverse_proxy friend-backend:8000
95+
# reverse_proxy chronicle-backend:8000
9696
# }
9797
#
9898
# # Audio files
9999
# handle /audio/* {
100-
# reverse_proxy friend-backend:8000
100+
# reverse_proxy chronicle-backend:8000
101101
# }
102102
#
103103
# # Everything else - webui

backends/advanced/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ services:
226226
# Shared network for cross-project communication
227227
networks:
228228
default:
229-
name: friend-network
229+
name: chronicle-network
230230

231231
volumes:
232232
ollama_data:

backends/advanced/start-workers.sh

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,26 @@ start_workers() {
5151
uv run python -m advanced_omi_backend.workers.rq_worker_entry audio &
5252
AUDIO_PERSISTENCE_WORKER_PID=$!
5353

54-
echo "🎵 Starting audio stream Deepgram worker (1 worker for sequential processing)..."
55-
uv run python -m advanced_omi_backend.workers.audio_stream_deepgram_worker &
56-
AUDIO_STREAM_WORKER_PID=$!
54+
# Start stream workers based on available configuration
55+
# Only start Deepgram worker if DEEPGRAM_API_KEY is set
56+
if [ -n "$DEEPGRAM_API_KEY" ]; then
57+
echo "🎵 Starting audio stream Deepgram worker (1 worker for sequential processing)..."
58+
uv run python -m advanced_omi_backend.workers.audio_stream_deepgram_worker &
59+
AUDIO_STREAM_DEEPGRAM_WORKER_PID=$!
60+
else
61+
echo "⏭️ Skipping Deepgram stream worker (DEEPGRAM_API_KEY not set)"
62+
AUDIO_STREAM_DEEPGRAM_WORKER_PID=""
63+
fi
64+
65+
# Only start Parakeet worker if PARAKEET_ASR_URL or OFFLINE_ASR_TCP_URI is set
66+
if [ -n "$PARAKEET_ASR_URL" ] || [ -n "$OFFLINE_ASR_TCP_URI" ]; then
67+
echo "🎵 Starting audio stream Parakeet worker (1 worker for sequential processing)..."
68+
uv run python -m advanced_omi_backend.workers.audio_stream_parakeet_worker &
69+
AUDIO_STREAM_PARAKEET_WORKER_PID=$!
70+
else
71+
echo "⏭️ Skipping Parakeet stream worker (PARAKEET_ASR_URL/OFFLINE_ASR_TCP_URI not set)"
72+
AUDIO_STREAM_PARAKEET_WORKER_PID=""
73+
fi
5774

5875
echo "✅ All workers started:"
5976
echo " - RQ worker 1: PID $RQ_WORKER_1_PID (transcription, memory, default)"
@@ -63,7 +80,8 @@ start_workers() {
6380
echo " - RQ worker 5: PID $RQ_WORKER_5_PID (transcription, memory, default)"
6481
echo " - RQ worker 6: PID $RQ_WORKER_6_PID (transcription, memory, default)"
6582
echo " - Audio persistence worker: PID $AUDIO_PERSISTENCE_WORKER_PID (audio queue - file rotation)"
66-
echo " - Audio stream worker: PID $AUDIO_STREAM_WORKER_PID (Redis Streams consumer - sequential processing)"
83+
[ -n "$AUDIO_STREAM_DEEPGRAM_WORKER_PID" ] && echo " - Deepgram stream worker: PID $AUDIO_STREAM_DEEPGRAM_WORKER_PID (real-time transcription)"
84+
[ -n "$AUDIO_STREAM_PARAKEET_WORKER_PID" ] && echo " - Parakeet stream worker: PID $AUDIO_STREAM_PARAKEET_WORKER_PID (real-time transcription)"
6785
}
6886

6987
# Function to check worker registration health
@@ -103,7 +121,9 @@ monitor_worker_health() {
103121
echo "🔧 Self-healing: Restarting all workers to restore registration..."
104122

105123
# Kill all workers
106-
kill $RQ_WORKER_1_PID $RQ_WORKER_2_PID $RQ_WORKER_3_PID $RQ_WORKER_4_PID $RQ_WORKER_5_PID $RQ_WORKER_6_PID $AUDIO_PERSISTENCE_WORKER_PID $AUDIO_STREAM_WORKER_PID 2>/dev/null || true
124+
kill $RQ_WORKER_1_PID $RQ_WORKER_2_PID $RQ_WORKER_3_PID $RQ_WORKER_4_PID $RQ_WORKER_5_PID $RQ_WORKER_6_PID $AUDIO_PERSISTENCE_WORKER_PID 2>/dev/null || true
125+
[ -n "$AUDIO_STREAM_DEEPGRAM_WORKER_PID" ] && kill $AUDIO_STREAM_DEEPGRAM_WORKER_PID 2>/dev/null || true
126+
[ -n "$AUDIO_STREAM_PARAKEET_WORKER_PID" ] && kill $AUDIO_STREAM_PARAKEET_WORKER_PID 2>/dev/null || true
107127
wait 2>/dev/null || true
108128

109129
# Restart workers
@@ -128,7 +148,8 @@ shutdown() {
128148
kill $RQ_WORKER_5_PID 2>/dev/null || true
129149
kill $RQ_WORKER_6_PID 2>/dev/null || true
130150
kill $AUDIO_PERSISTENCE_WORKER_PID 2>/dev/null || true
131-
kill $AUDIO_STREAM_WORKER_PID 2>/dev/null || true
151+
[ -n "$AUDIO_STREAM_DEEPGRAM_WORKER_PID" ] && kill $AUDIO_STREAM_DEEPGRAM_WORKER_PID 2>/dev/null || true
152+
[ -n "$AUDIO_STREAM_PARAKEET_WORKER_PID" ] && kill $AUDIO_STREAM_PARAKEET_WORKER_PID 2>/dev/null || true
132153
wait
133154
echo "✅ All workers stopped"
134155
exit 0
@@ -161,7 +182,8 @@ kill $RQ_WORKER_4_PID 2>/dev/null || true
161182
kill $RQ_WORKER_5_PID 2>/dev/null || true
162183
kill $RQ_WORKER_6_PID 2>/dev/null || true
163184
kill $AUDIO_PERSISTENCE_WORKER_PID 2>/dev/null || true
164-
kill $AUDIO_STREAM_WORKER_PID 2>/dev/null || true
185+
[ -n "$AUDIO_STREAM_DEEPGRAM_WORKER_PID" ] && kill $AUDIO_STREAM_DEEPGRAM_WORKER_PID 2>/dev/null || true
186+
[ -n "$AUDIO_STREAM_PARAKEET_WORKER_PID" ] && kill $AUDIO_STREAM_PARAKEET_WORKER_PID 2>/dev/null || true
165187
wait
166188

167189
echo "🔄 All workers stopped"

extras/openmemory-mcp/docker-compose.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ services:
88
- ./data/mem0_storage:/qdrant/storage
99
restart: unless-stopped
1010

11-
# OpenMemory MCP Server (built from local cache)
11+
# OpenMemory MCP Server (official Docker image)
1212
openmemory-mcp:
13-
build:
14-
context: ./cache/mem0/openmemory/api
15-
dockerfile: Dockerfile
13+
image: mem0/openmemory-mcp:latest
1614
env_file:
1715
- .env
1816
environment:
@@ -29,8 +27,11 @@ services:
2927
timeout: 10s
3028
retries: 3
3129
start_period: 30s
30+
networks:
31+
- default
32+
- chronicle-network
3233

33-
# OpenMemory UI (optional - can be disabled if not needed)
34+
# OpenMemory UI (starts by default with the MCP server)
3435
openmemory-ui:
3536
image: mem0/openmemory-ui:latest
3637
ports:
@@ -40,5 +41,10 @@ services:
4041
- NEXT_PUBLIC_USER_ID=openmemory
4142
depends_on:
4243
- openmemory-mcp
43-
profiles:
44-
- ui # Only starts when --profile ui is used
44+
restart: unless-stopped
45+
46+
networks:
47+
default:
48+
name: openmemory-mcp_default
49+
chronicle-network:
50+
external: true

extras/openmemory-mcp/init-cache.sh

Lines changed: 0 additions & 31 deletions
This file was deleted.

extras/openmemory-mcp/setup.sh

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,6 @@ fi
4343
# Set restrictive permissions (owner read/write only)
4444
chmod 600 .env
4545

46-
# Clone the custom fork of mem0 with OpenMemory fixes
47-
echo ""
48-
echo "📦 Setting up custom mem0 fork with OpenMemory..."
49-
if [ -d "cache/mem0" ]; then
50-
echo " Removing existing mem0 directory..."
51-
rm -rf cache/mem0
52-
fi
53-
54-
echo " Cloning mem0 fork from AnkushMalaker/mem0..."
55-
mkdir -p cache
56-
git clone https://github.com/AnkushMalaker/mem0.git cache/mem0
57-
cd cache/mem0
58-
echo " Checking out fix/get-endpoint branch..."
59-
git checkout fix/get-endpoint
60-
cd ../..
61-
62-
echo "✅ Custom mem0 fork ready with OpenMemory improvements"
63-
6446
# Get OpenAI API Key (prompt only if not provided via command line)
6547
if [ -z "$OPENAI_API_KEY" ]; then
6648
echo ""
@@ -91,9 +73,6 @@ echo ""
9173
echo "✅ OpenMemory MCP configured!"
9274
echo "📁 Configuration saved to .env"
9375
echo ""
94-
echo "🚀 To start: docker compose up --build -d"
76+
echo "🚀 To start: docker compose up -d"
9577
echo "🌐 MCP Server: http://localhost:8765"
96-
echo "📱 Web Interface: http://localhost:8765"
97-
echo "🔧 UI (optional): docker compose --profile ui up -d"
98-
echo ""
99-
echo "💡 Note: Using custom mem0 fork from AnkushMalaker/mem0:fix/get-endpoint"
78+
echo "📱 Web UI: http://localhost:3001"

extras/speaker-recognition/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,5 @@ services:
108108
# Shared network for cross-project communication
109109
networks:
110110
default:
111-
name: friend-network
111+
name: chronicle-network
112112
external: true

0 commit comments

Comments
 (0)