File size: 2,011 Bytes
88f8604
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash

# Antigravity Notebook - Startup Script
# This script starts all services needed for Antigravity Notebook

set -e

echo "======================================"
echo "πŸš€ Antigravity Notebook - Startup"
echo "======================================"

# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

# Check if .env exists
if [ ! -f .env ]; then
    echo -e "${YELLOW}⚠️  .env file not found. Creating from .env.example...${NC}"
    cp .env.example .env
    echo -e "${GREEN}βœ… Created .env file. You may want to customize it.${NC}"
fi

# Start PostgreSQL
echo ""
echo "πŸ“Š Starting PostgreSQL..."
docker-compose up -d

# Wait for PostgreSQL to be ready
echo "⏳ Waiting for PostgreSQL to be ready..."
sleep 5

# Check if database is initialized
echo ""
echo "πŸ”§ Initializing database..."
python -m backend.database

# Start backend in background
echo ""
echo "πŸ–₯️  Starting FastAPI backend..."
echo "   (API will be available at http://localhost:8000)"
python -m backend.main &
BACKEND_PID=$!

# Wait for backend to start
sleep 10

# Start frontend
echo ""
echo "🎨 Starting Streamlit frontend..."
echo "   (UI will be available at http://localhost:8501)"
streamlit run frontend/app_notebook.py &
FRONTEND_PID=$!

echo ""
echo "======================================"
echo -e "${GREEN}βœ… Antigravity Notebook is running!${NC}"
echo "======================================"
echo ""
echo "πŸ“ Services:"
echo "   β€’ Frontend UI:  http://localhost:8501"
echo "   β€’ Backend API:  http://localhost:8000"
echo "   β€’ API Docs:     http://localhost:8000/docs"
echo ""
echo "Press Ctrl+C to stop all services"
echo ""

# Function to cleanup on exit
cleanup() {
    echo ""
    echo "πŸ›‘ Stopping services..."
    kill $BACKEND_PID 2>/dev/null || true
    kill $FRONTEND_PID 2>/dev/null || true
    docker-compose down
    echo "βœ… All services stopped"
    exit 0
}

# Trap Ctrl+C and call cleanup
trap cleanup INT TERM

# Wait for processes
wait