Files
cmautobuy/docs/task/184-admin打包部署最新版本.md
T
2026-08-12 15:19:53 +08:00

50 lines
2.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 184 Admin:打包并部署 #182、#183 最新版本
- 类型:部署
- 父级大工单:#14
- 所属 MVP / 版本:#15 Admin 四模块可用闭环
- 状态:已完成
- 日期:2026-08-12
- Gitea 工单:http://ilaer.eicp.net:8418/chengma/cmautobuy/issues/184
## 背景与目标
把包含 #182、#183 及此前已提交 Admin 变更的最新代码构建并发布到生产服务器,通过 `https://buy.833729.com` 提供服务,同时保留生产配置、数据和上一版本回退能力。
## 最终方案
- 以提交 `7e2d33c` 使用固定 Go 1.23.0 构建 Linux amd64、CGO 关闭的单文件二进制。
- 发布前使用生产业务账号执行单事务逻辑备份;由于账号没有 `PROCESS` 权限,使用 `--no-tablespaces` 排除不需要的表空间元数据,并启用管道失败检测。
- 上传到独立目录 `/opt/cmautobuy/releases/7e2d33c/`,复用稳定的 `config.yaml` 和 `data` 软链接。
- systemd 停止后原子切换 `/opt/cmautobuy/cmautobuy-admin`,启动并验证端口、日志和 HTTPS。
- 上一版本 `/opt/cmautobuy/releases/aa6d812/cmautobuy-admin` 保留,可直接切回。
## 改了哪些
- 本地构建产物:`admin/.deploy/cmautobuy-admin-7e2d33c`(Git 忽略)。
- 生产发布目录:`/opt/cmautobuy/releases/7e2d33c/`。
- 稳定执行链接:`/opt/cmautobuy/cmautobuy-admin` 已指向本次 release。
- 生产备份:`/opt/cmautobuy/backups/autobuy-before-184-20260812T071739Z.sql.gz`。
- 第一次备份因 `mysqldump` 表空间权限错误而无效,已删除该次刚产生的无效文件;历史备份未修改。
## 验收结果
| 验收标准 | 结果 |
|---|---|
| 固定 Go 1.23.0 build/test/vet 通过 | 通过 |
| Linux amd64 二进制 SHA-256 已记录 | 通过:`44208f12f022b1f3a303bea4e45ad23797f35da48acea93e2a3da2d09eae88c8` |
| 发布前备份权限 600 且 gzip 校验通过 | 通过,4,502,963 字节 |
| systemd active/enabled,启动日志无错误 | 通过 |
| 本机根路径 303、登录页 200,公网 HTTPS 登录页 200 | 通过 |
| 当前 release 正确且上一版可回退 | 通过 |
## 测试
- 执行的命令:固定 Go 1.23.0 的 `go vet ./...`、`go test ./... -count=1`、Linux amd64 `go build`;服务器执行 `sha256sum`、`gzip -t`、`systemctl is-active/is-enabled`、`journalctl`、MySQL schema 查询和 `curl` 健康检查。
- 结果:Admin 全部 Go 包通过;线上服务 active/enabled;schema v13;本机根路径 303、登录页 200;服务器及外部网络访问公网登录页均为 200;启动后 error 日志无记录。
- **没验证到的部分**:没有使用生产账号登录后逐页进行浏览器人工功能验收;没有发起真实顺运宝同步。
## 相关提交
- `7e2d33c` 本次生产构建基线