部署文档与脚本增加 HTTP 代理配置(192.168.8.246:10810)。

This commit is contained in:
dekun
2026-06-28 13:24:19 +08:00
parent f1ad4273f4
commit 4375ea491e
5 changed files with 78 additions and 3 deletions
+4
View File
@@ -20,6 +20,9 @@ log_info() { echo -e "${GREEN}[INFO]${NC} $*"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
log_error() { echo -e "${RED}[ERROR]${NC} $*" >&2; }
# shellcheck source=proxy.sh
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/proxy.sh"
require_root() {
if [[ "${EUID:-$(id -u)}" -ne 0 ]]; then
log_error "请使用 root 用户运行: sudo bash deploy/install.sh"
@@ -207,6 +210,7 @@ print_summary() {
main() {
log_info "零 Node 一键部署开始"
require_root
setup_deploy_proxy
check_os
check_port
install_base_packages
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
# 部署脚本共用:读取 HTTP_PROXY / http_proxy 并配置 apt、git、pip、curl
# 用法(install.sh / update.sh 前):
# export http_proxy=http://192.168.8.246:10810
# export https_proxy=http://192.168.8.246:10810
# export HTTP_PROXY="$http_proxy"
# export HTTPS_PROXY="$https_proxy"
setup_deploy_proxy() {
local proxy="${HTTP_PROXY:-${http_proxy:-}}"
if [[ -z "$proxy" ]]; then
return 0
fi
if [[ "$proxy" != http://* && "$proxy" != https://* && "$proxy" != socks5://* ]]; then
proxy="http://${proxy}"
fi
export http_proxy="$proxy"
export https_proxy="${HTTPS_PROXY:-${https_proxy:-$proxy}}"
export HTTP_PROXY="$http_proxy"
export HTTPS_PROXY="$https_proxy"
export ALL_PROXY="${ALL_PROXY:-$http_proxy}"
if [[ -n "${log_info:-}" ]]; then
log_info "使用网络代理: ${http_proxy}"
else
echo "[INFO] 使用网络代理: ${http_proxy}"
fi
mkdir -p /etc/apt/apt.conf.d
cat > /etc/apt/apt.conf.d/95grade-archive-proxy <<EOF
Acquire::http::Proxy "${http_proxy}";
Acquire::https::Proxy "${https_proxy}";
EOF
}
+5
View File
@@ -11,10 +11,15 @@ NC='\033[0m'
log_info() { echo -e "${GREEN}[INFO]${NC} $*"; }
log_error() { echo -e "${RED}[ERROR]${NC} $*" >&2; }
# shellcheck source=proxy.sh
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/proxy.sh"
cd "${INSTALL_DIR}" || exit 1
find "${INSTALL_DIR}" -name "*.sh" -exec sed -i 's/\r$//' {} +
chmod +x deploy/start.sh
setup_deploy_proxy
log_info "拉取最新代码…"
git fetch origin
git checkout "${BRANCH}" 2>/dev/null || true