Files
Arcrun/system-dev/wiki/cards/decisions/self-hosted部署-共享install加指紋跳過.md
uncle6me-web 558e80b4da chore(wiki): wiki-init 補骨架 + system-dev-template 安裝/更新腳本
wiki 已初始化過(push 檔活躍維護),本次補從沒建的 pull 層 + arcrun 化範本:
- cards/decisions/ 14 張決策原子卡(含 gloss/實體/typed-edge 三元組):
  從 decisions-summary 全量改寫 13 + 新增「薄殼規則晚於實作-MCP漂移是歷史債」1
- TAXONOMY 從 PKM 範本換成 arcrun 軸(子系統 零件架構/cypher/credential/recipe/kbdb/
  薄殼/部署/平台原則 + 形態 架構決策/踩坑/機制說明/禁令/案例經驗)
- principles 填 13 條跨全局原則(從 rules/ + mindset 蒸餾)
- INDEX 真實視圖(子系統角度 + 決策角度,指向 cards)
- system-dev/scripts/ + scripts/ install/update 安裝腳本(template 接入)

純基建/文檔,無業務 code(功能 code 見前一 commit)。
raw source(docs/)0 異動、wiki 卡際連結無斷鏈。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-27 17:53:37 +08:00

44 lines
2.5 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.
---
tags: [部署, 架構決策]
gloss: 23 個 component worker 不各裝依賴,改成 root 共享一次 install + manifest 內容指紋跳過未變動——減 23× node_modules 膨脹。
---
# Self-Hosted 部署 — 共享 install 加指紋跳過
← [[decisions/00-INDEX]]
**來源**`system-dev/wiki/decisions-summary.md`self-hosted 部署)、`cli/src/lib/deploy.ts` §2.5
**最後更新**2026-06-27
## 摘要
tarball 解開後不每個 component worker 各裝 node_modules23× 重複 ~324MB),改成 root 共享一次 install;同時用 content hash manifest 記錄部署狀態,相同 hash 跳過已部署 worker,只部署內容變動者。
## 重點
- **問題**23 個 component worker 的 runtime dep 全是 honotier2 另需 zod/mcp-sdk/yaml),各裝 ~324MB node_modules = 23× 重複;且冪等重跑被誤解成「每次重做全部」,22 個沒變的白跑一遍。
- **共享 install 機制**
- tarball 根目錄裝一次 hono + wrangler + tier2 deps
- 各 worker 靠 Node.js 往上搜索路徑 resolve dependencies
- `wrangler deploy --dry-run` 驗證 tier1+tier2 都被 bundle(確保包完整)
- 結果:207MB×1 取代 324MB×23
- **Manifest 跳過**
- `~/.arcrun/deploy-manifest.json` 記錄 content hash + 上次成功時間戳
- 新解開 tarball → 算 content hash 與上次成功者比較 → 相同跳過、不同重部
- Hash 含 accountId(換帳號/KV namespace → 自動重部,不誤跳)
- `--force` flag 清空 manifest → 全部重新部署
- **失敗恢復**:共享 install 失敗 → 自動退回各 worker 自裝(不破壞既有路徑)
- **只記成功**:manifest 只追蹤成功部署者,失敗者下次必重試
## 實體
- **共享 install**shared installation)— root 目錄的單一 node_modules,所有 worker 共享。
- **Manifest**(部署清單)— `~/.arcrun/deploy-manifest.json`,記錄 content hash 和成功部署狀態。
- **Content hash**(內容雜湊)— 本次 tarball 內容的唯一指紋,用於比較是否變動。
- **Component worker**(零件 Worker)— `.component-builds/{name}/` 下各個獨立部署單位。
## 關聯
### 內文知識關係
- 共享 install >> 減少 >> 重複 node_modules
- Manifest >> 跳過 >> 未變動 component worker
- Content hash >> 相同時 >> 自動跳過部署
- accountId >> 不同時 >> 強制重新部署
### 卡片關係
- [[self-hosted部署-共享install加指紋跳過]] >> 優化 >> [[不依賴CI-執行鏈路vs零件投稿]]