- Add step in sync target to copy sample.env to speech.env if missing - Ensures Makefile works from scratch without manual intervention - Tested full deployment cycle: deploy -> voices -> test - Successfully creates ~/uncloseai-speech directory - Downloads voices with absolute paths - Generates working TTS audio Raccoon mission: Makefile is now fully self-sufficient! 🦝 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
92 lines
4.3 KiB
Makefile
92 lines
4.3 KiB
Makefile
# Raccoon Mission: UncloseAI 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 ?= ~/uncloseai-speech
|
|
CONTAINER_NAME ?= uncloseai-speech-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)/
|
|
@echo "📝 Ensuring speech.env exists..."
|
|
ssh $(REMOTE_USER)@$(REMOTE_HOST) "cd $(REMOTE_PATH) && [ -f speech.env ] || cp sample.env speech.env"
|
|
|
|
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!"
|