fix: rebuild binary without MongoDB health check dependency
- Removed check_mongodb() from health.rs - Health endpoint now depends only on PostgreSQL + Redis + Qdrant - Regenerated .sqlx offline query cache (was incomplete, only 3 files) - Binary rebuilt: target/release/momentry (47M, arm64) - Deployed to 203 (m4promini) Full clean-install + sample data install verified: - clean-install.sh: ✅ (23 PASS / 0 FAIL) - sample data: ✅ 100 videos, 899 processor_results, 100 monitor_jobs - Health endpoint: status=ok (no MongoDB hang)
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
# 移除 MongoDB 依賴 — 變更說明
|
||||
|
||||
## 問題
|
||||
m5max128 (192.168.110.200) 的 `/api/v1/health` 端點掛住,因為 health check
|
||||
等待 MongoDB 連線回應,但該機器未安裝 MongoDB。
|
||||
|
||||
## 修改內容
|
||||
|
||||
### `src/api/health.rs`
|
||||
| 變更 | 說明 |
|
||||
|---|---|
|
||||
| 移除 `MongoCache` import | 不再需要 MongoDB 型別 |
|
||||
| 移除 `check_mongodb()` 函數 | 不再檢查 MongoDB 健康狀態 |
|
||||
| `health()` 函數 | `all_ok` 條件改為只檢查 PostgreSQL + Redis + Qdrant |
|
||||
| `health_detailed()` 函數 | 同上,移除 MongoDB 檢查 |
|
||||
| `ServiceHealth` struct | `mongodb` 欄位註解化 |
|
||||
|
||||
### 影響範圍
|
||||
- Health 端點不再依賴 MongoDB
|
||||
- `AppState` 中的 `mongo_cache` 欄位仍保留(供其他功能使用)
|
||||
- server.rs 中的 MongoDB 初始化(5 秒 timeout → disabled fallback)維持原樣
|
||||
|
||||
## 重新編譯
|
||||
|
||||
### 目前阻礙
|
||||
`.sqlx/` 目錄只有 3 個查詢快取檔案,缺少:
|
||||
- `command/queue.rs` 的查詢快取
|
||||
- `vlm/consumer.rs` 的查詢快取
|
||||
|
||||
### 解決步驟
|
||||
```bash
|
||||
# 方法 1: 完整 .sqlx 快取(需要連線到 DB)
|
||||
cd /Users/accusys/momentry_core
|
||||
export DATABASE_URL="postgres://accusys@localhost:5432/momentry"
|
||||
cargo sqlx prepare
|
||||
SQLX_OFFLINE=true cargo build --release
|
||||
|
||||
# 方法 2: 修復現有查詢錯誤後再編譯
|
||||
# 檢查 src/core/command/queue.rs 和 src/core/vlm/consumer.rs 的 sqlx 巨集
|
||||
|
||||
# 編譯完成後替換 binary
|
||||
cp target/release/momentry ../momentry/bin/momentry
|
||||
```
|
||||
|
||||
### 部署到 203 (m4promini)
|
||||
```bash
|
||||
scp target/release/momentry accusys@192.168.110.203:~/momentry/bin/momentry
|
||||
ssh accusys@192.168.110.203 'launchctl stop com.momentry.server && launchctl start com.momentry.server'
|
||||
```
|
||||
|
||||
## 驗證
|
||||
重啟後測試:
|
||||
```bash
|
||||
curl -s -m 10 http://localhost:3002/api/v1/health
|
||||
# 應回傳: {"status":"ok", ...} 而不是超時
|
||||
```
|
||||
|
||||
## Git commit
|
||||
`4f4aa27d` on branch `feature/dynamic-concurrency-v1.3.4`
|
||||
Reference in New Issue
Block a user