Remove built-in proxy from deploy scripts and show pip install progress.
Proxy is optional via manual env vars only; update.sh also drops quiet pip/npm flags. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+9
-5
@@ -11,6 +11,8 @@ WEB_PORT="${WEB_PORT:-23566}"
|
|||||||
API_PORT="${API_PORT:-8000}"
|
API_PORT="${API_PORT:-8000}"
|
||||||
BRANCH="${BRANCH:-main}"
|
BRANCH="${BRANCH:-main}"
|
||||||
NODE_MAJOR="${NODE_MAJOR:-20}"
|
NODE_MAJOR="${NODE_MAJOR:-20}"
|
||||||
|
PIP_MIRROR="${PIP_MIRROR:-https://pypi.tuna.tsinghua.edu.cn/simple}"
|
||||||
|
NPM_REGISTRY="${NPM_REGISTRY:-https://registry.npmmirror.com}"
|
||||||
|
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
@@ -144,27 +146,29 @@ setup_postgresql() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setup_backend() {
|
setup_backend() {
|
||||||
log_info "安装 Python 依赖…"
|
log_info "安装 Python 依赖(显示完整进度,Paddle 包较大,约 10–30 分钟)…"
|
||||||
cd "${INSTALL_DIR}/backend"
|
cd "${INSTALL_DIR}/backend"
|
||||||
python3 -m venv venv
|
python3 -m venv venv
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
source venv/bin/activate
|
source venv/bin/activate
|
||||||
pip install --upgrade pip -q
|
pip install --upgrade pip --progress-bar on -i "${PIP_MIRROR}"
|
||||||
pip install -r requirements.txt -q
|
pip install -r requirements.txt --progress-bar on -i "${PIP_MIRROR}"
|
||||||
deactivate
|
deactivate
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_frontend() {
|
setup_frontend() {
|
||||||
log_info "构建前端…"
|
log_info "构建前端…"
|
||||||
cd "${INSTALL_DIR}/frontend"
|
cd "${INSTALL_DIR}/frontend"
|
||||||
npm ci --silent
|
npm config set registry "${NPM_REGISTRY}"
|
||||||
|
npm ci
|
||||||
npm run build
|
npm run build
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_gateway() {
|
setup_gateway() {
|
||||||
log_info "安装 Web 网关依赖…"
|
log_info "安装 Web 网关依赖…"
|
||||||
cd "${INSTALL_DIR}/deploy/pm2"
|
cd "${INSTALL_DIR}/deploy/pm2"
|
||||||
npm ci --silent
|
npm config set registry "${NPM_REGISTRY}"
|
||||||
|
npm ci
|
||||||
}
|
}
|
||||||
|
|
||||||
start_pm2() {
|
start_pm2() {
|
||||||
|
|||||||
+6
-3
@@ -3,6 +3,8 @@ set -euo pipefail
|
|||||||
|
|
||||||
INSTALL_DIR="${INSTALL_DIR:-/opt/secondary-school-grade-archive}"
|
INSTALL_DIR="${INSTALL_DIR:-/opt/secondary-school-grade-archive}"
|
||||||
BRANCH="${BRANCH:-main}"
|
BRANCH="${BRANCH:-main}"
|
||||||
|
PIP_MIRROR="${PIP_MIRROR:-https://pypi.tuna.tsinghua.edu.cn/simple}"
|
||||||
|
NPM_REGISTRY="${NPM_REGISTRY:-https://registry.npmmirror.com}"
|
||||||
|
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
@@ -19,17 +21,18 @@ git pull origin "${BRANCH}"
|
|||||||
log_info "更新后端依赖…"
|
log_info "更新后端依赖…"
|
||||||
cd backend
|
cd backend
|
||||||
source venv/bin/activate
|
source venv/bin/activate
|
||||||
pip install -r requirements.txt -q
|
pip install -r requirements.txt --progress-bar on -i "${PIP_MIRROR}"
|
||||||
deactivate
|
deactivate
|
||||||
|
|
||||||
log_info "重建前端…"
|
log_info "重建前端…"
|
||||||
cd ../frontend
|
cd ../frontend
|
||||||
npm ci --silent
|
npm config set registry "${NPM_REGISTRY}"
|
||||||
|
npm ci
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
log_info "更新网关…"
|
log_info "更新网关…"
|
||||||
cd ../deploy/pm2
|
cd ../deploy/pm2
|
||||||
npm ci --silent
|
npm ci
|
||||||
|
|
||||||
log_info "重启 PM2…"
|
log_info "重启 PM2…"
|
||||||
cd "${INSTALL_DIR}"
|
cd "${INSTALL_DIR}"
|
||||||
|
|||||||
@@ -145,8 +145,25 @@ ufw enable
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
WEB_PORT=23566 INSTALL_DIR=/opt/secondary-school-grade-archive bash deploy/install.sh
|
WEB_PORT=23566 INSTALL_DIR=/opt/secondary-school-grade-archive bash deploy/install.sh
|
||||||
|
|
||||||
|
# 使用官方 PyPI(海外服务器可去掉国内镜像)
|
||||||
|
PIP_MIRROR=https://pypi.org/simple bash deploy/install.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 网络代理(可选,脚本内不内置)
|
||||||
|
|
||||||
|
一键部署**不会**自动配置代理。无代理环境可直接运行,不会因代理报错。
|
||||||
|
|
||||||
|
若本机网络需走代理,请在**执行安装前**手动 export(仅当前终端生效):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export HTTP_PROXY=http://你的代理地址:端口
|
||||||
|
export HTTPS_PROXY=http://你的代理地址:端口
|
||||||
|
bash deploy/install.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
不设置则不走代理。`pip install` 会**显示完整下载/安装进度**,不再静默。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 11. 版权
|
## 11. 版权
|
||||||
|
|||||||
Reference in New Issue
Block a user