BookOrbit:自托管图书馆和阅读平台

离线镜像下载地址:https://pan.quark.cn/s/b05a9eb499f3

wget https://git.ossdate.com/fivemoons/oss-scripts/raw/branch/main/bookorbit/.env
wget https://git.ossdate.com/fivemoons/oss-scripts/raw/branch/main/bookorbit/docker-compose.yml
name: bookorbit

services:
  app:
    container_name: bookorbit-app
    image: ${APP_IMAGE?required}
    restart: unless-stopped
    init: true
    env_file:
      - .env
    ports:
      - "${APP_PORT:-3000}:${PORT:-3000}"
    environment:
      NODE_ENV: production
      PORT: ${PORT:-3000}
      DATABASE_URL: ${DATABASE_URL:-}
      POSTGRES_HOST: ${POSTGRES_HOST:-postgres}
      POSTGRES_PORT: ${POSTGRES_PORT:-5432}
      POSTGRES_USER: ${POSTGRES_USER?required}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD?required}
      POSTGRES_DB: ${POSTGRES_DB?required}
      JWT_SECRET: ${JWT_SECRET?required}
      SETUP_BOOTSTRAP_TOKEN: ${SETUP_BOOTSTRAP_TOKEN?required}
      APP_URL: ${APP_URL?required}
      CLIENT_URL: ${CLIENT_URL:-${APP_URL?required}}
      PUID: ${PUID:-1000}
      PGID: ${PGID:-1000}
      NODE_MAX_OLD_SPACE_SIZE: ${NODE_MAX_OLD_SPACE_SIZE:-auto}
      BOOK_DOCK_PATH: ${BOOK_DOCK_PATH:-}
      LIBRARY_BROWSE_ROOT: ${LIBRARY_BROWSE_ROOT:-}
    depends_on:
      postgres:
        condition: service_healthy
    volumes:
      - ${BOOKS_HOST_PATH:-./books}:/books
      - ./data/app:/data
    read_only: true
    tmpfs:
      - /tmp
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - DAC_OVERRIDE
      - FOWNER
      - SETGID
      - SETUID
    security_opt:
      - no-new-privileges:true
    stop_grace_period: 30s
    healthcheck:
      test:
        [
          "CMD",
          "node",
          "-e",
          "const p=process.env.PORT||3000;fetch('http://127.0.0.1:'+p+'/api/v1/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))",
        ]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 20s

  postgres:
    container_name: bookorbit-db
    image: pgvector/pgvector:pg18
    restart: unless-stopped
    environment:
      POSTGRES_USER: ${POSTGRES_USER?required}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD?required}
      POSTGRES_DB: ${POSTGRES_DB?required}
      PGDATA: /var/lib/postgresql/data/pgdata
    volumes:
      - ./data/postgres:/var/lib/postgresql/data
    healthcheck:
      test:
        ["CMD-SHELL", 'pg_isready -U "$${POSTGRES_USER}" -d "$${POSTGRES_DB}"']
      interval: 10s
      timeout: 5s
      retries: 10
      start_period: 20s
# Docker image to run. Pin a sha-* tag or @sha256 digest for stricter deploys.
APP_IMAGE=ghcr.io/bookorbit/bookorbit:2.5.0 # 修改标签

# App publish port on host
APP_PORT=3000

# Host folder that appears as /books in the container.
# Point this at your library root; use an absolute path on NAS/Portainer installs.
BOOKS_HOST_PATH=./books # 指向自己的目录

# Container runtime UID/GID for files written to app-managed data folders.
# Most users can leave these defaults.
PUID=1000
PGID=1000

# Database credentials
POSTGRES_USER=bookorbit
POSTGRES_PASSWORD=9h6h1e2h4fcmd3 # 修改此处密码
POSTGRES_DB=bookorbit

# App secrets
JWT_SECRET=f2f0d2931f28d36cc35d9188aa298a1387fa4c6cdec582eb9ae0c13ddb8b1475 # 执行openssl rand -hex 32
# Required for the initial /auth/setup endpoint (x-setup-token header)
SETUP_BOOTSTRAP_TOKEN=7c9de0a79208e444f99db803790f6258 # 执行openssl rand -hex 16

# External/public URL used by emails and Kobo endpoints
APP_URL=http://192.168.1.99:3000 # 修改IP地址

# Node.js JavaScript heap limit in MB. Raise this for very large libraries, 250K+ books.
NODE_MAX_OLD_SPACE_SIZE=2048

# --- Optional overrides (uncomment to set) ---

# If you already run your own PostgreSQL, set DATABASE_URL and remove the
# postgres service from docker-compose.yml. Your instance must have the
# uuid-ossp, pg_trgm, and vector (pgvector) extensions available.
# DATABASE_URL=postgres://user:password@yourhost:5432/bookorbit
# Or set individual parts (POSTGRES_HOST, POSTGRES_PORT, POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB)

# CORS origin for the frontend when served from a different domain than APP_URL
# CLIENT_URL=https://app.example.com

# Container folder used as the top of the library creation folder picker.
# Defaults to / when unset. Set to /books to hide other container root folders.
# LIBRARY_BROWSE_ROOT=/books

# Set to false only if your platform manages bind mount ownership externally.
# BOOKORBIT_FIX_PERMISSIONS=true

# Recommended if you store SMTP provider credentials (generate: openssl rand -hex 32)
# EMAIL_ENCRYPTION_KEY=

# Recommended if you store migration source credentials (generate: openssl rand -hex 32)
# MIGRATION_ENCRYPTION_KEY=

# Log level (default: info). Set to debug for verbose output.
# LOG_LEVEL=info

# Allow OIDC issuer/discovery URLs that resolve to private/local addresses.
# Default false. Enable only in trusted self-hosted networks.
# OIDC_ALLOW_LOCAL_ISSUERS=false

# Optional: allow Cloudflare Web Analytics beacon when using automatic setup.
# Keep unset/false to preserve strict CSP (`script-src 'self'`).
# CSP_ALLOW_CLOUDFLARE_INSIGHTS=false
  • docs/book/bookorbit.txt
  • 最后更改: 2026/08/15 07:49
  • ossdate