-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
127 lines (100 loc) · 3.78 KB
/
start.sh
File metadata and controls
127 lines (100 loc) · 3.78 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/bash
# AXONENGINE v4.0 — Drug Discovery AI Quick Start (Separate Terminals)
# ====================================================================
echo "🧬 Drug Discovery AI — Quick Start (Separate Terminals)"
echo "========================================================"
echo ""
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Detect available terminal emulator
TERMINAL=""
if command -v gnome-terminal &> /dev/null; then
TERMINAL="gnome-terminal"
elif command -v xterm &> /dev/null; then
TERMINAL="xterm"
elif command -v konsole &> /dev/null; then
TERMINAL="konsole"
elif command -v xfce4-terminal &> /dev/null; then
TERMINAL="xfce4-terminal"
fi
# ── Backend Launcher Script ──────────────────────────────────────────────────
cat > "$SCRIPT_DIR/backend_launcher.sh" << 'BACKEND_SCRIPT'
#!/bin/bash
cd "$(dirname "$0")/backend"
# Setup environment
if [ ! -f ".env" ]; then
[ -f ".env.example" ] && cp .env.example .env
fi
if [ ! -d ".venv" ]; then
python3 -m venv .venv
fi
source .venv/bin/activate
echo "Installing backend dependencies..."
pip install -q -r requirements.txt 2>/dev/null || pip install -r requirements.txt
echo ""
echo "🚀 Backend Starting..."
echo "📡 API: http://localhost:8000"
echo "📖 Docs: http://localhost:8000/docs"
echo ""
uvicorn main:app --reload --host 0.0.0.0 --port 8000
# Keep terminal open on exit
read -p "Press Enter to close..."
BACKEND_SCRIPT
chmod +x "$SCRIPT_DIR/backend_launcher.sh"
# ── Frontend Launcher Script ─────────────────────────────────────────────────
cat > "$SCRIPT_DIR/frontend_launcher.sh" << 'FRONTEND_SCRIPT'
#!/bin/bash
cd "$(dirname "$0")/frontend"
if [ ! -f ".env.local" ]; then
cat > .env.local << 'EOF'
NEXT_PUBLIC_API_URL=http://localhost:8000
EOF
fi
if [ ! -d "node_modules" ]; then
echo "Installing frontend dependencies..."
npm install
fi
echo ""
echo "🚀 Frontend Starting..."
echo "🌐 App: http://localhost:3000"
echo ""
npm run dev
# Keep terminal open on exit
read -p "Press Enter to close..."
FRONTEND_SCRIPT
chmod +x "$SCRIPT_DIR/frontend_launcher.sh"
# ── Launch Terminals ────────────────────────────────────────────────────────
echo "Launching services in separate terminals..."
echo ""
if [ "$TERMINAL" = "gnome-terminal" ]; then
gnome-terminal -- bash -c "$SCRIPT_DIR/backend_launcher.sh" &
sleep 1
gnome-terminal -- bash -c "$SCRIPT_DIR/frontend_launcher.sh" &
elif [ "$TERMINAL" = "xterm" ]; then
xterm -e bash "$SCRIPT_DIR/backend_launcher.sh" &
sleep 1
xterm -e bash "$SCRIPT_DIR/frontend_launcher.sh" &
elif [ "$TERMINAL" = "konsole" ]; then
konsole -e bash "$SCRIPT_DIR/backend_launcher.sh" &
sleep 1
konsole -e bash "$SCRIPT_DIR/frontend_launcher.sh" &
elif [ "$TERMINAL" = "xfce4-terminal" ]; then
xfce4-terminal -e "bash $SCRIPT_DIR/backend_launcher.sh" &
sleep 1
xfce4-terminal -e "bash $SCRIPT_DIR/frontend_launcher.sh" &
else
echo "❌ No compatible terminal emulator found."
echo ""
echo "Install one of: gnome-terminal, xterm, konsole, xfce4-terminal"
echo ""
echo "Or run manually:"
echo " Terminal 1: bash $SCRIPT_DIR/backend_launcher.sh"
echo " Terminal 2: bash $SCRIPT_DIR/frontend_launcher.sh"
exit 1
fi
echo "✅ Services launching in separate terminals..."
echo ""
echo "Frontend: http://localhost:3000"
echo "Backend: http://localhost:8000"
echo "API Docs: http://localhost:8000/docs"
echo ""
echo "Close the terminal windows to stop services."