Show pip progress bars during deploy instead of silent installs.
Replace -q with --progress-bar so dependency installation visibly continues in setup_env and update flows. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -184,6 +184,39 @@ install_node_pm2() {
|
|||||||
log "PM2: $(pm2 -v)"
|
log "PM2: $(pm2 -v)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# pip 安装时显示进度条(避免 -q 静默导致用户以为卡死)
|
||||||
|
pip_progress_bar_arg() {
|
||||||
|
if [[ -t 1 ]] || [[ -t 2 ]]; then
|
||||||
|
echo "on"
|
||||||
|
else
|
||||||
|
echo "ascii"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
pip_upgrade_tools() {
|
||||||
|
local pip_bin="$1"
|
||||||
|
local bar
|
||||||
|
bar="$(pip_progress_bar_arg)"
|
||||||
|
echo " 升级 pip ..."
|
||||||
|
"${pip_bin}" install -U pip setuptools wheel \
|
||||||
|
--disable-pip-version-check \
|
||||||
|
--progress-bar "${bar}"
|
||||||
|
}
|
||||||
|
|
||||||
|
pip_install_requirements() {
|
||||||
|
local pip_bin="$1"
|
||||||
|
local req_file="$2"
|
||||||
|
local label="${3:-依赖}"
|
||||||
|
local bar
|
||||||
|
bar="$(pip_progress_bar_arg)"
|
||||||
|
echo " 安装${label} (下方为 pip 进度) ..."
|
||||||
|
[[ -f "${req_file}" ]] || die "缺少依赖文件: ${req_file}"
|
||||||
|
"${pip_bin}" install -r "${req_file}" \
|
||||||
|
--disable-pip-version-check \
|
||||||
|
--progress-bar "${bar}"
|
||||||
|
echo " ${label}安装完成"
|
||||||
|
}
|
||||||
|
|
||||||
install_backup_cron_all() {
|
install_backup_cron_all() {
|
||||||
step "安装三所每日备份 cron"
|
step "安装三所每日备份 cron"
|
||||||
local dir
|
local dir
|
||||||
|
|||||||
@@ -24,18 +24,18 @@ update_quick() {
|
|||||||
|
|
||||||
update_deps() {
|
update_deps() {
|
||||||
step "依赖更新"
|
step "依赖更新"
|
||||||
local dir req
|
local dir
|
||||||
for dir in crypto_monitor_binance crypto_monitor_gate crypto_monitor_okx; do
|
for dir in crypto_monitor_binance crypto_monitor_gate crypto_monitor_okx; do
|
||||||
local proj="${REPO_ROOT}/${dir}"
|
local proj="${REPO_ROOT}/${dir}"
|
||||||
if [[ -x "${proj}/.venv/bin/pip" ]]; then
|
if [[ -x "${proj}/.venv/bin/pip" ]]; then
|
||||||
log "pip install ${dir}"
|
step "${dir}"
|
||||||
"${proj}/.venv/bin/pip" install -r "${REPO_ROOT}/requirements.txt" -q
|
pip_install_requirements "${proj}/.venv/bin/pip" "${REPO_ROOT}/requirements.txt" "交易所共用依赖"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
local hub="${REPO_ROOT}/manual_trading_hub"
|
local hub="${REPO_ROOT}/manual_trading_hub"
|
||||||
if [[ -x "${hub}/.venv/bin/pip" && -f "${hub}/requirements.txt" ]]; then
|
if [[ -x "${hub}/.venv/bin/pip" && -f "${hub}/requirements.txt" ]]; then
|
||||||
log "pip install manual_trading_hub"
|
step "manual_trading_hub"
|
||||||
"${hub}/.venv/bin/pip" install -r "${hub}/requirements.txt" -q
|
pip_install_requirements "${hub}/.venv/bin/pip" "${hub}/requirements.txt" "中控依赖"
|
||||||
fi
|
fi
|
||||||
update_quick
|
update_quick
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -19,6 +19,8 @@ DEPLOY_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|||||||
REPO_ROOT="$(cd "${DEPLOY_DIR}/.." && pwd)"
|
REPO_ROOT="$(cd "${DEPLOY_DIR}/.." && pwd)"
|
||||||
REQ_FILE="${REPO_ROOT}/requirements.txt"
|
REQ_FILE="${REPO_ROOT}/requirements.txt"
|
||||||
HUB_REQ="${REPO_ROOT}/manual_trading_hub/requirements.txt"
|
HUB_REQ="${REPO_ROOT}/manual_trading_hub/requirements.txt"
|
||||||
|
# shellcheck source=lib/common.sh
|
||||||
|
source "${DEPLOY_DIR}/lib/common.sh"
|
||||||
|
|
||||||
ONLY="all"
|
ONLY="all"
|
||||||
SKIP_PM2=0
|
SKIP_PM2=0
|
||||||
@@ -177,10 +179,8 @@ setup_monitor() {
|
|||||||
step "${dir_name}"
|
step "${dir_name}"
|
||||||
cd "${proj}"
|
cd "${proj}"
|
||||||
create_project_venv "${PY}"
|
create_project_venv "${PY}"
|
||||||
echo " 升级 pip ..."
|
pip_upgrade_tools ".venv/bin/pip"
|
||||||
.venv/bin/python -m pip install -U pip setuptools wheel -q
|
pip_install_requirements ".venv/bin/pip" "${REQ_FILE}" "交易所共用依赖"
|
||||||
echo " 安装依赖 ..."
|
|
||||||
.venv/bin/pip install -r "${REQ_FILE}" -q
|
|
||||||
if [[ "${SKIP_ENV_COPY}" -eq 0 ]]; then
|
if [[ "${SKIP_ENV_COPY}" -eq 0 ]]; then
|
||||||
if [[ -f .env.example && ! -f .env ]]; then
|
if [[ -f .env.example && ! -f .env ]]; then
|
||||||
cp -n .env.example .env 2>/dev/null || cp .env.example .env
|
cp -n .env.example .env 2>/dev/null || cp .env.example .env
|
||||||
@@ -204,9 +204,9 @@ setup_hub() {
|
|||||||
step "manual_trading_hub"
|
step "manual_trading_hub"
|
||||||
cd "${proj}"
|
cd "${proj}"
|
||||||
create_project_venv "${PY}"
|
create_project_venv "${PY}"
|
||||||
.venv/bin/python -m pip install -U pip setuptools wheel -q
|
pip_upgrade_tools ".venv/bin/pip"
|
||||||
if [[ -f "${HUB_REQ}" ]]; then
|
if [[ -f "${HUB_REQ}" ]]; then
|
||||||
.venv/bin/pip install -r "${HUB_REQ}" -q
|
pip_install_requirements ".venv/bin/pip" "${HUB_REQ}" "中控依赖"
|
||||||
fi
|
fi
|
||||||
if [[ "${SKIP_ENV_COPY}" -eq 0 && -f .env.example && ! -f .env ]]; then
|
if [[ "${SKIP_ENV_COPY}" -eq 0 && -f .env.example && ! -f .env ]]; then
|
||||||
cp -n .env.example .env 2>/dev/null || cp .env.example .env
|
cp -n .env.example .env 2>/dev/null || cp .env.example .env
|
||||||
|
|||||||
Reference in New Issue
Block a user