Files
roaauto/start.sh
Claude Agent d93a7b2903 fix(start): remove alembic stamp head fallback to prevent silent migration skip
stamp head was masking failed migrations by marking them as applied
without actually running them, causing missing columns at runtime.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 23:17:20 +00:00

61 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
ROOT="$(cd "$(dirname "$0")" && pwd)"
PORTS=(8000 5173)
# --- Elibereaza porturile ---
echo "Eliberez porturile..."
for PORT in "${PORTS[@]}"; do
PIDS=$(lsof -ti tcp:$PORT 2>/dev/null)
if [ -n "$PIDS" ]; then
echo " Port $PORT ocupat de PID(s): $PIDS — opresc..."
kill -9 $PIDS 2>/dev/null
else
echo " Port $PORT liber."
fi
done
# --- Backend ---
echo ""
echo "Pornesc backend-ul..."
cd "$ROOT/backend"
if [ ! -d ".venv" ]; then
echo " Creez virtualenv..."
python3 -m venv .venv
fi
source .venv/bin/activate
echo " Instalez requirements..."
pip install -q -r requirements.txt
echo " Rulez migratiile..."
PYTHONPATH="$ROOT/backend" alembic upgrade head 2>&1 || echo " Avertisment: migrare cu erori (verifica manual)"
echo " Pornesc uvicorn pe portul 8000..."
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload &
BACKEND_PID=$!
# --- Frontend ---
echo ""
echo "Pornesc frontend-ul..."
cd "$ROOT/frontend"
echo " Instalez npm packages..."
npm install --silent
echo " Pornesc Vite pe portul 5173..."
npm run dev &
FRONTEND_PID=$!
# --- Asteapta Ctrl+C ---
echo ""
echo "Servicii pornite. Apasa Ctrl+C pentru a opri."
echo " Backend: http://localhost:8000"
echo " Frontend: http://localhost:5173"
echo ""
trap "echo ''; echo 'Opresc serviciile...'; kill $BACKEND_PID $FRONTEND_PID 2>/dev/null; exit 0" SIGINT SIGTERM
wait