dy-dashboard/vault/知识库/工作指南/训练记录/2026-08-12-两阶段部署生产升级云端第二轮.md
2026-10-28 11:14:17 +08:00

49 lines
2.7 KiB
Markdown
Raw Permalink 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.

# 2026-08-12 两阶段部署:8.186→11.79 增量、11.79→云端全量(第二轮)
## 旭东 → OpenClaw
> 1、需要打包8.186测试环境下所有的功能代码、数据库结构、数据库字段、知识库,更新部署到11.79生产环境下,不要覆盖生产环境的数据
> 2、等待第一步完成之后,打包生产环境下的全部内容包含所有数据,升级到云端环境中
> 云端服务器 IP:82.156.135.91,SSH登录用户名:ubuntu,SSH登录密码:dieya123,.
## OpenClaw 响应
### 第一步:测试环境(8.186)→ 生产(11.79)增量部署
- ✅ `pack_deploy_full.sh` 增量模式:代码 + 知识库 + 数据库结构(CREATE TABLE IF NOT EXISTS + ALTER TABLE 迁移列),未覆盖生产数据
- ✅ 验证:app.js / purchase.py md5 与 8.186 完全一致;合同模板双Tab(switchCtTab)、成品提货 update_fields 路由等新功能均已到生产;packaging_orders 采购计划列已迁移;生产服务 HTTP 200
### 第二步:生产(11.79)→ 云端(82.156.135.91)全量升级
- ✅ 打包生产全量:代码 + 知识库 + 上传文件 + 完整数据库(SQL 521M,包 68M→127M)
- ✅ 部署到 `/opt/dy-dashboard`(systemd 服务,nginx 反代 80/443 → 127.0.0.1:18888)
- ✅ 全量恢复数据库、修正 VAULT_PATH、重建 venv、权限 ubuntu:ubuntu
- ✅ 公网 https://gyl.dieya.net.cn HTTP 200,服务 active
### 遇到的问题及处理
1. **云端备份目录权限**:/opt/dy-dashboard_backups 属主 root,ubuntu 无写权限导致部署脚本中断 → sudo chown 修复
2. **systemd 管理需 sudo**:systemctl stop/start 需 sudo 前缀
3. **/opt/dy-dashboard 属主 root**:rm -rf 需 sudo
4. **数据库恢复表已存在中止**:首次恢复时云端旧表已存在,CREATE TABLE 报错导致恢复中止,云端仍是旧数据 → DROP DATABASE 重建后重新恢复
5. **打包时点后生产新增数据**:18:17 打包后生产新增 domestic 11 条(id 2106-2116)、packaging 4 条(id 1876-1879,POZ-XFS-6755-PDD 包材)→ 从生产增量导出(mysqldump --no-create-info --where)导入云端补齐
6. **残留文件清理**:部署后清理各端 /tmp 临时文件;云端 dy_data_full.sql.gz(78M 打包残留)已删
### 最终核验(云端 vs 生产完全一致)
| 表 | 云端 | 生产 |
|---|---|---|
| products | 9394 | 9394 |
| inventory_detail | 1859633 | 1859633 |
| daily_outbound | 262520 | 262520 |
| domestic_orders | 975 | 975 |
| overseas_orders | 74 | 74 |
| packaging_orders | 838 | 838 |
| finished_products | 2838 | 2838 |
| suppliers | 556 | 556 |
| bom | 7531 | 7531 |
| arrival_batches | 476 | 476 |
| dashboard_users | 27 | 27 |
云端服务 active、公网 HTTPS 200。