fix(cd): 使用 inplace rsync 保留 bind mount inode

This commit is contained in:
OoO
2026-04-30 23:32:59 +08:00
parent d06c7016dc
commit 73c7ddcee0
3 changed files with 5 additions and 0 deletions

View File

@@ -135,6 +135,7 @@ jobs:
# ── 安裝部署工具 ────────────────────────────────────────────────────
# rsync --ignore-errors 防止單一不可寫 attr 中斷整個部署
# rsync --inplace 避免 app.py/config.py 單檔 bind mount 因 inode replacement 卡住舊版本
- name: 安裝 rsync / ssh
run: |
apt-get update -qq && apt-get install -y -qq rsync openssh-client
@@ -144,6 +145,7 @@ jobs:
if: steps.deploy_type.outputs.type == 'sync'
run: |
rsync -avz --ignore-errors \
--inplace \
-e "ssh -i ~/.ssh/id_deploy" \
--exclude='.git/' \
--exclude='.gitea/' \
@@ -203,6 +205,7 @@ REMOTE_SYNC
(echo 'ABORT: momo-db not running' && exit 1)"
# H1: 與 Sync 模式對齊的完整 excludes含 .gitea/ .claude/ docs/ *.md
rsync -avz --ignore-errors \
--inplace \
-e "ssh -i ~/.ssh/id_deploy" \
--exclude='.git/' \
--exclude='.gitea/' \

View File

@@ -53,6 +53,7 @@
- **CD sync hot reload**: 一般 Python/模板同步不再 `restart momo-app`,改為 `docker kill -s HUP momo-pro-system` 讓 Gunicorn 熱重載 workers只重啟 scheduler / telegram-botGunicorn 關閉 `preload_app`,確保 HUP 後 workers 會 import 新版 app code。
- **OpenClaw Bot 第二刀拆分**: Inline Keyboard builders 移到 `services/openclaw_bot/menu_keyboards.py`,透過 `configure_menu_keyboards()` 注入 `latest_date/_GOALS/TAIPEI_TZ`route 檔下降到 5,240 行並補選單回歸測試。
- **CD sync mount drift guard**: 發現舊 app 容器未掛載 `app.py/config.py`rsync 後服務檔已更新但 `/health` 版本仍卡 image 內舊檔CD sync 會檢查 mount僅 drift 時一次性 recreate momo-app其餘維持 HUP 熱重載。
- **CD 單檔 bind mount inode 修復**: `app.py/config.py` 單檔 bind mount 會被 rsync/tar 的 inode replacement 卡住舊檔CD rsync 改用 `--inplace`,避免 HUP reload 後仍讀到舊版本。
### 2026-04-28~29Phase 3e 重構大戰 + daily_sales cache 隱形 bug 根除
- **app.py 縮減 -10.8%**: 7,386 → 6,590 行11 commits 全綠零 502。

View File

@@ -36,6 +36,7 @@ def test_cd_sync_mode_hot_reloads_app_without_container_restart():
def test_cd_sync_mode_repairs_app_mount_drift_once():
workflow = CD_WORKFLOW.read_text(encoding="utf-8")
assert "--inplace" in workflow
assert "momo-app mount drift detected" in workflow
assert "grep -qx '/app/app.py'" in workflow
assert "grep -qx '/app/config.py'" in workflow