-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·127 lines (106 loc) · 3.12 KB
/
install.sh
File metadata and controls
executable file
·127 lines (106 loc) · 3.12 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
#!/usr/bin/env bash
set -euo pipefail
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BACKEND_DIR="$PROJECT_ROOT/backend"
FRONTEND_DIR="$PROJECT_ROOT/frontend"
LOCAL_BIN_DIR="${HOME}/.local/bin"
add_local_bin_to_path() {
if [ -d "$LOCAL_BIN_DIR" ] && [[ ":$PATH:" != *":$LOCAL_BIN_DIR:"* ]]; then
export PATH="$LOCAL_BIN_DIR:$PATH"
fi
}
install_uv() {
echo " Installing uv..."
if command -v curl >/dev/null 2>&1; then
curl -LsSf https://astral.sh/uv/install.sh | sh
elif command -v wget >/dev/null 2>&1; then
wget -qO- https://astral.sh/uv/install.sh | sh
else
echo " [ERROR] curl or wget is required to install uv automatically"
return 1
fi
add_local_bin_to_path
command -v uv >/dev/null 2>&1
}
check_uv() {
echo " uv:"
if command -v uv >/dev/null 2>&1; then
uv --version | sed 's/^/ /'
return
fi
echo " [NOT INSTALLED]"
if ! install_uv; then
echo " [ERROR] Failed to install uv automatically"
echo " Please install it manually and rerun ./install.sh"
exit 1
fi
echo " [OK] uv installed"
}
check_node() {
echo " Node.js:"
if command -v node >/dev/null 2>&1; then
node --version | sed 's/^/ /'
return
fi
echo " [NOT INSTALLED] Please install Node.js 18+ and rerun ./install.sh"
exit 1
}
install_backend() {
echo
echo "================================================"
echo " Installing Backend Dependencies"
echo "================================================"
echo
cd "$BACKEND_DIR"
echo "[INSTALL] Syncing Python packages with uv..."
uv sync
echo "[CHECK] Verifying backend runtime dependencies..."
if ! uv run python -c "import fastapi, uvicorn, annotated_doc" >/dev/null 2>&1; then
echo "[ERROR] Backend runtime dependency verification failed"
echo "[TIP] Retry: cd backend && uv sync"
exit 1
fi
}
install_frontend() {
local reinstall_choice="n"
echo
echo "================================================"
echo " Installing Frontend Dependencies"
echo "================================================"
echo
cd "$FRONTEND_DIR"
if [ -d "node_modules" ]; then
read -r -p "node_modules exists. Reinstall? [y/N]: " reinstall_choice
if [[ "$reinstall_choice" =~ ^[Yy]$ ]]; then
echo "[CLEAN] Removing old node_modules..."
rm -rf node_modules
else
echo "[SKIP] Keeping existing dependencies"
return
fi
fi
echo "[INSTALL] npm packages (this may take a few minutes)..."
npm install
}
add_local_bin_to_path
echo "================================================"
echo " OKX Quantitative Trading System"
echo " Install Dependencies"
echo "================================================"
echo
echo "[CHECK] System environment..."
echo
check_uv
check_node
install_backend
install_frontend
echo
echo "================================================"
echo " Installation Complete"
echo "================================================"
echo
echo " All dependencies installed successfully."
echo
echo " Next steps:"
echo " 1. Configure config/.env if needed"
echo " 2. Run ./start.sh to start the system"