Files
deploy.stack/hindsight/stack.yml
cnphpbb 0cf24fee31 refactor(hindsight): 使用Volumes_Path替代硬编码路径
- backup.job 改为从 env.cfg 读取 Volumes_Path
- stack.yml 路径替换为变量引用
- .gitignore 添加 hindsight/env.cfg
2026-06-08 03:28:26 +08:00

72 lines
2.8 KiB
YAML
Raw 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.
# Hindsight 部署栈
# ============================================================
# 部署前准备(仅首次):
# 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
# RUN:: docker compose -p hindsight --env-file ./hindsight/env.cfg -f ./hindsight/stack.yml up -d
# disc::
# - DB 数据 bind 挂到 /home/geng/hindsight/pgdataWSL 原生 fs,避 9P fsync 风险)
# - 复用宿主 HF 缓存bge + ms-marco 不重下)
# - 镜像走南京大学 ghcr 镜像,国内拉得快
# - 端口 8888=API, 9999=Admin UI,绑定 0.0.0.0 供 LAN VM 访问
# ============================================================
services:
db:
image: ${HINDSIGHT_DB_IMAGE}:pg${HINDSIGHT_DB_VERSION:-18}
container_name: hindsight-db
restart: unless-stopped
environment:
- TZ=Asia/Shanghai
- POSTGRES_USER=${HINDSIGHT_DB_USER:-hindsight_user}
- POSTGRES_PASSWORD=${HINDSIGHT_DB_PASSWORD:?set HINDSIGHT_DB_PASSWORD}
- POSTGRES_DB=${HINDSIGHT_DB_NAME:-hindsight_db}
- POSTGRES_INITDB_ARGS=--encoding=UTF8 --locale=C
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- ${Volumes_Path}/pgdata:/var/lib/postgresql/${HINDSIGHT_DB_VERSION:-18}/docker
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${HINDSIGHT_DB_USER:-hindsight_user} -d ${HINDSIGHT_DB_NAME:-hindsight_db}"]
interval: 10s
timeout: 5s
retries: 10
networks:
- hindsight-net
hindsight:
image: ${HINDSIGHT_APP_IMAGE}:${HINDSIGHT_VERSION:-latest}
container_name: hindsight-app
restart: unless-stopped
depends_on:
db:
condition: service_healthy
ports:
- "${HINDSIGHT_API_PORT:-8888}:8888"
- "${HINDSIGHT_ADMIN_PORT:-9999}:9999"
environment:
- TZ=Asia/Shanghai
- HINDSIGHT_API_LLM_PROVIDER=${HINDSIGHT_API_LLM_PROVIDER}
- HINDSIGHT_API_LLM_API_KEY=${HINDSIGHT_API_LLM_API_KEY:?set HINDSIGHT_API_LLM_API_KEY}
- HINDSIGHT_API_LLM_MODEL=${HINDSIGHT_API_LLM_MODEL}
- HINDSIGHT_API_LLM_BASE_URL=${HINDSIGHT_API_LLM_BASE_URL}
- HINDSIGHT_API_DATABASE_URL=postgresql://${HINDSIGHT_DB_USER}:${HINDSIGHT_DB_PASSWORD}@db:5432/${HINDSIGHT_DB_NAME}
- HINDSIGHT_API_LOG_LEVEL=${HINDSIGHT_API_LOG_LEVEL:-info}
- HF_HUB_OFFLINE=1
- TRANSFORMERS_OFFLINE=1
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
# 复用宿主 HF 缓存,bge + ms-marco 不重下
- {Volumes_Path}/huggingface:/home/hindsight/.cache/huggingface
- ${Volumes_Path}/backups:/home/hindsight/backups
networks:
- hindsight-net
networks:
hindsight-net:
driver: bridge