# 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/pgdata(WSL 原生 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