From 4133a823e9885aff3a0762e79872b5b5fce40351 Mon Sep 17 00:00:00 2001 From: cnphpbb Date: Mon, 8 Jun 2026 03:28:26 +0800 Subject: [PATCH] =?UTF-8?q?refactor(hindsight):=20=E4=BD=BF=E7=94=A8Volume?= =?UTF-8?q?s=5FPath=E6=9B=BF=E4=BB=A3=E7=A1=AC=E7=BC=96=E7=A0=81=E8=B7=AF?= =?UTF-8?q?=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - backup.job 改为从 env.cfg 读取 Volumes_Path - stack.yml 路径替换为变量引用 - .gitignore 添加 hindsight/env.cfg --- .gitignore | 2 +- hindsight/backup.job | 6 +++++- hindsight/stack.yml | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 0b3e541..441094c 100644 --- a/.gitignore +++ b/.gitignore @@ -25,8 +25,8 @@ crontab/debug_*.py crontab/test_*.py crontab/test*.py g-b/* -.gitignore mcptime/go.sum mcpTimeServer/go.sum mcp_server_go/config.toml compare_images.py +hindsight/env.cfg diff --git a/hindsight/backup.job b/hindsight/backup.job index 40f63d9..0cac3d4 100644 --- a/hindsight/backup.job +++ b/hindsight/backup.job @@ -6,7 +6,11 @@ # ============================================================ set -euo pipefail -BACKUP_DIR="/home/geng/hindsight/backups" +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +# shellcheck source=/dev/null +source "${SCRIPT_DIR}/env.cfg" + +BACKUP_DIR="${Volumes_Path}/backups" KEEP_DAYS=7 TS=$(date +%Y%m%d_%H%M%S) FNAME="hindsight_db_${TS}.sql.gz" diff --git a/hindsight/stack.yml b/hindsight/stack.yml index 8af68d8..7b8d3fb 100644 --- a/hindsight/stack.yml +++ b/hindsight/stack.yml @@ -1,8 +1,8 @@ # Hindsight 部署栈 # ============================================================ # 部署前准备(仅首次): -# mkdir -pv /home/geng/hindsight/pgdata /home/geng/hindsight/backups -# sudo chown -R 999:999 /home/geng/hindsight/pgdata +# mkdir -pv ${Volumes_Path}/pgdata ${Volumes_Path}/backups +# sudo chown -R 999:999 ${Volumes_Path}/pgdata # cp env.cfg.example env.cfg && $EDITOR env.cfg # 填入密码/API Key # # pull:: docker compose --env-file ./hindsight/env.cfg -f ./hindsight/stack.yml pull