1. 删除旧版xq0031_xq0032插件的冗余UI源码与配置文件 2. 迁移并标准化XQ0001-0100系列需求的插件、文档与工作流目录 3. 清理过期的需求列表、评分文档与流程底稿 4. 更新.gitignore匹配规则,适配新的目录结构
6.3 KiB
桌面端发版 SOP(壳子 / 中心机 / 文件服务器)
对象:37du 桌面端三组件的发版流程。插件发版见 插件发版规范; 中心机前后端部署细节见 控制面前后端部署SOP。 版本源都在中心机控制面(
http://117.72.191.188:8800)。
一、组件与版本源
| 组件 | 代码位置 | 交付形态 | 版本单点 | 更新机制 |
|---|---|---|---|---|
| 壳子(执行机主程序) | desktop/webhost/ |
PyInstaller + Inno 安装包 | desktop/webhost/tools/shell.version(当前 1.1.8) |
执行机 shell_updater.py 检测 → 用户下载 → 点击重启静默升级 |
| 插件执行壳(runner) | desktop/webhost/ |
onefile exe,随安装包分发 | 随壳子 | 随壳子安装包 |
| 中心机控制面 | desktop/controlplane/ |
源码部署(宝塔 gunicorn 8800 + 静态站 8090),不打包 exe | 无 | 改代码按部署 SOP |
| 文件服务器 | desktop/fileserver/ |
PyInstaller exe,内网部署 172.30.35.135:8802 |
无 | build.bat 打包 + 开机自启 |
版本源:执行机 shell_updater 拉取 /api/shell/version,数据来自中心机
desktop/controlplane/shell/version.json(file push 时自动更新),返回 version / url / sha256 / notes;
url 直连内网文件服务器下载大包(无鉴权),为空则回退中心机 /api/shell/pkg(带 X-API-Token)。
二、壳子发版流程(主要)
前置:改完
desktop/webhost/后端或前端代码,本地验证通过。
1. 更新版本号(两处保持一致)
desktop/webhost/tools/shell.version→ 新版本(如1.2.0)desktop/webhost/tools/install.iss的MyAppVersion→ 同版本
2. 前端构建(前端有改动时)
cd d:\work\code\37duAutomation\desktop\webhost\frontend
npm run build # 产物 dist/ 由 37du-host.spec 的 datas 打进主程序
3. PyInstaller 打包(在 desktop/ 下执行)
.\.venv\Scripts\python.exe -m PyInstaller webhost\tools\37du-host.spec --distpath webhost\dist-exe --workpath webhost\build-exe --noconfirm
.\.venv\Scripts\python.exe -m PyInstaller webhost\tools\37du-host-runner.spec --distpath webhost\dist-exe --workpath webhost\build-exe --noconfirm
37du-host.spec:onedir 目录模式(主程序,含前端 dist / WebView2 / 插件依赖)37du-host-runner.spec:onefile 单文件(插件执行子进程壳,与主程序 exe 同级)37du-host-console.spec是调试版,不入安装包,可跳过
4. Inno 打安装包
"C:\Program Files\Inno Setup 7\ISCC.exe" webhost\tools\install.iss
产物:desktop/webhost/installer/setup-37du-host-<版本>.exe
5. 上传安装包到内网文件服务器
安装包需放到文件服务器 172.30.35.135:8802 的可直连目录(version 接口的 url 指向它)。
上传到文件服务器的具体方式以现场运维为准(SMB 共享 / 管理后台上传),确保执行机能免鉴权直连下载。
6. 登记发版(desktop/ 下 agent CLI)
.\.venv\Scripts\python.exe -m controlplane.tools.agent_cli `
--admin puddy --password 123456 `
file push <安装包绝对路径> --category shell --version <新版本> [--notes "更新说明"]
作用:登记到中心机 file_sources(shell) + 更新 controlplane/shell/version.json(version/url/sha256/notes)。
不要用旧的
shell-release子命令。
7. 验证
curl -s http://127.0.0.1:8800/api/shell/version # 返回新版本 + sha256 + 可下载 url
执行机端「检查更新」应提示新版本 → 下载(进度)→ sha256 校验 → 点击「重启更新」。
8. 执行机端升级链路(shell_updater.py 约定)
检查(只比对版本,秒级,每 30 分钟/启动/手动)→ 用户点击下载(流式到 %LOCALAPPDATA%\37duAutomation\shell\,.part 临时文件 + sha256 校验)→ 校验失败放弃 →
点击「重启更新」→ /VERYSILENT /SUPPRESSMSGBOXES /NORESTART 静默覆盖安装 → Inno CloseApplications 收尾 → [Run] 自动重启新版本。
注意
- 版本升级不覆盖执行机已有
.env(install.iss用onlyifdoesntexist); - 插件不随安装包分发,执行机登录后按账号权限自下载(
plugin_sync.py); - 安装包较大(数百 MB),下载走内网文件服务器直链,避免走中心机中转。
三、中心机控制面发版
改 desktop/controlplane/ 前后端代码后,按 控制面前后端部署SOP 执行:
- 前端:
desktop/controlplane/frontend下npm run build→Compress-Archive打包 zip → 上传 → 静态站 8090 解压替换(用mv备份,勿rm -rf); - 后端:逐个上传改动文件 → 覆盖到
/www/wwwroot/controlplane/controlplane/→ 重启 gunicorn 项目controlplane(8800); - 控制面为源码部署,不产 exe。
四、文件服务器发版
改 desktop/fileserver/ 后:
cd d:\work\code\37duAutomation\desktop
.\tools\..\.venv\Scripts\python.exe # 或直接跑
fileserver\tools\build.bat
build.bat:PyInstaller 打 37du-fileserver.spec → 组装 desktop/fileserver/dist-exe/fileserver/(exe + .env)。
部署到 172.30.35.135:
- 拷贝
dist-exe/fileserver/整目录到内网机器; - 调整
.env的FILESERVER_BASE_URL/TOKEN; - 运行
install_autostart.bat注册开机自启,start_server.bat启动。
壳子安装包也存放在该服务器上,供执行机
version.url直连下载。
五、检查清单(发版后自检)
shell.version与install.iss.MyAppVersion版本号一致,且高于中心机已登记版本37du-host.spec(onedir)与37du-host-runner.spec(onefile)均打包成功- 安装包已生成:
desktop/webhost/installer/setup-37du-host-<版本>.exe - 安装包已上传到内网文件服务器,且执行机可直连下载
file push --category shell成功,/api/shell/version返回新版本与正确 sha256- 执行机「检查更新」提示新版本,下载 → 校验 → 重启升级链路正常
- 升级后执行机
.env、插件配置未被覆盖(onlyifdoesntexist生效)