Skip to content

Quick Start

lqdflying edited this page Aug 31, 2026 · 8 revisions

Quick Start (Docker Compose)

services:
  chathub:
    image: docker.io/lqdflying/chathub:latest
    depends_on:
      chathub-db:
        condition: service_healthy
    environment:
      - DATABASE_URL=postgres://user:password@chathub-db:5432/postgres
      - DATABASE_DRIVER=node
      - KEY_VAULTS_SECRET=<your-secret>
      - NEXTAUTH_SECRET=<your-secret>
      - NEXTAUTH_URL=https://your-domain.com
      # LLM API keys — see Model Providers page for per-provider examples
      # OPENAI_API_KEY=...
      # ANTHROPIC_API_KEY=...
      # MOONSHOT_API_KEY=...
      # MOONSHOT_PROXY_URL=https://your-moonshot-compatible-host/v1
      # MINIMAX_API_KEY=...
      # DEEPSEEK_API_KEY=...
      # MIMO_API_KEY=...
      # MIMO_PROXY_URL=https://api.xiaomimimo.com/v1
      # OpenAI-compatible gateway:
      # OPENAICOMPATIBLE_API_KEY=...
      # OPENAICOMPATIBLE_PROXY_URL=https://your-host/v1
      # Optional: disable background conversation generation
      # FEATURE_FLAGS=-durable_conversation_generation
      # CONVERSATION_WORKER_CONCURRENCY=4
      # DISABLE_CONVERSATION_WORKER=1
      # Dedicated Knowledge Base embeddings (all three are required):
      # RAG_EMBEDDING_PROVIDER=openai
      # RAG_EMBEDDING_MODEL=text-embedding-3-small
      # RAG_EMBEDDING_API_KEY=...
      # S3_ACCESS_KEY_ID=... (required for Picbed)
    ports:
      - '3210:3210'

  chathub-db:
    image: pgvector/pgvector:pg16
    environment:
      POSTGRES_USER: user
      POSTGRES_PASSWORD: password
      POSTGRES_DB: postgres
    volumes:
      - ./data/postgres:/var/lib/postgresql/data
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -U user -d postgres']
      interval: 5s
      timeout: 5s
      retries: 5

Database migrations run automatically on container startup when DATABASE_URL is set. ChatHub uses pgvector for Knowledge Base retrieval, so the database must provide the vector extension. The Compose image above includes it. See Knowledge Base and RAG for provider setup. Replies continue in the background after you close the tab; see Background Conversation Generation. Optional Code Interpreter Python is a sibling container; split-file 1Panel Compose (lobe.env + code-interpreter.env) is in Docker Deployment and Upgrades.

Redeploys and --force-recreate

  • Routine image upgrade: docker compose pull then docker compose up -d. The default image command runs /app/startServer.js, which applies migrations before the server listens.
  • docker compose up -d --force-recreate — Recreates containers from the compose file. It does not remove Postgres volumes. Use it when you want a clean chathub process after changing the image or env, so startup (including migrations) runs again.
  • Wiping database files (destructive): docker compose down, delete the bind-mounted Postgres data directory, then docker compose up -d. This is a full data loss reset; only do it when you intentionally discard all users and chats.

If you saw schema errors after an upgrade, the usual fix is pull newer image + restart/recreate chathub so migrations run against the same DATABASE_URL.

Clone this wiki locally