-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdev.sh
More file actions
executable file
·72 lines (60 loc) · 1.99 KB
/
Copy pathdev.sh
File metadata and controls
executable file
·72 lines (60 loc) · 1.99 KB
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
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")" && pwd)"
cd "$ROOT"
echo " Starting Veta dev environment..."
echo ""
# Ensure Postgres is running
if ! docker ps --format '{{.Names}}' | grep -q '^veta-pg$'; then
if command -v docker compose &>/dev/null; then
echo " [infra] Starting Postgres via docker compose..."
docker compose up -d
else
echo " [infra] Starting Postgres container..."
docker run -d --name veta-pg \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=veta \
-p 5432:5432 \
postgres:16-alpine
fi
# Wait for Postgres to be ready
until docker exec veta-pg pg_isready -U postgres -d veta &>/dev/null; do
sleep 0.5
done
echo " [infra] Postgres ready."
else
echo " [infra] Postgres already running."
fi
# Backend
echo " [backend] Starting FastAPI server on :8000..."
cd "$ROOT/backend"
# Install deps if missing
if ! pip show veta-backend &>/dev/null; then
pip install -e . -q
fi
# Run migrations
alembic upgrade head &>/dev/null || true
# Start backend in background
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 &
BACKEND_PID=$!
# Frontend
echo " [frontend] Starting Vite dev server on :8080..."
cd "$ROOT/frontend"
# Install deps if missing
if [ ! -d node_modules ]; then
npm install --silent
fi
# Start frontend in foreground (so Ctrl-C kills everything)
trap "kill $BACKEND_PID 2>/dev/null; exit" INT TERM
npm run dev &
FRONTEND_PID=$!
echo ""
echo " ┌──────────────────────────────────────────┐"
echo " │ Veta running │"
echo " │ Frontend : http://localhost:8080 │"
echo " │ Backend : http://localhost:8000 │"
echo " │ API docs : http://localhost:8000/docs │"
echo " └──────────────────────────────────────────┘"
echo ""
wait