From c5d077ff7702ffd82198a61536c5787b131d8f41 Mon Sep 17 00:00:00 2001 From: OoO Date: Wed, 13 May 2026 19:13:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20DevOps=20=E6=89=8B?= =?UTF-8?q?=E5=86=8A=20runtime=20=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/guides/devops_handbook.md | 18 ++++++++++++------ .../claude_inventory_validation_20260513.md | 1 + tests/test_phase3f_cleanup_contracts.py | 13 +++++++++++++ 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/docs/guides/devops_handbook.md b/docs/guides/devops_handbook.md index d2bfdd9..662b4ef 100644 --- a/docs/guides/devops_handbook.md +++ b/docs/guides/devops_handbook.md @@ -15,12 +15,18 @@ ### 常用操作 - **查看狀態**: `docker ps | grep momo` - **查看日誌**: `docker logs -f momo-pro-system --tail 100` -- **重啟主應用**: `docker restart momo-pro-system` +- **熱重載主應用**: `docker kill -s HUP momo-pro-system` +- **精準重建應用容器**: `docker compose up -d --no-deps --force-recreate momo-app` +- **精準重建排程/Telegram**: `docker compose up -d --no-deps --force-recreate scheduler telegram-bot` - **全面啟動**: `docker compose up -d` - **進入資料庫**: `docker exec -it momo-db psql -U momo` +紅線: +- 禁止使用 `docker compose down` 或 `--remove-orphans`。 +- 禁止 stop/remove/recreate `momo-db`;資料庫生命週期需另走明確維護流程。 + ### 影像管理 -- **重建影像**: `docker compose build --no-cache momo-pro-system` +- **重建影像**: `docker compose build --no-cache momo-app` - **清理過期資源**: `docker system prune -f` --- @@ -40,10 +46,10 @@ --- -## ❄️ K8s 相關指令 (已撤除,備份存檔) -- **查看 Pod**: `kubectl get pods -n momo` -- **重啟 Deployment**: `kubectl rollout restart deployment/momo-app -n momo` -- **查看日誌**: `kubectl logs -f deployment/momo-app -n momo` +## ❄️ K8s / K3s 狀態 +已撤除。EwoooC 正式 runtime 是 188 主機的 Docker Compose,110 只作為 Gateway / Nginx / Gitea 等周邊服務主機。 + +若看到舊文件提到 Pod、Deployment、PVC 或叢集操作,先以 `docs/adr/ADR-008-actual-runtime-on-188.md` 與 `docs/adr/ADR-011-cross-project-resource-isolation.md` 為準,不要照抄舊叢集命令。 --- diff --git a/docs/memory/claude_inventory_validation_20260513.md b/docs/memory/claude_inventory_validation_20260513.md index 7a49544..c535ded 100644 --- a/docs/memory/claude_inventory_validation_20260513.md +++ b/docs/memory/claude_inventory_validation_20260513.md @@ -63,6 +63,7 @@ - AI 觀測台 V3 排版規範已補強:`scripts/check_responsive_overflow.js` 會把視覺 overflow offenders 視為失敗,並允許表格/圖表在 `.obs-table-shell`、`.obs-chart-frame` 等局部容器內滾動;`observability-system.css` / `web/static/css/observability-system.css` 已同步新增 bounded table/chart/mobile containment,CSS mirror 與 `quick_review.sh --observability-qa --skip-production` 均通過。 - app.py/BP 路由雙寫已完成收斂:active `@app.route` 為 0,`USE_MODULAR_ROUTES` 與舊 routes registry shim 已不存在;`tests/test_phase3f_cleanup_contracts.py::test_app_py_stays_blueprint_only_for_routes` 會防止 route decorator 回到 `app.py`。 - `app.py` 開頭的歷史「重開機後請依序執行」TODO banner 已移除;入口治理以 `AGENTS.md` / `CONSTITUTION.md` / ADR / memory 索引為準,`tests/test_phase3f_cleanup_contracts.py::test_app_py_does_not_start_with_stale_restart_todo_banner` 會防止 stale 操作清單回流。 +- `docs/guides/devops_handbook.md` 已移除活躍手冊中的舊 K8s command 區塊,並把 app 操作改為 Gunicorn HUP 熱重載、Docker Compose 精準 force-recreate、`momo-app` service build;`tests/test_phase3f_cleanup_contracts.py::test_devops_handbook_uses_current_docker_runtime_commands` 會防止 `kubectl`、`docker restart momo-pro-system` 與錯誤 compose service name 回流。 - AI 觀測台 badge/chip 對比規範已補強:`.momo-observability-mode` 內的 badge、pill 與 nested surface 會改走亮底、8px radius、無負字距、可換行且不再殘留低對比 legacy dark-hero 樣式;CSS mirror、`quick_review.sh --observability-ui`、`quick_review.sh --observability-qa --skip-production` 均通過。 - AI 觀測台 rendered visual contract 已入庫:`scripts/check_observability_visual_contract.sh` 會用 Playwright 檢查 10 頁 × desktop/tablet/mobile 的 title typography、surface radius/background、chip contrast、hero height 與水平 overflow;V10.116 main 版 local server 驗證 30 項 PASS。測未部署變更時必須帶 localhost `--base-url`,打 production fail 可能只是正式站尚未部署該版。 - V10.117 已把 AI 觀測台背景語彙收斂為 tokenized dot-matrix:合約會要求 hero/signal/panel surface 的 computed `background-image` 是 `radial-gradient`,並拒絕 legacy `linear-gradient` / `background-image: none` 回流;終端 dot-matrix layer 必須留在 CSS 檔尾以贏過舊 neutralizer。 diff --git a/tests/test_phase3f_cleanup_contracts.py b/tests/test_phase3f_cleanup_contracts.py index 0dea36b..95cf550 100644 --- a/tests/test_phase3f_cleanup_contracts.py +++ b/tests/test_phase3f_cleanup_contracts.py @@ -275,3 +275,16 @@ def test_gitea_cd_uses_ewoooc_dedicated_runner_label(): assert "runs-on: ubuntu-latest" not in workflow assert "runs-on: ubuntu-22.04" not in workflow assert "runs-on: ubuntu-24.04" not in workflow + + +def test_devops_handbook_uses_current_docker_runtime_commands(): + handbook = (ROOT / "docs" / "guides" / "devops_handbook.md").read_text(encoding="utf-8") + + assert "kubectl" not in handbook + assert "docker restart momo-pro-system" not in handbook + assert "docker compose build --no-cache momo-pro-system" not in handbook + assert "docker kill -s HUP momo-pro-system" in handbook + assert "docker compose build --no-cache momo-app" in handbook + assert "docker compose up -d --no-deps --force-recreate momo-app" in handbook + assert "--remove-orphans" in handbook + assert "禁止" in handbook