Skip to content

Commit c78554c

Browse files
authored
Merge branch 'main' into fix/pyprojectupdate
2 parents 3cc7ca0 + 77b8869 commit c78554c

125 files changed

Lines changed: 21315 additions & 8787 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ PARAKEET_ASR_URL=http://host.docker.internal:8767
105105

106106
# MongoDB configuration
107107
MONGODB_URI=mongodb://mongo:${MONGODB_PORT}
108-
MONGODB_K8S_URI=mongodb://mongodb.${INFRASTRUCTURE_NAMESPACE}.svc.cluster.local:27017/friend
108+
MONGODB_K8S_URI=mongodb://mongodb.${INFRASTRUCTURE_NAMESPACE}.svc.cluster.local:27017/friend-lite
109109

110110
# Qdrant configuration
111111
QDRANT_BASE_URL=qdrant

Makefile

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export $(shell sed 's/=.*//' config.env | grep -v '^\s*$$' | grep -v '^\s*\#')
1919
SCRIPTS_DIR := scripts
2020
K8S_SCRIPTS_DIR := $(SCRIPTS_DIR)/k8s
2121

22-
.PHONY: help menu setup-k8s setup-infrastructure setup-rbac setup-storage-pvc config config-docker config-k8s config-all clean deploy deploy-docker deploy-k8s deploy-k8s-full deploy-infrastructure deploy-apps check-infrastructure check-apps build-backend up-backend down-backend k8s-status k8s-cleanup k8s-purge audio-manage
22+
.PHONY: help menu setup-k8s setup-infrastructure setup-rbac setup-storage-pvc config config-docker config-k8s config-all clean deploy deploy-docker deploy-k8s deploy-k8s-full deploy-infrastructure deploy-apps check-infrastructure check-apps build-backend up-backend down-backend k8s-status k8s-cleanup k8s-purge audio-manage test-robot test-robot-integration test-robot-unit test-robot-endpoints test-robot-specific test-robot-clean
2323

2424
# Default target
2525
.DEFAULT_GOAL := menu
@@ -36,6 +36,11 @@ menu: ## Show interactive menu (default)
3636
@echo " k8s-cleanup 🧹 Clean up Kubernetes resources"
3737
@echo " audio-manage 🎵 Manage audio files"
3838
@echo
39+
@echo "🧪 Testing:"
40+
@echo " test-robot 🧪 Run all Robot Framework tests"
41+
@echo " test-robot-integration 🔬 Run integration tests only"
42+
@echo " test-robot-endpoints 🌐 Run endpoint tests only"
43+
@echo
3944
@echo "📝 Configuration:"
4045
@echo " config-docker 🐳 Generate Docker Compose .env files"
4146
@echo " config-k8s ☸️ Generate Kubernetes files (Skaffold env + ConfigMap/Secret)"
@@ -95,6 +100,13 @@ help: ## Show detailed help for all targets
95100
@echo "🎵 AUDIO MANAGEMENT:"
96101
@echo " audio-manage Interactive audio file management"
97102
@echo
103+
@echo "🧪 ROBOT FRAMEWORK TESTING:"
104+
@echo " test-robot Run all Robot Framework tests"
105+
@echo " test-robot-integration Run integration tests only"
106+
@echo " test-robot-endpoints Run endpoint tests only"
107+
@echo " test-robot-specific FILE=path Run specific test file"
108+
@echo " test-robot-clean Clean up test results"
109+
@echo
98110
@echo "🔍 MONITORING:"
99111
@echo " check-infrastructure Check if infrastructure services are running"
100112
@echo " check-apps Check if application services are running"
@@ -170,7 +182,7 @@ config: config-all ## Generate all configuration files
170182

171183
config-docker: ## Generate Docker Compose configuration files
172184
@echo "🐳 Generating Docker Compose configuration files..."
173-
@python3 scripts/generate-docker-configs.py
185+
@CONFIG_FILE=config.env.dev python3 scripts/generate-docker-configs.py
174186
@echo "✅ Docker Compose configuration files generated"
175187

176188
config-k8s: ## Generate Kubernetes configuration files (Skaffold env + ConfigMap/Secret)
@@ -297,3 +309,49 @@ k8s-purge: ## Purge unused images (registry + container)
297309
audio-manage: ## Interactive audio file management
298310
@echo "🎵 Starting audio file management..."
299311
@$(SCRIPTS_DIR)/manage-audio-files.sh
312+
313+
# ========================================
314+
# TESTING TARGETS
315+
# ========================================
316+
317+
# Define test environment variables
318+
TEST_ENV := BACKEND_URL=http://localhost:8001 ADMIN_EMAIL=test-admin@example.com ADMIN_PASSWORD=test-admin-password-123
319+
320+
test-robot: ## Run all Robot Framework tests
321+
@echo "🧪 Running all Robot Framework tests..."
322+
@cd tests && $(TEST_ENV) robot --outputdir ../results .
323+
@echo "✅ All Robot Framework tests completed"
324+
@echo "📊 Results available in: results/"
325+
326+
test-robot-integration: ## Run integration tests only
327+
@echo "🧪 Running Robot Framework integration tests..."
328+
@cd tests && $(TEST_ENV) robot --outputdir ../results integration/
329+
@echo "✅ Robot Framework integration tests completed"
330+
@echo "📊 Results available in: results/"
331+
332+
test-robot-unit: ## Run unit tests only
333+
@echo "🧪 Running Robot Framework unit tests..."
334+
@cd tests && $(TEST_ENV) robot --outputdir ../results unit/ || echo "⚠️ No unit tests directory found"
335+
@echo "✅ Robot Framework unit tests completed"
336+
@echo "📊 Results available in: results/"
337+
338+
test-robot-endpoints: ## Run endpoint tests only
339+
@echo "🧪 Running Robot Framework endpoint tests..."
340+
@cd tests && $(TEST_ENV) robot --outputdir ../results endpoints/
341+
@echo "✅ Robot Framework endpoint tests completed"
342+
@echo "📊 Results available in: results/"
343+
344+
test-robot-specific: ## Run specific Robot Framework test file (usage: make test-robot-specific FILE=path/to/test.robot)
345+
@echo "🧪 Running specific Robot Framework test: $(FILE)"
346+
@if [ -z "$(FILE)" ]; then \
347+
echo "❌ FILE parameter is required. Usage: make test-robot-specific FILE=path/to/test.robot"; \
348+
exit 1; \
349+
fi
350+
@cd tests && $(TEST_ENV) robot --outputdir ../results $(FILE)
351+
@echo "✅ Robot Framework test completed: $(FILE)"
352+
@echo "📊 Results available in: results/"
353+
354+
test-robot-clean: ## Clean up Robot Framework test results
355+
@echo "🧹 Cleaning up Robot Framework test results..."
356+
@rm -rf results/
357+
@echo "✅ Test results cleaned"

backends/advanced/.dockerignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@
1414
!webui
1515
!ssl
1616
!nginx.conf
17-
!nginx.conf.template
17+
!nginx.conf.template
18+
!start.sh
19+
!start-workers.sh

backends/advanced/.env.template

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ TRANSCRIPTION_BUFFER_SECONDS=120 # Trigger transcription every N seconds
7777
# Auto-stop thresholds
7878
SPEECH_INACTIVITY_THRESHOLD_SECONDS=60 # Close conversation after N seconds of no speech
7979

80+
# Speaker enrollment filter (default: false)
81+
# When enabled, only creates conversations when enrolled speakers are detected
82+
# Requires speaker recognition service to be running and speakers to be enrolled
83+
# Set to "true" to enable, "false" or omit to disable
84+
RECORD_ONLY_ENROLLED_SPEAKERS=true
85+
8086
# ========================================
8187
# DATABASE CONFIGURATION
8288
# ========================================
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Caddy reverse proxy configuration for Friend-Lite
2+
# Provides automatic HTTPS for microphone access
3+
4+
# USAGE:
5+
# 1. Start services: docker compose up -d
6+
# 2. Access at: https://localhost (Caddy will use self-signed cert)
7+
# 3. Browser will warn about self-signed cert - accept it
8+
# 4. Microphone access will now work via HTTPS
9+
#
10+
# NOTE: If using Caddy, update docker-compose.yml webui build args:
11+
# VITE_BACKEND_URL: "" (empty for same-origin through Caddy)
12+
#
13+
# For production, replace 'localhost' with your domain name and Caddy
14+
# will automatically obtain Let's Encrypt certificates.
15+
16+
localhost {
17+
# Enable automatic HTTPS
18+
tls internal
19+
20+
# WebSocket endpoints - proxy to backend with upgrade support
21+
handle /ws* {
22+
reverse_proxy friend-backend:8000 {
23+
# Caddy automatically handles WebSocket upgrades
24+
header_up X-Real-IP {remote_host}
25+
header_up X-Forwarded-For {remote_host}
26+
header_up X-Forwarded-Proto {scheme}
27+
}
28+
}
29+
30+
# API endpoints - proxy to backend
31+
handle /api/* {
32+
reverse_proxy friend-backend:8000
33+
}
34+
35+
# Auth endpoints - proxy to backend
36+
handle /auth/* {
37+
reverse_proxy friend-backend:8000
38+
}
39+
40+
# Health checks - proxy to backend
41+
handle /health {
42+
reverse_proxy friend-backend:8000
43+
}
44+
45+
handle /readiness {
46+
reverse_proxy friend-backend:8000
47+
}
48+
49+
# Users endpoints - proxy to backend
50+
handle /users/* {
51+
reverse_proxy friend-backend:8000
52+
}
53+
54+
# Audio files - proxy to backend
55+
handle /audio/* {
56+
reverse_proxy friend-backend:8000
57+
}
58+
59+
# Everything else - proxy to webui
60+
handle {
61+
reverse_proxy webui:80
62+
}
63+
}
64+
65+
# Production configuration (uncomment and modify for your domain)
66+
# yourdomain.com {
67+
# # Caddy automatically obtains Let's Encrypt certificates
68+
#
69+
# # WebSocket endpoints
70+
# handle /ws* {
71+
# reverse_proxy friend-backend:8000
72+
# }
73+
#
74+
# # API endpoints
75+
# handle /api/* {
76+
# reverse_proxy friend-backend:8000
77+
# }
78+
#
79+
# # Auth endpoints
80+
# handle /auth/* {
81+
# reverse_proxy friend-backend:8000
82+
# }
83+
#
84+
# # Health checks
85+
# handle /health {
86+
# reverse_proxy friend-backend:8000
87+
# }
88+
#
89+
# handle /readiness {
90+
# reverse_proxy friend-backend:8000
91+
# }
92+
#
93+
# # Users endpoints
94+
# handle /users/* {
95+
# reverse_proxy friend-backend:8000
96+
# }
97+
#
98+
# # Audio files
99+
# handle /audio/* {
100+
# reverse_proxy friend-backend:8000
101+
# }
102+
#
103+
# # Everything else - webui
104+
# handle {
105+
# reverse_proxy webui:80
106+
# }
107+
# }

backends/advanced/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,10 @@ COPY diarization_config.json* ./
3636

3737
ENV PATH="/app/.venv/bin:$PATH"
3838

39-
# Run the application
40-
CMD ["python", "src/advanced_omi_backend/main.py"]
39+
# Copy and make startup scripts executable
40+
COPY start.sh ./
41+
COPY start-workers.sh ./
42+
RUN chmod +x start.sh start-workers.sh
43+
44+
# Run the application with workers
45+
CMD ["./start.sh"]

backends/advanced/Dockerfile.k8s

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ COPY . .
3636
# Copy memory config (created by init.sh from template)
3737
COPY memory_config.yaml ./
3838

39+
# Copy and make K8s startup scripts executable
40+
COPY start-k8s.sh start-workers.sh ./
41+
RUN chmod +x start-k8s.sh start-workers.sh
3942

40-
# Run the application
41-
# CMD ["uv", "run", "python3", "src/advanced_omi_backend/main.py"]
42-
43-
# don't sync if deploying prebuilt image to k8s
44-
CMD ["uv", "run", "--no-sync", "python3", "src/advanced_omi_backend/main.py"]
43+
# Run the application with workers
44+
# K8s startup script starts both FastAPI backend and RQ workers with --no-sync
45+
CMD ["./start-k8s.sh"]

backends/advanced/docker-compose-test.yml

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ services:
1010
ports:
1111
- "8001:8000" # Avoid conflict with dev on 8000
1212
volumes:
13+
- ./src:/app/src # Mount source code for easier development
1314
- ./data/test_audio_chunks:/app/audio_chunks
1415
- ./data/test_debug_dir:/app/debug_dir
1516
- ./data/test_data:/app/data
@@ -18,6 +19,7 @@ services:
1819
- MONGODB_URI=mongodb://mongo-test:27017/test_db
1920
- QDRANT_BASE_URL=qdrant-test
2021
- QDRANT_PORT=6333
22+
- REDIS_URL=redis://redis-test:6379/0
2123
- DEBUG_DIR=/app/debug_dir
2224
# Import API keys from environment
2325
- DEEPGRAM_API_KEY=${DEEPGRAM_API_KEY}
@@ -37,18 +39,22 @@ services:
3739
- OPENMEMORY_MCP_URL=${OPENMEMORY_MCP_URL:-http://host.docker.internal:8765}
3840
- OPENMEMORY_USER_ID=${OPENMEMORY_USER_ID:-openmemory}
3941
# Disable speaker recognition in test environment to prevent segment duplication
40-
- DISABLE_SPEAKER_RECOGNITION=true
42+
- DISABLE_SPEAKER_RECOGNITION=false
43+
- SPEAKER_SERVICE_URL=https://localhost:8085
44+
- CORS_ORIGINS=http://localhost:3001,http://localhost:8001,https://localhost:3001,https://localhost:8001
4145
depends_on:
4246
qdrant-test:
4347
condition: service_started
4448
mongo-test:
4549
condition: service_healthy
50+
redis-test:
51+
condition: service_started
4652
healthcheck:
4753
test: ["CMD", "curl", "-f", "http://localhost:8000/readiness"]
4854
interval: 10s
4955
timeout: 5s
5056
retries: 5
51-
start_period: 5s
57+
start_period: 30s
5258
restart: unless-stopped
5359

5460
webui-test:
@@ -57,6 +63,9 @@ services:
5763
dockerfile: Dockerfile
5864
args:
5965
- VITE_BACKEND_URL=http://localhost:8001
66+
- BACKEND_URL=http://localhost:8001
67+
volumes:
68+
- ./webui/src:/app/src # Mount source code for easier development
6069
ports:
6170
- "3001:80" # Avoid conflict with dev on 3000
6271
depends_on:
@@ -66,6 +75,8 @@ services:
6675
condition: service_healthy
6776
qdrant-test:
6877
condition: service_started
78+
redis-test:
79+
condition: service_started
6980

7081
qdrant-test:
7182
image: qdrant/qdrant:latest
@@ -76,7 +87,7 @@ services:
7687
- ./data/test_qdrant_data:/qdrant/storage
7788

7889
mongo-test:
79-
image: mongo:4.4.18
90+
image: mongo:8.0.14
8091
ports:
8192
- "27018:27017" # Avoid conflict with dev on 27017
8293
volumes:
@@ -90,6 +101,35 @@ services:
90101
retries: 10
91102
start_period: 10s
92103

104+
redis-test:
105+
image: redis:7-alpine
106+
ports:
107+
- "6380:6379" # Avoid conflict with dev on 6379
108+
volumes:
109+
- ./data/test_redis_data:/data
110+
command: redis-server --appendonly yes
111+
healthcheck:
112+
test: ["CMD", "redis-cli", "ping"]
113+
interval: 5s
114+
timeout: 3s
115+
retries: 5
116+
117+
# caddy:
118+
# image: caddy:2-alpine
119+
# ports:
120+
# - "443:443"
121+
# - "80:80" # HTTP redirect to HTTPS
122+
# volumes:
123+
# - ./Caddyfile-test:/etc/caddy/Caddyfile:ro
124+
# - ./data/caddy_data:/data
125+
# - ./data/caddy_config:/config
126+
# depends_on:
127+
# webui-test:
128+
# condition: service_started
129+
# friend-backend-test:
130+
# condition: service_healthy
131+
# restart: unless-stopped
132+
93133
# CI Considerations (for future implementation):
94134
# - GitHub Actions can run these services in isolated containers
95135
# - Port conflicts won't exist in CI since each job runs in isolation

0 commit comments

Comments
 (0)