Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a118ad407 | ||
|
|
ea5d28304e |
@@ -21,6 +21,8 @@ from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
|
||||
from app.roles import APP_ROLE
|
||||
|
||||
revision: str = "0006"
|
||||
down_revision: str = "0005"
|
||||
branch_labels: Sequence[str] | None = None
|
||||
|
||||
@@ -21,6 +21,8 @@ from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
|
||||
from app.roles import APP_ROLE
|
||||
|
||||
revision: str = "0007"
|
||||
down_revision: str = "0006"
|
||||
branch_labels: Sequence[str] | None = None
|
||||
|
||||
+12
-4
@@ -17,6 +17,8 @@ ENV_FILE=$CONF_DIR/env.production
|
||||
SERVICE=${SERVICE:-dadaotask-api}
|
||||
PORT=${PORT:-8200}
|
||||
REPO_URL=${REPO_URL:-https://gitea.tatta.cn/Tatta/DadaoTask.git}
|
||||
# 服务器直连 pypi/npm 官方源很慢(实测 npm 包几百 KB 就能卡住),默认走国内镜像
|
||||
NPM_REGISTRY=${NPM_REGISTRY:-https://registry.npmmirror.com}
|
||||
|
||||
step() { printf '\n== %s ==\n' "$*"; }
|
||||
die() { printf '!! %s\n' "$*" >&2; exit 1; }
|
||||
@@ -41,16 +43,22 @@ SHORT=$(git rev-parse --short HEAD)
|
||||
echo " HEAD=$COMMIT ($SHORT)"
|
||||
|
||||
step "2. Python 依赖"
|
||||
[ -x .venv/bin/python ] || python3 -m venv .venv
|
||||
.venv/bin/pip install -q --upgrade pip
|
||||
.venv/bin/pip install -q -r backend/requirements.txt
|
||||
# openclaw-01 是 Debian/Ubuntu 系但没装 python3-venv(ensurepip 缺失),也没有 sudo;
|
||||
# 所以先建 --without-pip 的 venv,再用系统 pip 把 pip 装进去。镜像可用 env 覆盖。
|
||||
PIP_INDEX=${PIP_INDEX:-https://mirrors.aliyun.com/pypi/simple/}
|
||||
if ! [ -x .venv/bin/python ] || ! .venv/bin/python -m pip --version >/dev/null 2>&1; then
|
||||
rm -rf .venv
|
||||
python3 -m venv --without-pip .venv
|
||||
python3 -m pip --python .venv/bin/python install -q --index-url "$PIP_INDEX" pip setuptools wheel
|
||||
fi
|
||||
.venv/bin/python -m pip install -q --index-url "$PIP_INDEX" --upgrade -r backend/requirements.txt
|
||||
|
||||
step "3. 数据库迁移(迁移角色,非应用角色)"
|
||||
set -a; . "$ENV_FILE"; set +a
|
||||
( cd backend && ../.venv/bin/alembic upgrade head )
|
||||
|
||||
step "4. 前端构建(只在服务器上、只用 HEAD 的源码)"
|
||||
( cd web && npm ci --no-audit --no-fund && npm run build )
|
||||
( cd web && npm ci --no-audit --no-fund --registry="$NPM_REGISTRY" && npm run build )
|
||||
test -f web/dist/index.html || die "前端构建产物缺失:web/dist/index.html"
|
||||
|
||||
step "5. 写入构建标记并重启服务"
|
||||
|
||||
Reference in New Issue
Block a user