# DCIM 公网发布与回退执行计划

生成时间：2026-06-20

执行来源：supervisor_direct

目标站点：`https://dcim.denghao.wiki`

## 1. 当前证据

### 1.1 本地已通过包

本地构建目录：

```text
deploy/zhihang-missing-modules-static/site
```

本地 manifest：

```json
{
  "generatedAt": "<以 deploy/zhihang-missing-modules-static/site/data/modules.json 为准>",
  "moduleCount": 17,
  "demoDistCount": 17,
  "docCount": 17,
  "has111": true,
  "has112": true,
  "has113": true
}
```

本地已跑闸门：

- 产品深度：`17/17`
- 语义残留：`semantic-residue: pass`
- 真实登录/深链/菜单：`real-flow: 17/17`
- 操作闭环：`operation-flow: 17/17`
- 视觉风格/页面语义：`visual-style: 17/17`

### 1.2 公网/远端当前包

远端目录：

```text
/home/mac-deng/apps/zhihang-missing-modules-static
```

远端容器：

```text
zhihang-missing-modules-static Up (healthy), 0.0.0.0:19091->80
```

远端 manifest：

```json
{
  "generatedAt": "2026-06-20T04:53:51.426Z",
  "moduleCount": 17,
  "docCount": 12,
  "has111": false,
  "has112": false,
  "has113": false
}
```

结论：公网站点不是串线，但内容落后于本地已验收包，需要发布新版静态内容。

## 2. 发布范围

只更新目标站点独立目录：

```text
/home/mac-deng/apps/zhihang-missing-modules-static
```

只同步：

- `site/`
- `docker-compose.yml`
- `nginx.conf`

不修改：

- DNS
- 现有域名证书
- 其它 Nginx vhost
- 其它 Docker 容器
- 其它站点目录

## 3. 执行命令

在当前仓库执行：

```bash
cd deploy/zhihang-missing-modules-static
DRY_RUN=0 bash scripts/deploy-to-vps.sh
```

脚本行为：

1. 重新构建本地 `site/`。
2. 在远端 `backups/` 下自动生成当前 `site/` 压缩备份。
3. 通过 `rsync --delete` 同步 `site/` 到远端。
4. 同步 `docker-compose.yml` 和 `nginx.conf`。
5. 在远端执行：

```bash
cd /home/mac-deng/apps/zhihang-missing-modules-static
ZH_MISSING_MODULES_PORT=19091 docker-compose up -d
curl -fsS http://127.0.0.1:19091/health.json
```

## 4. 发布后验收

先验远端本机：

```bash
ssh hk-vps "curl -fsS http://127.0.0.1:19091/health.json"
ssh hk-vps "curl -fsS http://127.0.0.1:19091/data/modules.json"
```

再验公网：

```bash
curl -fsS https://dcim.denghao.wiki/health.json
curl -fsS https://dcim.denghao.wiki/data/modules.json
curl -fsS https://dcim.denghao.wiki/docs/111_dcim高标准返工执行与闸门验收报告.md
```

最后跑浏览器闸门：

```bash
DCIM_PUBLIC_BASE_URL=https://dcim.denghao.wiki node tools/audit_dcim_public_real_flow.mjs
DCIM_PUBLIC_BASE_URL=https://dcim.denghao.wiki node tools/audit_dcim_operation_flow.mjs
DCIM_PUBLIC_BASE_URL=https://dcim.denghao.wiki node tools/audit_dcim_visual_style_gate.mjs
node tools/audit_dcim_semantic_residue.mjs
node tools/audit_dcim_product_depth.mjs
```

验收标准：

- `moduleCount=17`
- `docCount=17`
- `has111=true`
- `has112=true`
- `has113=true`
- 111 报告包含“业务语义残留闸门”
- `real-flow: 17/17`
- `operation-flow: 17/17`
- `visual-style: 17/17`
- `semantic-residue: pass`
- 产品深度 `17/17`

## 5. 回退方案

优先内容回退，不动域名：

1. 登录远端。
2. 查看既有备份：

```bash
ls -lh /home/mac-deng/apps/zhihang-missing-modules-static/backups
```

3. 如新版异常，可恢复旧站点包：

```bash
cd /home/mac-deng/apps/zhihang-missing-modules-static
tar -xzf backups/site-before-publish-YYYYMMDD-HHMMSS.tgz
docker-compose up -d
curl -fsS http://127.0.0.1:19091/health.json
```

若需要回到绑定前旧包，也可使用既有备份：

```bash
tar -xzf backups/site-before-dcim-bind-20260620-144806.tgz
```

如果是域名反代异常，禁用目标 vhost 并 reload：

```bash
sudo rm /etc/nginx/sites-enabled/dcim.denghao.wiki.conf
sudo nginx -t
sudo systemctl reload nginx
```

本次计划不会主动执行域名回退。

## 6. 风险控制

- 该站点是独立容器、独立端口 `19091`，发布不触碰其它站点。
- `rsync --delete` 只作用于目标远端目录下的 `site/`。
- 发布后必须同时验证远端本机和公网 HTTPS。
- 若公网 DNS 在本机解析抖动，优先用远端本机 `127.0.0.1:19091` 和服务器侧文件判断内容版本，再补公网验证。

## 7. 等待确认

需要用户明确确认后执行生产写操作。

确认语句建议：

```text
确认，按 112 计划发布 dcim.denghao.wiki
```
