File size: 1,832 Bytes
e7d37f3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | #!/bin/bash
echo "🚀 Iniciando todos os microserviços..."
echo ""
# Diretório base
BASE_DIR="$(pwd)"
# Função para verificar se a porta está em uso
check_port() {
lsof -ti:$1 > /dev/null 2>&1
return $?
}
# Função para iniciar serviço
start_service() {
local name=$1
local dir=$2
local port=$3
echo "Starting $name on port $port..."
# Verificar se porta está em uso
if check_port $port; then
echo " ⚠️ Port $port already in use, skipping $name"
return
fi
cd "$BASE_DIR/$dir"
# Instalar dependências se necessário
if [ ! -d "venv" ]; then
python3 -m venv venv
source venv/bin/activate
pip install -q -r requirements.txt
deactivate
fi
# Iniciar serviço
source venv/bin/activate
nohup python3 *.py > /tmp/$name.log 2>&1 &
local PID=$!
deactivate
echo " ✅ $name started (PID: $PID)"
sleep 1
}
# Iniciar serviços
echo "1️⃣ Starting Whisper Service..."
start_service "whisper" "services/whisper" 5001
echo "2️⃣ Starting LLM Service..."
start_service "llm" "services/llm" 5002
echo "3️⃣ Starting TTS Service..."
start_service "tts" "services/tts" 5003
echo "4️⃣ Starting MuseTalk Service..."
start_service "musetalk" "services/musetalk" 5004
echo "5️⃣ Starting Gateway..."
start_service "gateway" "gateway" 8080
echo ""
echo "✅ All services started!"
echo ""
echo "📊 Service URLs:"
echo " Whisper: http://localhost:5001"
echo " LLM: http://localhost:5002"
echo " TTS: http://localhost:5003"
echo " MuseTalk: http://localhost:5004"
echo " Gateway: http://localhost:8080"
echo ""
echo "🧪 Run tests:"
echo " python3 test_latency.py"
echo ""
echo "🛑 Stop all services:"
echo " ./stop-all.sh"
|