feat: add CodiMD database port-forward helper scripts

Add three scripts to simplify CodiMD database access via port-forward:
- db-port-forward.sh: Start SSH tunnel and kubectl port-forward
- db-port-forward-stop.sh: Stop port-forward processes
- db-status.sh: Check port-forward status

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-07 12:06:47 +08:00
parent a0e20877a2
commit 67d41fa688
3 changed files with 105 additions and 0 deletions

23
apps/codimd/db-status.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/bash
# 檢查 CodiMD 資料庫 Port Forward 狀態
echo "=== CodiMD 資料庫 Port Forward 狀態 ==="
if pgrep -f "port-forward.*codimd-db" > /dev/null; then
PIDS=$(pgrep -f "port-forward.*codimd-db")
echo "✅ Port-forward 正在運行"
echo " PID(s): $PIDS"
# 檢查 port 是否可連接
if nc -z localhost 5432 2>/dev/null; then
echo "✅ Port 5432 可連接"
else
echo "⚠️ Port 5432 無法連接"
fi
exit 0
else
echo "❌ Port-forward 未運行"
echo ""
echo "啟動方式: ./db-port-forward.sh"
exit 1
fi