fix(cd): sync 模式改用 app 熱重載
Some checks failed
CD Pipeline / deploy (push) Has been cancelled

This commit is contained in:
OoO
2026-04-30 15:11:57 +08:00
parent 661755fac9
commit f282ddc18c
7 changed files with 16 additions and 11 deletions

View File

@@ -172,14 +172,15 @@ jobs:
- name: 重啟容器Sync 模式)
if: steps.deploy_type.outputs.type == 'sync'
run: |
# ROOT CAUSE FIX (2026-04-28): 從 `restart` 改為 `up -d`
# restart 對「不存在的容器」會失敗 → 任一外力清掉容器後下次 sync 必爆 502
# up -d 對不存在容器會自動 createrestart 讓 Python process 重新載入 bind-mounted 檔案
# ROOT CAUSE FIX (2026-04-28): `up -d` 確保容器不存在時可自動 create。
# ZERO-DOWNTIME SYNC (2026-04-30): app 用 Gunicorn HUP 熱重載 workers
# 不重啟 momo-pro-system 容器,避免一般 Python/模板同步造成短暫 502。
ssh -i ~/.ssh/id_deploy ollama@192.168.0.188 \
"cd /home/ollama/momo-pro && \
docker compose up -d --no-deps momo-app scheduler telegram-bot && \
docker compose restart momo-app scheduler telegram-bot && \
echo '✅ 三容器已就緒app/scheduler/telegram-bot'"
docker kill -s HUP momo-pro-system && \
docker compose restart scheduler telegram-bot && \
echo '✅ Sync 已套用app 熱重載scheduler/telegram-bot 已重啟)'"
# ── 模式 B重建 Docker ImageDockerfile / requirements.txt 變動) ──
- name: 同步所有檔案並重建 Image