-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·70 lines (55 loc) · 1.9 KB
/
start.sh
File metadata and controls
executable file
·70 lines (55 loc) · 1.9 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
#!/bin/zsh
# Load environment variables
source .env
# Configuration
PORT=8000
LOG_LEVEL=${1:-warning} # Default to warning, but allow override with first argument
# Colors for output
GREEN='\033[0;32m'
NC='\033[0m' # No Color
echo -e "Starting GitAuto development environment..."
# Create .venv if it doesn't exist (uv's default)
if [ ! -d ".venv" ]; then
echo -e "Installing dependencies..."
uv sync
fi
source .venv/bin/activate
echo -e "${GREEN}Virtual environment ready${NC}"
# Generate TypedDict schemas directly from PostgreSQL
python3 schemas/supabase/generate_types.py
# Function to cleanup background processes
cleanup() {
echo -e "\nShutting down services..."
# Kill smee-client (background job)
if [ ! -z "$SMEE_PID" ] && kill -0 "$SMEE_PID" 2>/dev/null; then
echo -e "Stopping smee-client..."
kill "$SMEE_PID"
fi
deactivate 2>/dev/null || true
exit 0
}
# Set trap to cleanup on script exit
trap cleanup SIGINT SIGTERM
# Check SMEE_URL is set
if [ -z "$SMEE_URL" ]; then
echo -e "Error: SMEE_URL is not set in .env"
echo -e "Go to https://smee.io and click 'Start a new channel' to get a URL"
exit 1
fi
# Start smee-client in background (forwards GitHub webhooks to localhost)
echo -e "Starting smee-client..."
npx smee-client --url ${SMEE_URL} --target http://localhost:${PORT}/webhook > /dev/null 2>&1 &
SMEE_PID=$!
# Wait for smee-client to start
sleep 2
echo -e "${GREEN}smee-client started!${NC}"
echo -e "Smee: ${SMEE_URL}"
echo -e "FastAPI: http://localhost:${PORT}"
echo -e "\n${GREEN}Starting FastAPI server (logs below)...${NC}"
echo -e "Press Ctrl+C to stop both services\n"
# Configure Python logging level to match uvicorn
if [ "${LOG_LEVEL}" = "info" ]; then
python3 -c "import logging; logging.basicConfig(level=logging.INFO)" &
fi
# Start uvicorn in foreground (logs visible)
uvicorn main:app --reload --port ${PORT} --log-level ${LOG_LEVEL}