arabic-tts / start_all.sh
melakio's picture
improve khotba
882232f
#!/bin/bash
# ─────────────────────────────────────────────────────────────────────────────
# ArabApp Dev Server Launcher
# Starts all required backend services:
# Port 3002: Quran-MD audio database (Node.js/DuckDB)
# Port 3003: Arabic AI TTS server (Python/FastPitch+HiFi-GAN)
# ─────────────────────────────────────────────────────────────────────────────
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "πŸ•Œ ArabApp Backend Services"
echo "════════════════════════════"
echo ""
# ── Service 1: Quran-MD Database (port 3002) ──────────────────────────────
echo "β–Ά Starting Quran-MD audio database (port 3002)..."
if lsof -ti:3002 > /dev/null 2>&1; then
echo " ! Port 3002 busy. Killing old instance..."
lsof -ti:3002 | xargs kill -9
fi
cd "$SCRIPT_DIR"
node index.js &
NODE_PID=$!
echo " βœ“ Quran-MD server started (PID: $NODE_PID)"
# ── Service 2: Arabic AI TTS (port 3003) ─────────────────────────────────
echo "β–Ά Starting Arabic AI TTS (port 3003)..."
if lsof -ti:3003 > /dev/null 2>&1; then
echo " ! Port 3003 busy. Killing old instance..."
lsof -ti:3003 | xargs kill -9
fi
VENV_PYTHON="$SCRIPT_DIR/tts_venv/bin/python3"
if [ ! -f "$VENV_PYTHON" ]; then
echo " ⚠️ TTS venv not found. Running with system python if available..."
python3 "$SCRIPT_DIR/tts_server.py" &
TTS_PID=$!
else
"$VENV_PYTHON" "$SCRIPT_DIR/tts_server.py" &
TTS_PID=$!
fi
echo " βœ“ AI TTS server started (PID: $TTS_PID)"
echo ""
echo "════════════════════════════"
echo "Services ready on ports 3002 and 3003"
echo "Press Ctrl+C to stop"
wait