feat(hindsight): 新增 Hindsight 方案三部署 stack

采用 DB+Hindsight 分离部署方案:
- pgvector/pgvector:pg18 向量数据库
- ghcr.nju.edu.cn/vectorize-io/hindsight:latest 应用
- 0.0.0.0:8888/9999 端口绑定
- ~/hindsight/pgdata bind mount (避免 9P fsync 性能)
- HF_CACHE_DIR 参数化,适配非 WSL 环境
- 每日 pg_dump 备份,7 天保留

参考 Obsidian 知识库 DevOps/04-AI工具/Hindsight部署指南.md
This commit is contained in:
2026-06-08 00:03:53 +08:00
parent b5fdc1682b
commit 9c83f6e2e8
4 changed files with 303 additions and 0 deletions

39
hindsight/env.cfg.example Normal file
View File

@@ -0,0 +1,39 @@
# ============================================================
# Hindsight 部署 — 公共环境变量(不含敏感信息)
# 复制为 env.cfg 后填入真实值env.cfg 已被 .gitignore 忽略
# ============================================================
# 镜像版本
HINDSIGHT_VERSION=latest
HINDSIGHT_DB_VERSION=18
# 镜像源
HINDSIGHT_DB_IMAGE=pgvector/pgvector
HINDSIGHT_APP_IMAGE=ghcr.nju.edu.cn/vectorize-io/hindsight
# 数据库账号/库名
HINDSIGHT_DB_USER=hindsight_user
HINDSIGHT_DB_NAME=hindsight_db
# 宿主机数据卷路径(**必须 WSL/Linux ext4 原生 fs**,不能放 /mnt/9P
# bind 挂载 PostgreSQL 数据;放在 ~/hindsight/pgdata 而非 /mnt/d/mydata/
# 因为 9P drvfs 的 fsync 不可靠,会导致 PG 数据损坏。
Volumes_Path=/home/geng/hindsight
# 服务端口(宿主机:容器)
HINDSIGHT_API_PORT=8888
HINDSIGHT_ADMIN_PORT=9999
# LLMMiniMax OpenAI-compatible 协议)
HINDSIGHT_API_LLM_PROVIDER=MiniMax-CN
HINDSIGHT_API_LLM_MODEL=MiniMax-M3
HINDSIGHT_API_LLM_BASE_URL=https://api.minimaxi.com/v1
# 日志
HINDSIGHT_API_LOG_LEVEL=info
# ============================================================
# 敏感值必填env.cfg 不提交)— 在 .gitignore 已忽略
# ============================================================
# HINDSIGHT_DB_PASSWORD=<强密码>
# HINDSIGHT_API_LLM_API_KEY=<你的 MiniMax key>