Spaces:
Configuration error
Configuration error
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
|