Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ PARAKEET_ASR_URL=http://host.docker.internal:8767

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

# Qdrant configuration
QDRANT_BASE_URL=qdrant
Expand Down
62 changes: 60 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export $(shell sed 's/=.*//' config.env | grep -v '^\s*$$' | grep -v '^\s*\#')
SCRIPTS_DIR := scripts
K8S_SCRIPTS_DIR := $(SCRIPTS_DIR)/k8s

.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
.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

# Default target
.DEFAULT_GOAL := menu
Expand All @@ -36,6 +36,11 @@ menu: ## Show interactive menu (default)
@echo " k8s-cleanup 🧹 Clean up Kubernetes resources"
@echo " audio-manage 🎵 Manage audio files"
@echo
@echo "🧪 Testing:"
@echo " test-robot 🧪 Run all Robot Framework tests"
@echo " test-robot-integration 🔬 Run integration tests only"
@echo " test-robot-endpoints 🌐 Run endpoint tests only"
@echo
@echo "📝 Configuration:"
@echo " config-docker 🐳 Generate Docker Compose .env files"
@echo " config-k8s ☸️ Generate Kubernetes files (Skaffold env + ConfigMap/Secret)"
Expand Down Expand Up @@ -95,6 +100,13 @@ help: ## Show detailed help for all targets
@echo "🎵 AUDIO MANAGEMENT:"
@echo " audio-manage Interactive audio file management"
@echo
@echo "🧪 ROBOT FRAMEWORK TESTING:"
@echo " test-robot Run all Robot Framework tests"
@echo " test-robot-integration Run integration tests only"
@echo " test-robot-endpoints Run endpoint tests only"
@echo " test-robot-specific FILE=path Run specific test file"
@echo " test-robot-clean Clean up test results"
@echo
@echo "🔍 MONITORING:"
@echo " check-infrastructure Check if infrastructure services are running"
@echo " check-apps Check if application services are running"
Expand Down Expand Up @@ -170,7 +182,7 @@ config: config-all ## Generate all configuration files

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

config-k8s: ## Generate Kubernetes configuration files (Skaffold env + ConfigMap/Secret)
Expand Down Expand Up @@ -297,3 +309,49 @@ k8s-purge: ## Purge unused images (registry + container)
audio-manage: ## Interactive audio file management
@echo "🎵 Starting audio file management..."
@$(SCRIPTS_DIR)/manage-audio-files.sh

# ========================================
# TESTING TARGETS
# ========================================

# Define test environment variables
TEST_ENV := BACKEND_URL=http://localhost:8001 ADMIN_EMAIL=test-admin@example.com ADMIN_PASSWORD=test-admin-password-123

test-robot: ## Run all Robot Framework tests
@echo "🧪 Running all Robot Framework tests..."
@cd tests && $(TEST_ENV) robot --outputdir ../results .
@echo "✅ All Robot Framework tests completed"
@echo "📊 Results available in: results/"

test-robot-integration: ## Run integration tests only
@echo "🧪 Running Robot Framework integration tests..."
@cd tests && $(TEST_ENV) robot --outputdir ../results integration/
@echo "✅ Robot Framework integration tests completed"
@echo "📊 Results available in: results/"

test-robot-unit: ## Run unit tests only
@echo "🧪 Running Robot Framework unit tests..."
@cd tests && $(TEST_ENV) robot --outputdir ../results unit/ || echo "⚠️ No unit tests directory found"
@echo "✅ Robot Framework unit tests completed"
@echo "📊 Results available in: results/"

test-robot-endpoints: ## Run endpoint tests only
@echo "🧪 Running Robot Framework endpoint tests..."
@cd tests && $(TEST_ENV) robot --outputdir ../results endpoints/
@echo "✅ Robot Framework endpoint tests completed"
@echo "📊 Results available in: results/"

test-robot-specific: ## Run specific Robot Framework test file (usage: make test-robot-specific FILE=path/to/test.robot)
@echo "🧪 Running specific Robot Framework test: $(FILE)"
@if [ -z "$(FILE)" ]; then \
echo "❌ FILE parameter is required. Usage: make test-robot-specific FILE=path/to/test.robot"; \
exit 1; \
fi
@cd tests && $(TEST_ENV) robot --outputdir ../results $(FILE)
@echo "✅ Robot Framework test completed: $(FILE)"
@echo "📊 Results available in: results/"

test-robot-clean: ## Clean up Robot Framework test results
@echo "🧹 Cleaning up Robot Framework test results..."
@rm -rf results/
@echo "✅ Test results cleaned"
6 changes: 6 additions & 0 deletions backends/advanced/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ TRANSCRIPTION_BUFFER_SECONDS=120 # Trigger transcription every N seconds
# Auto-stop thresholds
SPEECH_INACTIVITY_THRESHOLD_SECONDS=60 # Close conversation after N seconds of no speech

# Speaker enrollment filter (default: false)
# When enabled, only creates conversations when enrolled speakers are detected
# Requires speaker recognition service to be running and speakers to be enrolled
# Set to "true" to enable, "false" or omit to disable
RECORD_ONLY_ENROLLED_SPEAKERS=true

# ========================================
# DATABASE CONFIGURATION
# ========================================
Expand Down
107 changes: 107 additions & 0 deletions backends/advanced/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Caddy reverse proxy configuration for Friend-Lite
# Provides automatic HTTPS for microphone access

# USAGE:
# 1. Start services: docker compose up -d
# 2. Access at: https://localhost (Caddy will use self-signed cert)
# 3. Browser will warn about self-signed cert - accept it
# 4. Microphone access will now work via HTTPS
#
# NOTE: If using Caddy, update docker-compose.yml webui build args:
# VITE_BACKEND_URL: "" (empty for same-origin through Caddy)
#
# For production, replace 'localhost' with your domain name and Caddy
# will automatically obtain Let's Encrypt certificates.

localhost {
# Enable automatic HTTPS
tls internal

# WebSocket endpoints - proxy to backend with upgrade support
handle /ws* {
reverse_proxy friend-backend:8000 {
# Caddy automatically handles WebSocket upgrades
header_up X-Real-IP {remote_host}
header_up X-Forwarded-For {remote_host}
header_up X-Forwarded-Proto {scheme}
}
}

# API endpoints - proxy to backend
handle /api/* {
reverse_proxy friend-backend:8000
}

# Auth endpoints - proxy to backend
handle /auth/* {
reverse_proxy friend-backend:8000
}

# Health checks - proxy to backend
handle /health {
reverse_proxy friend-backend:8000
}

handle /readiness {
reverse_proxy friend-backend:8000
}

# Users endpoints - proxy to backend
handle /users/* {
reverse_proxy friend-backend:8000
}

# Audio files - proxy to backend
handle /audio/* {
reverse_proxy friend-backend:8000
}

# Everything else - proxy to webui
handle {
reverse_proxy webui:80
}
}

# Production configuration (uncomment and modify for your domain)
# yourdomain.com {
# # Caddy automatically obtains Let's Encrypt certificates
#
# # WebSocket endpoints
# handle /ws* {
# reverse_proxy friend-backend:8000
# }
#
# # API endpoints
# handle /api/* {
# reverse_proxy friend-backend:8000
# }
#
# # Auth endpoints
# handle /auth/* {
# reverse_proxy friend-backend:8000
# }
#
# # Health checks
# handle /health {
# reverse_proxy friend-backend:8000
# }
#
# handle /readiness {
# reverse_proxy friend-backend:8000
# }
#
# # Users endpoints
# handle /users/* {
# reverse_proxy friend-backend:8000
# }
#
# # Audio files
# handle /audio/* {
# reverse_proxy friend-backend:8000
# }
#
# # Everything else - webui
# handle {
# reverse_proxy webui:80
# }
# }
8 changes: 6 additions & 2 deletions backends/advanced/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,9 @@ COPY memory_config.yaml* ./
COPY diarization_config.json* ./


# Run the application
CMD ["uv", "run", "--extra", "deepgram", "python3", "src/advanced_omi_backend/main.py"]
# Copy and make startup script executable
COPY start.sh ./
RUN chmod +x start.sh

# Run the application with workers
CMD ["./start.sh"]
11 changes: 6 additions & 5 deletions backends/advanced/Dockerfile.k8s
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ COPY . .
# Copy memory config (created by init.sh from template)
COPY memory_config.yaml ./

# Copy and make K8s startup script executable
COPY start-k8s.sh ./
RUN chmod +x start-k8s.sh

# Run the application
# CMD ["uv", "run", "python3", "src/advanced_omi_backend/main.py"]

# don't sync if deploying prebuilt image to k8s
CMD ["uv", "run", "--no-sync", "python3", "src/advanced_omi_backend/main.py"]
# Run the application with workers
# K8s startup script starts both FastAPI backend and RQ workers with --no-sync
CMD ["./start-k8s.sh"]
46 changes: 43 additions & 3 deletions backends/advanced/docker-compose-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
ports:
- "8001:8000" # Avoid conflict with dev on 8000
volumes:
- ./src:/app/src # Mount source code for easier development
- ./data/test_audio_chunks:/app/audio_chunks
- ./data/test_debug_dir:/app/debug_dir
- ./data/test_data:/app/data
Expand All @@ -18,6 +19,7 @@ services:
- MONGODB_URI=mongodb://mongo-test:27017/test_db
- QDRANT_BASE_URL=qdrant-test
- QDRANT_PORT=6333
- REDIS_URL=redis://redis-test:6379/0
- DEBUG_DIR=/app/debug_dir
# Import API keys from environment
- DEEPGRAM_API_KEY=${DEEPGRAM_API_KEY}
Expand All @@ -37,18 +39,22 @@ services:
- OPENMEMORY_MCP_URL=${OPENMEMORY_MCP_URL:-http://host.docker.internal:8765}
- OPENMEMORY_USER_ID=${OPENMEMORY_USER_ID:-openmemory}
# Disable speaker recognition in test environment to prevent segment duplication
- DISABLE_SPEAKER_RECOGNITION=true
- DISABLE_SPEAKER_RECOGNITION=false
- SPEAKER_SERVICE_URL=https://localhost:8085
- CORS_ORIGINS=http://localhost:3001,http://localhost:8001,https://localhost:3001,https://localhost:8001
depends_on:
qdrant-test:
condition: service_started
mongo-test:
condition: service_healthy
redis-test:
condition: service_started
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/readiness"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
start_period: 30s
restart: unless-stopped

webui-test:
Expand All @@ -57,6 +63,9 @@ services:
dockerfile: Dockerfile
args:
- VITE_BACKEND_URL=http://localhost:8001
- BACKEND_URL=http://localhost:8001
volumes:
- ./webui/src:/app/src # Mount source code for easier development
ports:
- "3001:80" # Avoid conflict with dev on 3000
depends_on:
Expand All @@ -66,6 +75,8 @@ services:
condition: service_healthy
qdrant-test:
condition: service_started
redis-test:
condition: service_started

qdrant-test:
image: qdrant/qdrant:latest
Expand All @@ -76,7 +87,7 @@ services:
- ./data/test_qdrant_data:/qdrant/storage

mongo-test:
image: mongo:4.4.18
image: mongo:8.0.14
ports:
- "27018:27017" # Avoid conflict with dev on 27017
volumes:
Expand All @@ -90,6 +101,35 @@ services:
retries: 10
start_period: 10s

redis-test:
image: redis:7-alpine
ports:
- "6380:6379" # Avoid conflict with dev on 6379
volumes:
- ./data/test_redis_data:/data
command: redis-server --appendonly yes
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5

# caddy:
# image: caddy:2-alpine
# ports:
# - "443:443"
# - "80:80" # HTTP redirect to HTTPS
# volumes:
# - ./Caddyfile-test:/etc/caddy/Caddyfile:ro
# - ./data/caddy_data:/data
# - ./data/caddy_config:/config
# depends_on:
# webui-test:
# condition: service_started
# friend-backend-test:
# condition: service_healthy
# restart: unless-stopped

# CI Considerations (for future implementation):
# - GitHub Actions can run these services in isolated containers
# - Port conflicts won't exist in CI since each job runs in isolation
Expand Down
Loading