Files
wangliang 39986f10f2 初始化 LibreDesk 本地实例部署仓库
- docker compose 部署:app / db / redis / tls(nginx) / bridge-tools,宿主端口错开避免与本机服务冲突
- bridge-tools 内联进仓库(compose build 路径改为 ./bridge-tools),仓库自包含可部署
- 部署说明 README、crm-new 对照与 bridge-tools 方案文档、备份与隧道脚本
- .gitignore 排除 .env、config.toml、uploads/、tls 私钥/证书、backups/、logs/
2026-10-29 13:24:13 +08:00

26 lines
900 B
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 确保 yw-dev DB 隧道在线(bridge-tools 依赖它)。
# 幂等:隧道已完整转发时直接退出;否则调用 yw-db-tunnel start 并记日志。
# cron:@reboot sleep 60; .../ensure-tunnel.sh
# */5 * * * * .../ensure-tunnel.sh
set -uo pipefail
export PATH="/home/dev/.local/bin:/usr/local/bin:/usr/bin:/bin"
TUNNEL="/home/dev/.local/bin/yw-db-tunnel"
LOG="/home/dev/code/yehwang-ai/libredesk/logs/tunnel.log"
mkdir -p "$(dirname "$LOG")"
status_out="$("$TUNNEL" status 2>/dev/null || true)"
if printf '%s' "$status_out" | grep -q '隧道进程: 运行中' \
&& ! printf '%s' "$status_out" | grep -q '未转发'; then
exit 0
fi
echo "[$(date -Is)] tunnel down, starting" >> "$LOG"
if "$TUNNEL" start >> "$LOG" 2>&1; then
echo "[$(date -Is)] tunnel ok" >> "$LOG"
exit 0
fi
echo "[$(date -Is)] tunnel start FAILED (see log above)" >> "$LOG"
exit 1