-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·73 lines (62 loc) · 1.75 KB
/
start.sh
File metadata and controls
executable file
·73 lines (62 loc) · 1.75 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
73
#!/usr/bin/env bash
set -e
cleanup() {
echo ""
echo "==> Shutting down..."
kill $BACKEND_PID $FRONTEND_PID 2>/dev/null
wait $BACKEND_PID $FRONTEND_PID 2>/dev/null
echo " Done"
}
trap cleanup EXIT
echo "==> Installing backend dependencies..."
uv sync --all-extras
echo ""
echo "==> Installing frontend dependencies..."
cd frontend && pnpm install && cd ..
echo ""
echo "==> Setting up environment..."
if [ ! -f .env ]; then
cp .env.example .env
echo " Created .env from .env.example"
fi
# Check if API key is set
if grep -q "LLM_API_KEY=your-api-key-here" .env || grep -q "LLM_API_KEY=$" .env; then
echo ""
echo " Enter your WRITER_API_KEY (from the email with task instructions):"
read -r API_KEY
if [ -z "$API_KEY" ]; then
echo " ⚠ No API key provided. Exiting."
exit 1
fi
sed -i '' "s|LLM_API_KEY=.*|LLM_API_KEY=$API_KEY|" .env
echo " API key saved to .env"
else
echo " .env already configured"
fi
echo ""
echo "==> Starting Docker services (Postgres + Redis)..."
docker compose up -d
echo ""
echo "==> Waiting for Postgres to be ready..."
until docker compose exec -T postgres pg_isready -U interview > /dev/null 2>&1; do
sleep 1
done
echo " Postgres is ready"
echo ""
echo "==> Starting backend on http://localhost:8000..."
uv run uvicorn backend.main:app --reload --port 8000 &
BACKEND_PID=$!
echo "==> Starting frontend on http://localhost:3000..."
cd frontend && pnpm dev &
FRONTEND_PID=$!
cd ..
echo ""
echo "============================================"
echo " App is running!"
echo ""
echo " Backend: http://localhost:8000"
echo " Frontend: http://localhost:3000"
echo ""
echo " Press Ctrl+C to stop"
echo "============================================"
wait