@hummingbot/skills 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -0
- package/package.json +28 -0
- package/skills/candles-feed/SKILL.md +259 -0
- package/skills/candles-feed/scripts/calculate_indicator.sh +359 -0
- package/skills/candles-feed/scripts/get_candles.sh +158 -0
- package/skills/candles-feed/scripts/get_funding_rate.sh +112 -0
- package/skills/candles-feed/scripts/get_price.sh +86 -0
- package/skills/candles-feed/scripts/list_candle_connectors.sh +47 -0
- package/skills/executor-creator/SKILL.md +212 -0
- package/skills/executor-creator/scripts/clear_position.sh +54 -0
- package/skills/executor-creator/scripts/create_executor.sh +92 -0
- package/skills/executor-creator/scripts/get_executor.sh +37 -0
- package/skills/executor-creator/scripts/get_executor_schema.sh +37 -0
- package/skills/executor-creator/scripts/get_executors_summary.sh +30 -0
- package/skills/executor-creator/scripts/get_position.sh +44 -0
- package/skills/executor-creator/scripts/get_positions.sh +30 -0
- package/skills/executor-creator/scripts/list_executor_types.sh +30 -0
- package/skills/executor-creator/scripts/list_executors.sh +52 -0
- package/skills/executor-creator/scripts/setup_executor.sh +197 -0
- package/skills/executor-creator/scripts/stop_executor.sh +54 -0
- package/skills/hummingbot-api-setup/SKILL.md +308 -0
- package/skills/hummingbot-api-setup/references/original_setup.sh +628 -0
- package/skills/hummingbot-api-setup/scripts/check_prerequisites.sh +92 -0
- package/skills/hummingbot-api-setup/scripts/deploy_full_stack.sh +151 -0
- package/skills/hummingbot-api-setup/scripts/health_check.sh +100 -0
- package/skills/hummingbot-api-setup/scripts/step1_detect_system.sh +88 -0
- package/skills/hummingbot-api-setup/scripts/step2_check_dependencies.sh +81 -0
- package/skills/keys-manager/SKILL.md +132 -0
- package/skills/keys-manager/scripts/add_credentials.sh +106 -0
- package/skills/keys-manager/scripts/get_connector_config.sh +67 -0
- package/skills/keys-manager/scripts/list_account_credentials.sh +82 -0
- package/skills/keys-manager/scripts/list_connectors.sh +64 -0
- package/skills/keys-manager/scripts/remove_credentials.sh +79 -0
- package/skills/keys-manager/scripts/setup_connector.sh +214 -0
- package/skills.json +137 -0
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# Hummingbot Deploy Instance Installer
|
|
4
|
+
# Original source: https://github.com/hummingbot/deploy/blob/main/setup.sh
|
|
5
|
+
#
|
|
6
|
+
# This script sets up Hummingbot instances with optional Hummingbot API integration.
|
|
7
|
+
# Each repository manages its own docker-compose and setup via Makefile.
|
|
8
|
+
set -eu
|
|
9
|
+
# --- Configuration ---
|
|
10
|
+
CONDOR_REPO="https://github.com/hummingbot/condor.git"
|
|
11
|
+
API_REPO="https://github.com/hummingbot/hummingbot-api.git"
|
|
12
|
+
CONDOR_DIR="condor"
|
|
13
|
+
API_DIR="hummingbot-api"
|
|
14
|
+
DOCKER_COMPOSE="" # Will be set by detect_docker_compose()
|
|
15
|
+
# --- Color Codes ---
|
|
16
|
+
RED='\033[0;31m'
|
|
17
|
+
GREEN='\033[0;32m'
|
|
18
|
+
YELLOW='\033[1;33m'
|
|
19
|
+
BLUE='\033[0;34m'
|
|
20
|
+
PURPLE='\033[0;35m'
|
|
21
|
+
CYAN='\033[0;36m'
|
|
22
|
+
NC='\033[0m'
|
|
23
|
+
# --- Track directories we create for cleanup ---
|
|
24
|
+
CREATED_DIRS=()
|
|
25
|
+
# --- Cleanup trap ---
|
|
26
|
+
cleanup() {
|
|
27
|
+
local exit_code=$?
|
|
28
|
+
# Remove any partial downloads
|
|
29
|
+
rm -f get-docker.sh 2>/dev/null || true
|
|
30
|
+
|
|
31
|
+
# If we're exiting with an error, remove partial git clones we created
|
|
32
|
+
if [ $exit_code -ne 0 ]; then
|
|
33
|
+
for dir in "${CREATED_DIRS[@]}"; do
|
|
34
|
+
if [ -d "$dir" ]; then
|
|
35
|
+
msg_warn "Cleaning up partial installation: $dir"
|
|
36
|
+
rm -rf "$dir" 2>/dev/null || true
|
|
37
|
+
fi
|
|
38
|
+
done
|
|
39
|
+
fi
|
|
40
|
+
}
|
|
41
|
+
trap cleanup EXIT
|
|
42
|
+
# --- Helper Functions ---
|
|
43
|
+
msg_info() {
|
|
44
|
+
echo -e "${CYAN}[INFO] $1${NC}"
|
|
45
|
+
}
|
|
46
|
+
msg_ok() {
|
|
47
|
+
echo -e "${GREEN}[OK] $1${NC}"
|
|
48
|
+
}
|
|
49
|
+
msg_warn() {
|
|
50
|
+
echo -e "${YELLOW}[WARN] $1${NC}" >&2
|
|
51
|
+
}
|
|
52
|
+
msg_error() {
|
|
53
|
+
echo -e "${RED}[ERROR] $1${NC}" >&2
|
|
54
|
+
}
|
|
55
|
+
prompt() {
|
|
56
|
+
echo -en "${PURPLE}$1${NC}" > /dev/tty
|
|
57
|
+
}
|
|
58
|
+
prompt_visible() {
|
|
59
|
+
prompt "$1"
|
|
60
|
+
read -r val < /dev/tty || val=""
|
|
61
|
+
echo "$val"
|
|
62
|
+
}
|
|
63
|
+
prompt_default() {
|
|
64
|
+
prompt "$1 [$2]: "
|
|
65
|
+
read -r val < /dev/tty || val=""
|
|
66
|
+
echo "${val:-$2}"
|
|
67
|
+
}
|
|
68
|
+
prompt_yesno() {
|
|
69
|
+
while true; do
|
|
70
|
+
prompt "$1 (y/n): "
|
|
71
|
+
read -r val < /dev/tty || val=""
|
|
72
|
+
case "$val" in
|
|
73
|
+
[Yy]) echo "y"; return ;;
|
|
74
|
+
[Nn]) echo "n"; return ;;
|
|
75
|
+
*) msg_warn "Please answer 'y' or 'n'" ;;
|
|
76
|
+
esac
|
|
77
|
+
done
|
|
78
|
+
}
|
|
79
|
+
command_exists() {
|
|
80
|
+
command -v "$1" >/dev/null 2>&1
|
|
81
|
+
}
|
|
82
|
+
# Check if running in interactive mode
|
|
83
|
+
is_interactive() {
|
|
84
|
+
if [[ -t 0 ]] && [[ -t 1 ]] && [[ "${TERM:-dumb}" != "dumb" ]]; then
|
|
85
|
+
return 0
|
|
86
|
+
fi
|
|
87
|
+
if [[ -c /dev/tty ]] && [[ -w /dev/tty ]]; then
|
|
88
|
+
return 0
|
|
89
|
+
fi
|
|
90
|
+
return 1
|
|
91
|
+
}
|
|
92
|
+
# Check if running inside a container
|
|
93
|
+
is_container() {
|
|
94
|
+
[ -f /.dockerenv ] || grep -q docker /proc/1/cgroup 2>/dev/null || grep -q containerd /proc/1/cgroup 2>/dev/null
|
|
95
|
+
}
|
|
96
|
+
# --- Parse Command Line Arguments ---
|
|
97
|
+
UPGRADE_MODE="n"
|
|
98
|
+
API_ONLY_MODE="n"
|
|
99
|
+
while [[ $# -gt 0 ]]; do
|
|
100
|
+
case $1 in
|
|
101
|
+
--upgrade)
|
|
102
|
+
UPGRADE_MODE="y"
|
|
103
|
+
shift
|
|
104
|
+
;;
|
|
105
|
+
--api)
|
|
106
|
+
API_ONLY_MODE="y"
|
|
107
|
+
shift
|
|
108
|
+
;;
|
|
109
|
+
-h|--help)
|
|
110
|
+
echo "Usage: $0 [OPTIONS]"
|
|
111
|
+
echo ""
|
|
112
|
+
echo "Options:"
|
|
113
|
+
echo " --upgrade Upgrade existing installation"
|
|
114
|
+
echo " --api Install only Hummingbot API (standalone)"
|
|
115
|
+
echo " -h, --help Show this help message"
|
|
116
|
+
echo ""
|
|
117
|
+
echo "Examples:"
|
|
118
|
+
echo " $0 Fresh installation (Condor + optional API)"
|
|
119
|
+
echo " $0 --upgrade Upgrade existing installations"
|
|
120
|
+
echo " $0 --api Install only Hummingbot API"
|
|
121
|
+
exit 0
|
|
122
|
+
;;
|
|
123
|
+
*)
|
|
124
|
+
msg_error "Unknown option: $1"
|
|
125
|
+
echo "Use -h or --help for usage information."
|
|
126
|
+
exit 1
|
|
127
|
+
;;
|
|
128
|
+
esac
|
|
129
|
+
done
|
|
130
|
+
# --- Installation and Setup Functions ---
|
|
131
|
+
detect_os_arch() {
|
|
132
|
+
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
133
|
+
ARCH=$(uname -m)
|
|
134
|
+
case "$ARCH" in
|
|
135
|
+
x86_64|amd64) ARCH="amd64" ;;
|
|
136
|
+
aarch64|arm64) ARCH="arm64" ;;
|
|
137
|
+
armv7*|armv8*) ARCH="arm" ;;
|
|
138
|
+
armv*) ARCH="arm" ;;
|
|
139
|
+
*) msg_warn "Unknown architecture: $ARCH, defaulting to amd64"; ARCH="amd64" ;;
|
|
140
|
+
esac
|
|
141
|
+
msg_info "Detected OS: $OS, Architecture: $ARCH"
|
|
142
|
+
|
|
143
|
+
if [[ "$OS" == "darwin" ]]; then
|
|
144
|
+
if [[ -x "/opt/homebrew/bin/brew" ]]; then
|
|
145
|
+
eval "$(/opt/homebrew/bin/brew shellenv)"
|
|
146
|
+
elif [[ -x "/usr/local/bin/brew" ]]; then
|
|
147
|
+
eval "$(/usr/local/bin/brew shellenv)"
|
|
148
|
+
fi
|
|
149
|
+
fi
|
|
150
|
+
}
|
|
151
|
+
detect_docker_compose() {
|
|
152
|
+
if docker compose version >/dev/null 2>&1; then
|
|
153
|
+
DOCKER_COMPOSE="docker compose"
|
|
154
|
+
msg_info "Using Docker Compose plugin"
|
|
155
|
+
elif command_exists docker-compose; then
|
|
156
|
+
DOCKER_COMPOSE="docker-compose"
|
|
157
|
+
msg_info "Using standalone docker-compose"
|
|
158
|
+
else
|
|
159
|
+
msg_error "Neither docker-compose nor docker compose plugin found"
|
|
160
|
+
exit 1
|
|
161
|
+
fi
|
|
162
|
+
}
|
|
163
|
+
check_docker_running() {
|
|
164
|
+
if ! docker info >/dev/null 2>&1; then
|
|
165
|
+
if [[ "$OS" == "darwin" ]]; then
|
|
166
|
+
msg_error "Docker Desktop is not running."
|
|
167
|
+
msg_info "Please start Docker Desktop and try again."
|
|
168
|
+
else
|
|
169
|
+
msg_error "Docker daemon is not running."
|
|
170
|
+
msg_info "Please start Docker and try again."
|
|
171
|
+
if command_exists systemctl; then
|
|
172
|
+
msg_info "Try: sudo systemctl start docker"
|
|
173
|
+
elif command_exists service; then
|
|
174
|
+
msg_info "Try: sudo service docker start"
|
|
175
|
+
fi
|
|
176
|
+
fi
|
|
177
|
+
exit 1
|
|
178
|
+
fi
|
|
179
|
+
msg_ok "Docker daemon is running"
|
|
180
|
+
}
|
|
181
|
+
check_disk_space() {
|
|
182
|
+
local required_mb=2048
|
|
183
|
+
local available_mb
|
|
184
|
+
|
|
185
|
+
if [[ "$OS" == "linux" ]]; then
|
|
186
|
+
available_mb=$(df -m . 2>/dev/null | tail -1 | awk '{print $4}')
|
|
187
|
+
elif [[ "$OS" == "darwin" ]]; then
|
|
188
|
+
available_mb=$(df -m . 2>/dev/null | tail -1 | awk '{print $4}')
|
|
189
|
+
else
|
|
190
|
+
return
|
|
191
|
+
fi
|
|
192
|
+
|
|
193
|
+
if [[ -n "$available_mb" ]] && [[ $available_mb -lt $required_mb ]]; then
|
|
194
|
+
msg_error "Insufficient disk space. Need ${required_mb}MB, have ${available_mb}MB"
|
|
195
|
+
exit 1
|
|
196
|
+
fi
|
|
197
|
+
msg_ok "Sufficient disk space available (${available_mb}MB)"
|
|
198
|
+
}
|
|
199
|
+
install_dependencies() {
|
|
200
|
+
msg_info "Checking for dependencies..."
|
|
201
|
+
|
|
202
|
+
MISSING_DEPS=()
|
|
203
|
+
|
|
204
|
+
if ! command_exists git; then
|
|
205
|
+
MISSING_DEPS+=("git")
|
|
206
|
+
fi
|
|
207
|
+
if ! command_exists curl; then
|
|
208
|
+
MISSING_DEPS+=("curl")
|
|
209
|
+
fi
|
|
210
|
+
if ! command_exists docker; then
|
|
211
|
+
MISSING_DEPS+=("docker")
|
|
212
|
+
fi
|
|
213
|
+
|
|
214
|
+
if ! (command_exists docker-compose || (command_exists docker && docker compose version >/dev/null 2>&1)); then
|
|
215
|
+
MISSING_DEPS+=("docker-compose")
|
|
216
|
+
fi
|
|
217
|
+
|
|
218
|
+
if ! command_exists make; then
|
|
219
|
+
MISSING_DEPS+=("make")
|
|
220
|
+
fi
|
|
221
|
+
if [ ${#MISSING_DEPS[@]} -eq 0 ]; then
|
|
222
|
+
msg_ok "All dependencies (git, curl, docker, docker-compose, make) are already installed."
|
|
223
|
+
return
|
|
224
|
+
fi
|
|
225
|
+
|
|
226
|
+
msg_warn "The following dependencies are missing: ${MISSING_DEPS[*]}"
|
|
227
|
+
|
|
228
|
+
if [[ "$OS" != "linux" ]]; then
|
|
229
|
+
msg_error "Please install missing dependencies manually:"
|
|
230
|
+
for dep in "${MISSING_DEPS[@]}"; do
|
|
231
|
+
echo " - $dep"
|
|
232
|
+
done
|
|
233
|
+
if [[ "$OS" == "darwin" ]]; then
|
|
234
|
+
msg_info "On macOS, consider using Homebrew: https://brew.sh"
|
|
235
|
+
fi
|
|
236
|
+
exit 1
|
|
237
|
+
fi
|
|
238
|
+
|
|
239
|
+
if ! is_interactive; then
|
|
240
|
+
msg_error "Running in non-interactive mode. Please install the missing dependencies manually."
|
|
241
|
+
exit 1
|
|
242
|
+
fi
|
|
243
|
+
|
|
244
|
+
if [[ $EUID -ne 0 ]]; then
|
|
245
|
+
if ! command_exists sudo; then
|
|
246
|
+
msg_error "Missing dependencies require root/sudo privileges."
|
|
247
|
+
msg_info "Please run this script with sudo or install the missing dependencies manually."
|
|
248
|
+
exit 1
|
|
249
|
+
fi
|
|
250
|
+
SUDO_CMD="sudo"
|
|
251
|
+
else
|
|
252
|
+
SUDO_CMD=""
|
|
253
|
+
fi
|
|
254
|
+
|
|
255
|
+
echo ""
|
|
256
|
+
msg_warn "Some dependencies are missing and need to be installed."
|
|
257
|
+
INSTALL_DEPS=$(prompt_yesno "Would you like to install them automatically?")
|
|
258
|
+
|
|
259
|
+
if [ "$INSTALL_DEPS" != "y" ]; then
|
|
260
|
+
msg_error "Installation cannot proceed without required dependencies."
|
|
261
|
+
exit 1
|
|
262
|
+
fi
|
|
263
|
+
|
|
264
|
+
msg_info "Installing dependencies..."
|
|
265
|
+
|
|
266
|
+
if command_exists apt-get; then
|
|
267
|
+
PKG_MANAGER="apt-get"
|
|
268
|
+
UPDATE_CMD="$SUDO_CMD apt-get update"
|
|
269
|
+
INSTALL_CMD="$SUDO_CMD apt-get install -y"
|
|
270
|
+
elif command_exists yum; then
|
|
271
|
+
PKG_MANAGER="yum"
|
|
272
|
+
UPDATE_CMD="$SUDO_CMD yum check-update || true"
|
|
273
|
+
INSTALL_CMD="$SUDO_CMD yum install -y"
|
|
274
|
+
elif command_exists dnf; then
|
|
275
|
+
PKG_MANAGER="dnf"
|
|
276
|
+
UPDATE_CMD="$SUDO_CMD dnf check-update || true"
|
|
277
|
+
INSTALL_CMD="$SUDO_CMD dnf install -y"
|
|
278
|
+
elif command_exists apk; then
|
|
279
|
+
PKG_MANAGER="apk"
|
|
280
|
+
UPDATE_CMD="$SUDO_CMD apk update"
|
|
281
|
+
INSTALL_CMD="$SUDO_CMD apk add"
|
|
282
|
+
elif command_exists pacman; then
|
|
283
|
+
PKG_MANAGER="pacman"
|
|
284
|
+
UPDATE_CMD="$SUDO_CMD pacman -Sy"
|
|
285
|
+
INSTALL_CMD="$SUDO_CMD pacman -S --noconfirm"
|
|
286
|
+
else
|
|
287
|
+
msg_error "Could not detect a supported package manager (apt-get, yum, dnf, apk, pacman)."
|
|
288
|
+
msg_info "Please install the following packages manually: ${MISSING_DEPS[*]}"
|
|
289
|
+
exit 1
|
|
290
|
+
fi
|
|
291
|
+
|
|
292
|
+
msg_info "Updating package lists..."
|
|
293
|
+
if ! eval "$UPDATE_CMD"; then
|
|
294
|
+
msg_warn "Failed to update package lists, continuing anyway..."
|
|
295
|
+
fi
|
|
296
|
+
|
|
297
|
+
for dep in "${MISSING_DEPS[@]}"; do
|
|
298
|
+
case $dep in
|
|
299
|
+
docker)
|
|
300
|
+
msg_info "Installing Docker..."
|
|
301
|
+
if command_exists curl; then
|
|
302
|
+
curl -fsSL https://get.docker.com -o get-docker.sh
|
|
303
|
+
if ! $SUDO_CMD sh get-docker.sh; then
|
|
304
|
+
msg_error "Failed to install Docker via get.docker.com"
|
|
305
|
+
exit 1
|
|
306
|
+
fi
|
|
307
|
+
rm -f get-docker.sh
|
|
308
|
+
|
|
309
|
+
if [[ $EUID -ne 0 ]] && command_exists usermod; then
|
|
310
|
+
$SUDO_CMD usermod -aG docker "$USER" || true
|
|
311
|
+
msg_info "Added $USER to docker group. You may need to log out and back in for this to take effect."
|
|
312
|
+
fi
|
|
313
|
+
else
|
|
314
|
+
msg_error "curl is required to install Docker automatically"
|
|
315
|
+
exit 1
|
|
316
|
+
fi
|
|
317
|
+
;;
|
|
318
|
+
docker-compose)
|
|
319
|
+
msg_info "Installing docker-compose..."
|
|
320
|
+
if [[ "$PKG_MANAGER" == "apt-get" ]]; then
|
|
321
|
+
if ! eval "$INSTALL_CMD docker-compose-plugin"; then
|
|
322
|
+
msg_warn "Failed to install docker-compose-plugin, trying standalone..."
|
|
323
|
+
eval "$INSTALL_CMD docker-compose" || {
|
|
324
|
+
msg_error "Failed to install docker-compose"
|
|
325
|
+
exit 1
|
|
326
|
+
}
|
|
327
|
+
fi
|
|
328
|
+
else
|
|
329
|
+
eval "$INSTALL_CMD docker-compose" || {
|
|
330
|
+
msg_error "Failed to install docker-compose"
|
|
331
|
+
exit 1
|
|
332
|
+
}
|
|
333
|
+
fi
|
|
334
|
+
;;
|
|
335
|
+
*)
|
|
336
|
+
msg_info "Installing $dep..."
|
|
337
|
+
if ! eval "$INSTALL_CMD $dep"; then
|
|
338
|
+
msg_error "Failed to install $dep"
|
|
339
|
+
exit 1
|
|
340
|
+
fi
|
|
341
|
+
;;
|
|
342
|
+
esac
|
|
343
|
+
done
|
|
344
|
+
|
|
345
|
+
msg_ok "All dependencies installed successfully!"
|
|
346
|
+
|
|
347
|
+
if [[ " ${MISSING_DEPS[*]} " =~ " docker " ]]; then
|
|
348
|
+
msg_info "Starting Docker service..."
|
|
349
|
+
if command_exists systemctl; then
|
|
350
|
+
$SUDO_CMD systemctl start docker
|
|
351
|
+
$SUDO_CMD systemctl enable docker
|
|
352
|
+
elif command_exists service; then
|
|
353
|
+
$SUDO_CMD service docker start
|
|
354
|
+
fi
|
|
355
|
+
sleep 2
|
|
356
|
+
fi
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
run_upgrade() {
|
|
360
|
+
msg_info "Existing installation detected. Starting upgrade/installation process..."
|
|
361
|
+
|
|
362
|
+
if [ -d "$CONDOR_DIR" ]; then
|
|
363
|
+
msg_info "Upgrading Condor..."
|
|
364
|
+
if ! (cd "$CONDOR_DIR" && git pull); then
|
|
365
|
+
msg_error "Failed to update Condor repository"
|
|
366
|
+
exit 1
|
|
367
|
+
fi
|
|
368
|
+
msg_ok "Condor repository updated."
|
|
369
|
+
else
|
|
370
|
+
msg_warn "Condor directory not found, skipping Condor upgrade."
|
|
371
|
+
fi
|
|
372
|
+
|
|
373
|
+
if [ -d "$CONDOR_DIR" ] && [ ! -d "$API_DIR" ]; then
|
|
374
|
+
echo ""
|
|
375
|
+
msg_info "Hummingbot API is not installed yet."
|
|
376
|
+
INSTALL_API=$(prompt_yesno "Do you want to install Hummingbot API now?")
|
|
377
|
+
|
|
378
|
+
if [ "$INSTALL_API" = "y" ]; then
|
|
379
|
+
echo ""
|
|
380
|
+
echo -e "${BLUE}Installing Hummingbot API:${NC}"
|
|
381
|
+
msg_info "Cloning Hummingbot API repository..."
|
|
382
|
+
CREATED_DIRS+=("$API_DIR")
|
|
383
|
+
if ! git clone --depth 1 "$API_REPO" "$API_DIR"; then
|
|
384
|
+
msg_error "Failed to clone Hummingbot API repository"
|
|
385
|
+
exit 1
|
|
386
|
+
fi
|
|
387
|
+
|
|
388
|
+
msg_info "Setting up Hummingbot API (running: make setup)..."
|
|
389
|
+
if ! (cd "$API_DIR" && make setup); then
|
|
390
|
+
msg_error "Failed to run make setup for Hummingbot API"
|
|
391
|
+
exit 1
|
|
392
|
+
fi
|
|
393
|
+
|
|
394
|
+
msg_info "Deploying Hummingbot API (running: make deploy)..."
|
|
395
|
+
if ! (cd "$API_DIR" && make deploy); then
|
|
396
|
+
msg_error "Failed to deploy Hummingbot API"
|
|
397
|
+
exit 1
|
|
398
|
+
fi
|
|
399
|
+
msg_ok "Hummingbot API installation complete!"
|
|
400
|
+
fi
|
|
401
|
+
elif [ -d "$API_DIR" ]; then
|
|
402
|
+
msg_info "Upgrading Hummingbot API..."
|
|
403
|
+
if ! (cd "$API_DIR" && git pull); then
|
|
404
|
+
msg_error "Failed to update Hummingbot API repository"
|
|
405
|
+
exit 1
|
|
406
|
+
fi
|
|
407
|
+
msg_ok "Hummingbot API repository updated."
|
|
408
|
+
fi
|
|
409
|
+
|
|
410
|
+
msg_info "Pulling latest Docker images..."
|
|
411
|
+
|
|
412
|
+
if [ -f "$CONDOR_DIR/docker-compose.yml" ]; then
|
|
413
|
+
msg_info "Updating Condor container..."
|
|
414
|
+
if ! (cd "$CONDOR_DIR" && $DOCKER_COMPOSE pull); then
|
|
415
|
+
msg_warn "Failed to pull Condor images, continuing anyway..."
|
|
416
|
+
fi
|
|
417
|
+
fi
|
|
418
|
+
if [ -f "$API_DIR/docker-compose.yml" ]; then
|
|
419
|
+
msg_info "Updating Hummingbot API container..."
|
|
420
|
+
if ! (cd "$API_DIR" && $DOCKER_COMPOSE pull); then
|
|
421
|
+
msg_warn "Failed to pull Hummingbot API images, continuing anyway..."
|
|
422
|
+
fi
|
|
423
|
+
fi
|
|
424
|
+
|
|
425
|
+
msg_info "Restarting services..."
|
|
426
|
+
if [ -f "$CONDOR_DIR/docker-compose.yml" ]; then
|
|
427
|
+
if ! (cd "$CONDOR_DIR" && $DOCKER_COMPOSE up -d --remove-orphans); then
|
|
428
|
+
msg_warn "Failed to restart Condor services"
|
|
429
|
+
fi
|
|
430
|
+
fi
|
|
431
|
+
if [ -f "$API_DIR/docker-compose.yml" ]; then
|
|
432
|
+
if ! (cd "$API_DIR" && $DOCKER_COMPOSE up -d --remove-orphans); then
|
|
433
|
+
msg_warn "Failed to restart Hummingbot API services"
|
|
434
|
+
fi
|
|
435
|
+
fi
|
|
436
|
+
msg_ok "Installation/upgrade complete!"
|
|
437
|
+
|
|
438
|
+
echo ""
|
|
439
|
+
echo -e "${BLUE}Running services:${NC}"
|
|
440
|
+
if [ -d "$CONDOR_DIR" ]; then
|
|
441
|
+
msg_info "Check Condor status: cd $CONDOR_DIR && $DOCKER_COMPOSE ps"
|
|
442
|
+
fi
|
|
443
|
+
if [ -d "$API_DIR" ]; then
|
|
444
|
+
msg_info "Check API status: cd $API_DIR && $DOCKER_COMPOSE ps"
|
|
445
|
+
fi
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
install_api_standalone() {
|
|
449
|
+
msg_info "Starting Hummingbot API standalone installation..."
|
|
450
|
+
|
|
451
|
+
SCRIPT_DIR="$(pwd)"
|
|
452
|
+
msg_ok "Installation directory: $SCRIPT_DIR"
|
|
453
|
+
|
|
454
|
+
echo ""
|
|
455
|
+
echo -e "${BLUE}Installing Hummingbot API:${NC}"
|
|
456
|
+
|
|
457
|
+
msg_info "Cloning Hummingbot API repository..."
|
|
458
|
+
CREATED_DIRS+=("$API_DIR")
|
|
459
|
+
if ! git clone --depth 1 "$API_REPO" "$API_DIR"; then
|
|
460
|
+
msg_error "Failed to clone Hummingbot API repository"
|
|
461
|
+
exit 1
|
|
462
|
+
fi
|
|
463
|
+
|
|
464
|
+
msg_info "Setting up Hummingbot API (running: make setup)..."
|
|
465
|
+
if ! (cd "$API_DIR" && make setup); then
|
|
466
|
+
msg_error "Failed to run make setup for Hummingbot API"
|
|
467
|
+
exit 1
|
|
468
|
+
fi
|
|
469
|
+
|
|
470
|
+
msg_info "Deploying Hummingbot API (running: make deploy)..."
|
|
471
|
+
if ! (cd "$API_DIR" && make deploy); then
|
|
472
|
+
msg_error "Failed to deploy Hummingbot API"
|
|
473
|
+
exit 1
|
|
474
|
+
fi
|
|
475
|
+
|
|
476
|
+
echo ""
|
|
477
|
+
echo -e "${GREEN}════════════════════════════════════════${NC}"
|
|
478
|
+
msg_ok "Hummingbot API Installation Complete!"
|
|
479
|
+
echo -e "${GREEN}════════════════════════════════════════${NC}"
|
|
480
|
+
echo ""
|
|
481
|
+
echo -e "${BLUE}Installation Summary:${NC}"
|
|
482
|
+
msg_info "Installation directory: $SCRIPT_DIR/$API_DIR"
|
|
483
|
+
msg_info "Hummingbot API is installed and running"
|
|
484
|
+
|
|
485
|
+
echo ""
|
|
486
|
+
echo -e "${BLUE}Next Steps:${NC}"
|
|
487
|
+
msg_info "Check API status: cd $SCRIPT_DIR/$API_DIR && $DOCKER_COMPOSE ps"
|
|
488
|
+
msg_info "View logs: cd $SCRIPT_DIR/$API_DIR && $DOCKER_COMPOSE logs -f"
|
|
489
|
+
|
|
490
|
+
echo ""
|
|
491
|
+
echo -e "${BLUE}To upgrade in the future:${NC}"
|
|
492
|
+
msg_info "Run: cd $SCRIPT_DIR/$API_DIR && git pull && make deploy"
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
run_installation() {
|
|
496
|
+
msg_info "Starting new installation..."
|
|
497
|
+
|
|
498
|
+
SCRIPT_DIR="$(pwd)"
|
|
499
|
+
msg_ok "Installation directory: $SCRIPT_DIR"
|
|
500
|
+
|
|
501
|
+
echo ""
|
|
502
|
+
echo -e "${BLUE}Installing Condor Bot:${NC}"
|
|
503
|
+
msg_info "Cloning Condor repository..."
|
|
504
|
+
CREATED_DIRS+=("$CONDOR_DIR")
|
|
505
|
+
if ! git clone --depth 1 "$CONDOR_REPO" "$CONDOR_DIR"; then
|
|
506
|
+
msg_error "Failed to clone Condor repository"
|
|
507
|
+
exit 1
|
|
508
|
+
fi
|
|
509
|
+
|
|
510
|
+
msg_info "Running Condor setup script..."
|
|
511
|
+
if [ -f "$CONDOR_DIR/setup-environment.sh" ]; then
|
|
512
|
+
if ! (cd "$CONDOR_DIR" && bash setup-environment.sh); then
|
|
513
|
+
msg_error "Failed to run Condor setup-environment.sh"
|
|
514
|
+
exit 1
|
|
515
|
+
fi
|
|
516
|
+
else
|
|
517
|
+
msg_error "Condor setup-environment.sh not found"
|
|
518
|
+
exit 1
|
|
519
|
+
fi
|
|
520
|
+
|
|
521
|
+
msg_info "Deploying Condor (running: make deploy)..."
|
|
522
|
+
if ! (cd "$CONDOR_DIR" && make deploy); then
|
|
523
|
+
msg_error "Failed to deploy Condor"
|
|
524
|
+
exit 1
|
|
525
|
+
fi
|
|
526
|
+
msg_ok "Condor installation complete!"
|
|
527
|
+
|
|
528
|
+
echo ""
|
|
529
|
+
INSTALL_API=$(prompt_yesno "Do you also want to install Hummingbot API on this machine?")
|
|
530
|
+
|
|
531
|
+
if [ "$INSTALL_API" = "y" ]; then
|
|
532
|
+
echo ""
|
|
533
|
+
echo -e "${BLUE}Installing Hummingbot API:${NC}"
|
|
534
|
+
|
|
535
|
+
msg_info "Cloning Hummingbot API repository..."
|
|
536
|
+
CREATED_DIRS+=("$API_DIR")
|
|
537
|
+
if ! git clone --depth 1 "$API_REPO" "$API_DIR"; then
|
|
538
|
+
msg_error "Failed to clone Hummingbot API repository"
|
|
539
|
+
exit 1
|
|
540
|
+
fi
|
|
541
|
+
|
|
542
|
+
msg_info "Setting up Hummingbot API (running: make setup)..."
|
|
543
|
+
if ! (cd "$API_DIR" && make setup); then
|
|
544
|
+
msg_error "Failed to run make setup for Hummingbot API"
|
|
545
|
+
exit 1
|
|
546
|
+
fi
|
|
547
|
+
|
|
548
|
+
msg_info "Deploying Hummingbot API (running: make deploy)..."
|
|
549
|
+
if ! (cd "$API_DIR" && make deploy); then
|
|
550
|
+
msg_error "Failed to deploy Hummingbot API"
|
|
551
|
+
exit 1
|
|
552
|
+
fi
|
|
553
|
+
msg_ok "Hummingbot API installation complete!"
|
|
554
|
+
fi
|
|
555
|
+
|
|
556
|
+
echo ""
|
|
557
|
+
echo -e "${GREEN}════════════════════════════════════════${NC}"
|
|
558
|
+
msg_ok "Installation Complete!"
|
|
559
|
+
echo -e "${GREEN}════════════════════════════════════════${NC}"
|
|
560
|
+
echo ""
|
|
561
|
+
echo -e "${BLUE}Installation Summary:${NC}"
|
|
562
|
+
msg_info "Installation directory: $SCRIPT_DIR"
|
|
563
|
+
msg_info "Condor is installed and running"
|
|
564
|
+
if [ "$INSTALL_API" = "y" ]; then
|
|
565
|
+
msg_info "Hummingbot API is installed and running"
|
|
566
|
+
fi
|
|
567
|
+
|
|
568
|
+
echo ""
|
|
569
|
+
echo -e "${BLUE}Next Steps:${NC}"
|
|
570
|
+
msg_info "1. Open Telegram and start a chat with your Condor bot"
|
|
571
|
+
msg_info "2. Use /config command to add Hummingbot API servers and manage access"
|
|
572
|
+
msg_info "3. Check Condor status: cd $SCRIPT_DIR/$CONDOR_DIR && $DOCKER_COMPOSE ps"
|
|
573
|
+
if [ "$INSTALL_API" = "y" ]; then
|
|
574
|
+
msg_info "4. Check API status: cd $SCRIPT_DIR/$API_DIR && $DOCKER_COMPOSE ps"
|
|
575
|
+
fi
|
|
576
|
+
|
|
577
|
+
echo ""
|
|
578
|
+
echo -e "${BLUE}Management Commands:${NC}"
|
|
579
|
+
msg_info "View Condor logs: cd $SCRIPT_DIR/$CONDOR_DIR && $DOCKER_COMPOSE logs -f"
|
|
580
|
+
if [ "$INSTALL_API" = "y" ]; then
|
|
581
|
+
msg_info "View API logs: cd $SCRIPT_DIR/$API_DIR && $DOCKER_COMPOSE logs -f"
|
|
582
|
+
fi
|
|
583
|
+
|
|
584
|
+
echo ""
|
|
585
|
+
echo -e "${BLUE}To upgrade in the future:${NC}"
|
|
586
|
+
msg_info "Run this script with --upgrade flag: bash $0 --upgrade"
|
|
587
|
+
}
|
|
588
|
+
# --- Main Execution ---
|
|
589
|
+
clear
|
|
590
|
+
echo -e "${GREEN}"
|
|
591
|
+
cat << "BANNER"
|
|
592
|
+
██████╗ ██████╗ ███╗ ██╗██████╗ ██████╗ ██████╗
|
|
593
|
+
██╔════╝██╔═══██╗████╗ ██║██╔══██╗██╔═══██╗██╔══██╗
|
|
594
|
+
██║ ██║ ██║██╔██╗ ██║██║ ██║██║ ██║██████╔╝
|
|
595
|
+
██║ ██║ ██║██║╚██╗██║██║ ██║██║ ██║██╔══██╗
|
|
596
|
+
╚██████╗╚██████╔╝██║ ╚████║██████╔╝╚██████╔╝██║ ██║
|
|
597
|
+
╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═════╝ ╚═════╝ ╚═╝ ╚═╝
|
|
598
|
+
BANNER
|
|
599
|
+
echo -e "${NC}"
|
|
600
|
+
echo -e "${CYAN} Hummingbot Deploy Installer${NC}"
|
|
601
|
+
echo ""
|
|
602
|
+
detect_os_arch
|
|
603
|
+
check_disk_space
|
|
604
|
+
install_dependencies
|
|
605
|
+
check_docker_running
|
|
606
|
+
detect_docker_compose
|
|
607
|
+
|
|
608
|
+
if [ "$API_ONLY_MODE" = "y" ]; then
|
|
609
|
+
if [ -d "$API_DIR" ]; then
|
|
610
|
+
msg_warn "Hummingbot API directory already exists at $API_DIR"
|
|
611
|
+
REINSTALL=$(prompt_yesno "Do you want to upgrade/reinstall?")
|
|
612
|
+
if [ "$REINSTALL" = "y" ]; then
|
|
613
|
+
msg_info "Upgrading Hummingbot API..."
|
|
614
|
+
(cd "$API_DIR" && git pull)
|
|
615
|
+
(cd "$API_DIR" && make deploy)
|
|
616
|
+
msg_ok "Hummingbot API upgraded successfully!"
|
|
617
|
+
fi
|
|
618
|
+
else
|
|
619
|
+
install_api_standalone
|
|
620
|
+
fi
|
|
621
|
+
exit 0
|
|
622
|
+
fi
|
|
623
|
+
|
|
624
|
+
if [ "$UPGRADE_MODE" = "y" ] || ([ -d "$CONDOR_DIR" ] && [ -d "$API_DIR" ]) || ([ -d "$CONDOR_DIR" ] && [ -f "$CONDOR_DIR/docker-compose.yml" ]); then
|
|
625
|
+
run_upgrade
|
|
626
|
+
else
|
|
627
|
+
run_installation
|
|
628
|
+
fi
|