fix: 修复远程部署脚本命令解析
This commit is contained in:
@@ -173,6 +173,7 @@
|
||||
- 系统设置备份列表自适应高度(2026-07-05):后台根布局锁定 `100vh`,`body/#app` 禁止纵向滚动,避免 Chrome 浏览器滚动条和后台内容滚动条同时出现;内容区高度统一使用 `100vh - header - footer`。系统设置页固定在后台内容区内,`.settings-content` 作为唯一纵向滚动容器;备份与恢复面板使用 `flex: 1 1 320px` 并保留 `min-height: 320px`,大屏下自动吃掉剩余高度;`BackupRestorePanel` 不再给备份表格启用 `flex-height` 内层竖向滚动。已用 Codex 内置浏览器检查:1290×650 下 `body/html` 不滚且仅 `.settings-content` 滚动,2048×1152 下备份面板自动拉伸到约 664px;艺术品档案列表低高度抽查无浏览器外层滚动。
|
||||
- 客户端基础信息字段统一(2026-07-05):客户端溯源详情页中“艺术家”不再作为作品标题下方的独立副文本展示,而是并入基础信息 `.fields/.field` 行结构,与工艺、创作年代、规格尺寸、材质等字段使用同一套标签列、值列、加粗值和虚线分隔样式,保证视觉一致。
|
||||
- 远程一键部署脚本(2026-07-05):新增 `scripts/deploy_remote.py`,用于 Windows 本机把当前代码构建为生产部署包并通过 SSH 部署到 x86_64 Docker 服务器。脚本交互询问后台/API 域名、客户端域名、远程目录、MySQL/Redis/JWT 密码、local/OSS 存储、CDN、初始管理员和 SSH 信息;本机构建 `admin/client` 静态文件与 `linux/amd64` API 镜像,生成生产 `.env`、`docker-compose.remote.yml`、`nginx.conf`,打包上传后在服务器执行 `docker load` 和 `docker compose up -d`。远程容器默认仅绑定 `127.0.0.1:18080`(后台/API)与 `127.0.0.1:18081`(客户端),由 1Panel 继续负责 HTTPS 域名反代;临时部署包放在 `.deploy/` 并已加入 `.gitignore`。新增 Python 依赖 `paramiko` 仅用于 SSH/SFTP 上传执行。
|
||||
- 远程部署脚本 Windows 命令解析修复(2026-07-05):`deploy_remote.py` 的 `run_cmd` 现在会先用 `shutil.which()` 解析 `pnpm.CMD`、`docker.EXE` 等真实可执行路径,再交给 `subprocess.run`,避免 Windows 下直接执行 `["pnpm", ...]` 报 `WinError 2`。SSH 密码输入改为必填,避免空密码提示“自动生成”造成误导。已用当前 `.venv` 验证 `py_compile` 和 `run_cmd(['pnpm', '--version'])` 通过。
|
||||
|
||||
## 当前代码基准与注意事项
|
||||
|
||||
|
||||
@@ -79,6 +79,14 @@ def ask_secret(prompt: str, default: str = "") -> str:
|
||||
return value or default
|
||||
|
||||
|
||||
def ask_required_secret(prompt: str) -> str:
|
||||
while True:
|
||||
value = getpass.getpass(f"{prompt}: ").strip()
|
||||
if value:
|
||||
return value
|
||||
log("该项不能为空,请重新输入。")
|
||||
|
||||
|
||||
def ask_yes_no(prompt: str, default: bool = True) -> bool:
|
||||
hint = "Y/n" if default else "y/N"
|
||||
value = input(f"{prompt}({hint}): ").strip().lower()
|
||||
@@ -141,7 +149,7 @@ def ask_config() -> DeployConfig:
|
||||
ssh_host = ask("服务器 SSH IP/域名")
|
||||
ssh_port = int(ask("服务器 SSH 端口", "22"))
|
||||
ssh_username = ask("服务器 SSH 账号", "root")
|
||||
ssh_password = ask_secret("服务器 SSH 密码")
|
||||
ssh_password = ask_required_secret("服务器 SSH 密码")
|
||||
|
||||
return DeployConfig(
|
||||
admin_url=admin_url,
|
||||
@@ -176,7 +184,11 @@ def ask_config() -> DeployConfig:
|
||||
|
||||
def run_cmd(args: list[str], cwd: Path | None = None) -> None:
|
||||
log("$ " + " ".join(shlex.quote(str(item)) for item in args))
|
||||
subprocess.run(args, cwd=str(cwd or ROOT), check=True)
|
||||
resolved_args = args[:]
|
||||
executable = shutil.which(resolved_args[0])
|
||||
if executable:
|
||||
resolved_args[0] = executable
|
||||
subprocess.run(resolved_args, cwd=str(cwd or ROOT), check=True)
|
||||
|
||||
|
||||
def remove_dir(path: Path) -> None:
|
||||
|
||||
Reference in New Issue
Block a user