Files
xtts-server/Makefile

109 lines
3.1 KiB
Makefile
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Makefile – PRO Mode
# Vollständiger Build-/Deploy-/Diagnose-Workflow für das XTTS2 TTS System
PYTHON := python3
PORT_SCRIPT := scripts/find_port.py
PORT_FILE := gateway/port.txt
DOCKER := docker compose
.DEFAULT_GOAL := help
help:
@echo ""
@echo "🚀 XTTS2 TTS Server – Makefile (Pro Mode)"
@echo "-------------------------------------------"
@echo " make build → Images bauen (Gateway + Worker)"
@echo " make up → Services starten (mit Portscan)"
@echo " make down → Services stoppen"
@echo " make restart → Neustart"
@echo " make logs → Logs aller Services anzeigen"
@echo " make status → Docker Status"
@echo " make worker-scale N=3 → Worker skalieren"
@echo " make prune → Docker aufräumen"
@echo " make selftest → System-Selbsttest"
@echo " make port → Zeigt aktuellen Gateway Port"
@echo "-------------------------------------------"
# ---------------------------------------------------------
# Build
# ---------------------------------------------------------
build:
$(DOCKER) build
# ---------------------------------------------------------
# Deploy
# ---------------------------------------------------------
up:
@echo "🔍 Suche freien Port zwischen 8000–8100..."
@PORT=`$(PYTHON) $(PORT_SCRIPT)`; \
if [ "$$PORT" = "ERR_NO_FREE_PORT" ]; then \
echo "❌ Kein freier Port gefunden!"; exit 1; \
fi; \
echo "🎧 Freier Port gefunden: $$PORT"; \
echo "$$PORT" > $(PORT_FILE); \
echo "📄 Port gespeichert in $(PORT_FILE)"; \
export GATEWAY_PORT=$$PORT; \
$(DOCKER) up -d --build; \
echo "🚀 Gateway läuft auf http://localhost:$$PORT"
# ---------------------------------------------------------
# Stop
# ---------------------------------------------------------
down:
$(DOCKER) down
# ---------------------------------------------------------
# Restart
# ---------------------------------------------------------
restart: down up
# ---------------------------------------------------------
# Logs
# ---------------------------------------------------------
logs:
$(DOCKER) logs -f
# ---------------------------------------------------------
# Status
# ---------------------------------------------------------
status:
$(DOCKER) ps
# ---------------------------------------------------------
# Worker Scaling
# ---------------------------------------------------------
worker-scale:
@if [ -z "$(N)" ]; then echo "Bitte N angeben: make worker-scale N=3"; exit 1; fi
$(DOCKER) up -d --scale worker=$(N)
# ---------------------------------------------------------
# Cleanup
# ---------------------------------------------------------
prune:
$(DOCKER) down
docker system prune -f
# ---------------------------------------------------------
# Selftest
# ---------------------------------------------------------
selftest:
@echo "🧪 Starte Selbsttest..."
$(PYTHON) scripts/selftest.py
# ---------------------------------------------------------
# Show Port
# ---------------------------------------------------------
port:
@echo "📡 Aktueller Port:"
@cat $(PORT_FILE)