This commit resolves the "download entire voices" issue by properly handling absolute paths in Piper model configuration and improves the deployment system. Key changes: - speech.py: Detect absolute paths and omit --data-dir/--download-dir flags when using absolute model paths, allowing Piper to load models directly - speech.py: Add debug logging and stderr capture for Piper subprocess - voice_to_speaker.default.yaml: Use absolute paths for all Piper models - Makefile: Load deployment config from vars.sh for better security - Makefile: Change restart to rebuild container ensuring code updates apply - Add vars.sh.example template for deployment configuration - .gitignore: Add vars.sh to prevent committing deployment secrets Tested successfully with en_US-libritts_r-medium model using absolute path: /app/voices/en/en_US/libritts_r/medium/en_US-libritts_r-medium.onnx 🦝 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
90 lines
4.2 KiB
Makefile
90 lines
4.2 KiB
Makefile
# Raccoon Mission: OpenedAI Speech Development Makefile
|
|
# Deploy to remote server with ease
|
|
# Configuration is loaded from vars.sh (copy vars.sh.example to vars.sh)
|
|
|
|
# Load configuration from vars.sh if it exists
|
|
ifneq (,$(wildcard vars.sh))
|
|
include vars.sh
|
|
export
|
|
endif
|
|
|
|
# Fallback defaults if vars.sh is not found
|
|
REMOTE_HOST ?= localhost
|
|
REMOTE_USER ?= $(USER)
|
|
REMOTE_PATH ?= ~/openedai-speech-fresh
|
|
CONTAINER_NAME ?= openedai-speech-fresh-server-1
|
|
|
|
.PHONY: help deploy sync restart logs test clean stop start voices
|
|
|
|
help:
|
|
@echo "🦝 Raccoon TTS Mission - Development Commands"
|
|
@echo ""
|
|
@echo "Deployment:"
|
|
@echo " make deploy - Full deploy: sync files, restart container"
|
|
@echo " make sync - Sync local files to remote server"
|
|
@echo " make restart - Restart the Docker container"
|
|
@echo ""
|
|
@echo "Development:"
|
|
@echo " make logs - Tail container logs"
|
|
@echo " make test - Test TTS endpoint"
|
|
@echo " make voices - Download Piper voices properly"
|
|
@echo ""
|
|
@echo "Container:"
|
|
@echo " make start - Start Docker container"
|
|
@echo " make stop - Stop Docker container"
|
|
@echo " make clean - Stop and remove container"
|
|
|
|
sync:
|
|
@echo "📦 Syncing files to $(REMOTE_HOST)..."
|
|
rsync -avz --exclude '.git' --exclude '__pycache__' --exclude '*.pyc' \
|
|
--exclude 'voices/*' --exclude 'config/voice_to_speaker.yaml' \
|
|
./ $(REMOTE_USER)@$(REMOTE_HOST):$(REMOTE_PATH)/
|
|
|
|
deploy: sync restart
|
|
@echo "✅ Deployment complete!"
|
|
|
|
restart:
|
|
@echo "🔄 Rebuilding and restarting container on $(REMOTE_HOST)..."
|
|
ssh $(REMOTE_USER)@$(REMOTE_HOST) "cd $(REMOTE_PATH) && docker compose up -d --build"
|
|
|
|
stop:
|
|
@echo "🛑 Stopping container on $(REMOTE_HOST)..."
|
|
ssh $(REMOTE_USER)@$(REMOTE_HOST) "cd $(REMOTE_PATH) && docker compose down"
|
|
|
|
start:
|
|
@echo "▶️ Starting container on $(REMOTE_HOST)..."
|
|
ssh $(REMOTE_USER)@$(REMOTE_HOST) "cd $(REMOTE_PATH) && docker compose up -d"
|
|
|
|
clean: stop
|
|
@echo "🧹 Removing container..."
|
|
ssh $(REMOTE_USER)@$(REMOTE_HOST) "cd $(REMOTE_PATH) && docker compose down -v"
|
|
|
|
logs:
|
|
@echo "📋 Tailing logs from $(REMOTE_HOST)..."
|
|
ssh $(REMOTE_USER)@$(REMOTE_HOST) "docker logs -f $(CONTAINER_NAME)"
|
|
|
|
test:
|
|
@echo "🧪 Testing TTS endpoint..."
|
|
curl -X POST http://$(REMOTE_HOST):8000/v1/audio/speech \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"model":"tts-1","voice":"alloy","input":"Raccoon mission TTS test"}' \
|
|
-o /tmp/raccoon_test.mp3
|
|
@echo "✅ Test complete! Playing audio..."
|
|
@firefox /tmp/raccoon_test.mp3 || mpv /tmp/raccoon_test.mp3 || echo "Install firefox or mpv to play audio"
|
|
|
|
voices:
|
|
@echo "🎤 Downloading Piper voices with correct directory structure..."
|
|
ssh $(REMOTE_USER)@$(REMOTE_HOST) "docker exec $(CONTAINER_NAME) bash -c '\
|
|
mkdir -p /app/voices/en/en_US/libritts_r/medium && \
|
|
cd /app/voices/en/en_US/libritts_r/medium && \
|
|
curl -L https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_US/libritts_r/medium/en_US-libritts_r-medium.onnx -o en_US-libritts_r-medium.onnx && \
|
|
curl -L https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_US/libritts_r/medium/en_US-libritts_r-medium.onnx.json -o en_US-libritts_r-medium.onnx.json && \
|
|
mkdir -p /app/voices/en/en_GB/northern_english_male/medium && \
|
|
cd /app/voices/en/en_GB/northern_english_male/medium && \
|
|
curl -L https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_GB/northern_english_male/medium/en_GB-northern_english_male-medium.onnx -o en_GB-northern_english_male-medium.onnx && \
|
|
curl -L https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_GB/northern_english_male/medium/en_GB-northern_english_male-medium.onnx.json -o en_GB-northern_english_male-medium.onnx.json'"
|
|
@echo "📝 Updating voice_to_speaker.yaml with ABSOLUTE paths..."
|
|
ssh $(REMOTE_USER)@$(REMOTE_HOST) "docker exec $(CONTAINER_NAME) bash -c '\
|
|
sed -i \"s|model: voices/en_US-libritts_r-medium.onnx|model: /app/voices/en/en_US/libritts_r/medium/en_US-libritts_r-medium.onnx|g\" /app/config/voice_to_speaker.yaml && \
|
|
sed -i \"s|model: voices/en_GB-northern_english_male-medium.onnx|model: /app/voices/en/en_GB/northern_english_male/medium/en_GB-northern_english_male-medium.onnx|g\" /app/config/voice_to_speaker.yaml'"
|
|
@echo "✅ Voices installed with absolute paths!"
|