first commit
This commit is contained in:
69
start.sh
Executable file
69
start.sh
Executable file
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
HEALTH_URL="http://localhost:8091/health"
|
||||
MAX_WAIT=180
|
||||
|
||||
strip_ansi() { sed 's/\x1b\[[0-9;]*[mK]//g'; }
|
||||
|
||||
t0=$SECONDS
|
||||
|
||||
# --- Container starten ---
|
||||
printf "Container startet..."
|
||||
docker compose up -d &>/tmp/qwen3-tts-compose.log
|
||||
printf " [%ds]\n\n" $(( SECONDS - t0 ))
|
||||
|
||||
# --- Log-Events im Hintergrund parsen und ausgeben ---
|
||||
docker logs -f qwen3-tts 2>&1 | strip_ansi | while IFS= read -r line; do
|
||||
case "$line" in
|
||||
*"Stage 0 engine launch started"*)
|
||||
printf " Stage 0 Talker LLM wird geladen\n" ;;
|
||||
*"Initializing a V1 LLM engine"*)
|
||||
printf " Stage 0 Engine initialisiert\n" ;;
|
||||
*"Loading weights"*)
|
||||
printf " Stage 0 Modell-Gewichte werden geladen...\n" ;;
|
||||
*"Loading model weights took"*)
|
||||
took=$(echo "$line" | grep -oP '\d+\.\d+s' | head -1)
|
||||
printf " Stage 0 Gewichte geladen (%s)\n" "$took" ;;
|
||||
*"Stage 1 engine launch started"*)
|
||||
printf " Stage 1 Code2Wav Decoder wird geladen\n" ;;
|
||||
*"Graph capturing finished"*)
|
||||
printf " CUDA Graphen kompiliert\n" ;;
|
||||
*"Application startup complete"*)
|
||||
printf " Server FastAPI bereit\n" ;;
|
||||
*"Uvicorn running on"*)
|
||||
printf " Server HTTP läuft auf Port 8091\n" ;;
|
||||
*"warmup] Server gesund"*)
|
||||
printf " Warmup Aufwärm-Request läuft (kompiliert/lädt Graphen)...\n" ;;
|
||||
*"warmup] fertig"*)
|
||||
took=$(echo "$line" | grep -oP '\d+s' | head -1)
|
||||
printf " Warmup Server ist heiß (%s)\n" "$took" ;;
|
||||
*"ERROR"*|*"ValueError"*)
|
||||
msg=$(echo "$line" | grep -oP '(ERROR|ValueError).*' | head -1)
|
||||
printf " [!] %s\n" "${msg:0:100}" ;;
|
||||
esac
|
||||
done &
|
||||
LOG_PID=$!
|
||||
|
||||
# --- Health-Check-Schleife ---
|
||||
while (( SECONDS - t0 < MAX_WAIT )); do
|
||||
if curl -sf "$HEALTH_URL" >/dev/null 2>&1; then
|
||||
kill "$LOG_PID" 2>/dev/null
|
||||
wait "$LOG_PID" 2>/dev/null
|
||||
printf "\n✓ Bereit: http://localhost:8091 [%ds]\n" $(( SECONDS - t0 ))
|
||||
exit 0
|
||||
fi
|
||||
# Abbruch wenn Container schon gestoppt ist
|
||||
if ! docker ps --filter "name=qwen3-tts" --filter "status=running" -q | grep -q .; then
|
||||
kill "$LOG_PID" 2>/dev/null
|
||||
printf "\n✗ Container abgestürzt. Logs:\n"
|
||||
docker logs --tail=20 qwen3-tts 2>&1 | strip_ansi | grep -E "ERROR|ValueError|Exception" | head -5
|
||||
exit 1
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
|
||||
kill "$LOG_PID" 2>/dev/null
|
||||
printf "\n✗ Timeout nach %ds. Logs: docker logs qwen3-tts\n" "$MAX_WAIT" >&2
|
||||
exit 1
|
||||
Reference in New Issue
Block a user