veza/start_mvp.sh

79 lines
2.6 KiB
Bash
Raw Normal View History

#!/bin/bash
# Script de démarrage MVP Veza
# Arrête les services existants, nettoie, puis redémarre tout
set -e
cd "$(dirname "$0")"
echo "🧹 Nettoyage de l'environnement..."
# Arrêter les processus existants
pkill -f "veza-api" 2>/dev/null || true
pkill -f "vite" 2>/dev/null || true
pkill -f "node.*web" 2>/dev/null || true
# Libérer les ports
lsof -ti:8080 | xargs kill -9 2>/dev/null || true
lsof -ti:5173 | xargs kill -9 2>/dev/null || true
lsof -ti:8081 | xargs kill -9 2>/dev/null || true
lsof -ti:8082 | xargs kill -9 2>/dev/null || true
# Nettoyer les fichiers temporaires
rm -f backend.pid frontend.pid backend.log frontend.log 2>/dev/null || true
sleep 2
echo "🔨 Compilation du backend..."
cd veza-backend-api
if [ ! -f "bin/veza-api" ]; then
go build -o bin/veza-api ./cmd/api
echo "✅ Backend compilé"
else
echo "✅ Binaire backend déjà présent"
fi
echo "👤 Création de l'utilisateur de test..."
TEST_EMAIL=test@veza.app TEST_PASSWORD=test123 TEST_USERNAME=testuser go run cmd/tools/create_test_user/main.go 2>&1 | grep -E "(Created|Updated|Email|Username|Password)" || echo "⚠️ Utilisateur peut-être déjà créé"
echo "🚀 Démarrage du backend..."
cd ..
nohup ./veza-backend-api/bin/veza-api > backend.log 2>&1 &
echo $! > backend.pid
echo "✅ Backend démarré (PID: $(cat backend.pid))"
sleep 3
echo "🌐 Démarrage du frontend..."
cd apps/web
nohup npm run dev > ../../frontend.log 2>&1 &
echo $! > ../../frontend.pid
echo "✅ Frontend démarré (PID: $(cat ../../frontend.pid))"
cd ../..
sleep 3
echo ""
echo "═══════════════════════════════════════════════════════════"
echo "✅ MVP Veza démarré avec succès !"
echo "═══════════════════════════════════════════════════════════"
echo ""
echo "🌐 Frontend : http://localhost:5173"
echo "🔧 Backend : http://localhost:8080"
echo ""
echo "🔐 Identifiants de test :"
echo " Email : test@veza.app"
echo " Username : testuser"
echo " Password : test123"
echo ""
echo "📋 Voir les logs :"
echo " Backend : tail -f backend.log"
echo " Frontend : tail -f frontend.log"
echo ""
echo "🛑 Arrêter les services :"
echo " pkill -f veza-api && pkill -f vite"
echo ""
echo "═══════════════════════════════════════════════════════════"