- 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/
26 lines
900 B
Bash
Executable File
26 lines
900 B
Bash
Executable File
#!/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
|