-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
82 lines (68 loc) · 3.03 KB
/
Copy pathstart.sh
File metadata and controls
82 lines (68 loc) · 3.03 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
74
75
76
77
78
79
80
81
82
#!/bin/bash
# ═══════════════════════════════════════════════════════
# 🐙 Octopus AI — Start Script
# Launches both the backend API and frontend dev server
# ═══════════════════════════════════════════════════════
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
echo ""
echo " 🐙 Octopus AI — Starting..."
echo " ═══════════════════════════════"
echo ""
# ── Check Python ──────────────────────────────────────
if ! command -v python3 &> /dev/null; then
echo " ❌ Python 3 is required but not installed."
exit 1
fi
# ── Setup virtual environment if needed ───────────────
if [ ! -d "venv" ]; then
echo " 📦 Creating virtual environment..."
python3 -m venv venv
fi
source venv/bin/activate
# ── Install dependencies ─────────────────────────────
echo " 📦 Installing Python dependencies..."
pip install -q -r backend/requirements.txt
# ── Copy .env if not exists ───────────────────────────
if [ ! -f ".env" ]; then
cp .env.example .env
echo " 📝 Created .env file — please add your API keys!"
fi
# ── Start Backend ─────────────────────────────────────
echo " 🚀 Starting backend on http://localhost:8000"
cd backend
python3 -m uvicorn main:app --host 0.0.0.0 --port 8000 --reload &
BACKEND_PID=$!
cd ..
# ── Start Frontend ────────────────────────────────────
echo " 🎨 Starting frontend on http://localhost:5500"
cd frontend
python3 -m http.server 5500 &
FRONTEND_PID=$!
cd ..
echo ""
echo " ═══════════════════════════════════════════════"
echo " 🐙 Octopus AI is running!"
echo " "
echo " 🎨 Frontend: http://localhost:5500"
echo " ⚙️ Backend: http://localhost:8000"
echo " 📖 API Docs: http://localhost:8000/docs"
echo " "
echo " Press Ctrl+C to stop all services"
echo " ═══════════════════════════════════════════════"
echo ""
# ── Trap SIGINT to kill both processes ────────────────
cleanup() {
echo ""
echo " 🐙 Shutting down Octopus AI..."
kill $BACKEND_PID 2>/dev/null
kill $FRONTEND_PID 2>/dev/null
wait $BACKEND_PID 2>/dev/null
wait $FRONTEND_PID 2>/dev/null
echo " 👋 Goodbye!"
exit 0
}
trap cleanup SIGINT SIGTERM
# Wait for both processes
wait