Files
YuTengjing 191f3fe776 📝 docs: fix outdated content across the docs site (#16964)
* 📝 docs: fix outdated content across the docs site

Audited docs/ against the current codebase and fixed stale content that
drifted after major refactors (Clerk/NextAuth → Better Auth, src/server →
apps/server, src/{config,envs,locales} → packages/*, model-bank updates).

- self-hosting/auth: mark removed NextAuth/Clerk pages with deprecation
  warnings; fix microsoft/zitadel alias claims and the Logto callback path
- environment-variables & advanced: correct wrong defaults (S3_SET_ACL,
  AI_IMAGE_DEFAULT_IMAGE_NUM, index/proxy URLs), drop non-existent env vars
  and fictional feature flags, fix OIDC config guidance
- development: update refactored paths, Better Auth, .mjs configs, remove
  the MSW section (msw is not a dependency)
- providers & model examples: replace retired model ids with in-bank ones;
  fix comfyui frontmatter corruption
- usage: rename Moderator→Orchestrator, GTD→Task, correct shortcut keys,
  channel capability tables, Feishu/Lark WebSocket mode
- platform/migration: fix dead links, docker service name, npx/npm → bun

EN and zh-CN pairs updated together.

* 📝 docs: fix Logto callback path and AUTH_SECRET deprecation guidance

- Revert Logto/Sealos callback URLs to /api/auth/callback/logto to match
  the runtime SSO redirectURI override
- Narrow legacy auth Callout: AUTH_SECRET remains required for Better Auth;
  mark NEXT_AUTH_SECRET as deprecated in zh-CN

* 📝 docs: refresh agent skills for locales, env, auth, and agentRun paths

Align OSS agent guidance with post-refactor layout:
- packages/locales/src/default + bun run i18n
- packages/env/src for env schemas (@/envs alias)
- spa-auth shell + src/routes/auth segments
- chat agentRun/transports/hetero instead of aiChat

* 📝 docs: document APP_URL as required for Better Auth base URL

Self-hosted auth uses appEnv.APP_URL as baseURL, not request-header
auto-detection. NEXT_PUBLIC_AUTH_URL remains deprecated.

* 📝 docs: note self-host search provider setup for web search

Built-in lobe-web-browsing needs no client plugin, but self-hosted
servers still require SEARCH_PROVIDERS / SEARXNG_URL (default SearXNG).

* 📝 docs: point feature guide welcome UI at AgentHome

Opening message/questions on the agent chat page live in
src/features/AgentHome, not Onboarding WelcomeMessage.
2026-07-10 17:50:03 +08:00

165 lines
6.0 KiB
Plaintext

---
title: Deploying LobeHub Database with Docker
description: >-
Learn how to deploy the LobeHub server database version using Docker on Linux
and local machines.
tags:
- LobeHub
- Docker
- Database Deployment
- Postgres
---
# Deploying Server Database Version Using Docker
<div style={{display:"flex", gap: 4}}>
[![][docker-release-shield]][docker-release-link]
[![][docker-size-shield]][docker-size-link]
[![][docker-pulls-shield]][docker-pulls-link]
</div>
<Callout type="info">
This article assumes that you are familiar with the basic principles and processes of deploying
the LobeHub server database version, so it only includes content related to core environment
variable configuration. If you are not familiar with the deployment principles of the LobeHub
server database version, please refer to [Getting
Started](/docs/self-hosting/start) first.
</Callout>
## Deploying on a Linux Server
Here is the process for deploying the LobeHub server database version on a Linux server:
<Steps>
### Create a Postgres Database Instance
Please create a Postgres database instance according to your needs, for example:
```sh
docker network create pg
docker run --name my-postgres --network pg -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 -d paradedb/paradedb:latest-pg17 -c shared_preload_libraries=pg_search
```
The above command will create a Postgres instance named `my-postgres` with the network set to `pg`, where `paradedb/paradedb:latest-pg17` is a Postgres 17 image with the `pgvector` and `pg_search` extensions installed and enabled by default.
<Callout type="info">
The ParadeDB image includes pgvector (vector search) and pg\_search (full-text search) plugins, which are important
components for LobeHub to implement RAG and knowledge base search.
It should be noted that the new version of ParadeDB requires explicitly enabling the pg\_search extension in order to be used by LobeHub. Here we explicitly enable pg\_search.
</Callout>
<Callout type="warning">
The above command does not specify a persistent storage location for the pg instance, so it is
only for testing/demonstration purposes. Please configure persistent storage for production
environments.
</Callout>
### Create a file named `lobehub.env` to store environment variables:
Click the buttons below to generate required secrets:
<GenerateSecret envName="KEY_VAULTS_SECRET" />
<GenerateSecret envName="AUTH_SECRET" />
Click the button below to generate `JWKS_KEY` (for signing and verifying JWTs):
<GenerateJWKSKey />
```shell
# Website domain
APP_URL=https://your-prod-domain.com
# DB required environment variables
KEY_VAULTS_SECRET=jgwsK28dspyVQoIf8/M3IIHl1h6LYYceSYNXeLpy6uk=
# Postgres database connection string
# Format: postgres://username:password@host:port/dbname; if your pg instance is a Docker container, use the container name
DATABASE_URL=postgres://postgres:mysecretpassword@my-postgres:5432/postgres
# Authentication (Better Auth)
# Session encryption key (generate with: openssl rand -base64 32)
AUTH_SECRET=jgwsK28dspyVQoIf8/M3IIHl1h6LYYceSYNXeLpy6uk=
# JWKS key for signing and verifying JWTs
JWKS_KEY='{"keys":[...]}'
# S3 related
S3_ACCESS_KEY_ID=xxxxxxxxxx
S3_SECRET_ACCESS_KEY=xxxxxxxxxx
S3_ENDPOINT=https://xxxxxxxxxx.r2.cloudflarestorage.com
S3_BUCKET=LobeHub
```
### Start the lobehub Docker image
```sh
docker run -it -d -p 3210:3210 --network pg --env-file lobehub.env --name lobehub lobehub/lobehub
```
You can use the following command to check the logs:
```sh
docker logs -f lobehub
```
If you see the following logs in the container, it means it has started successfully:
```log
[Database] Start to migration...
✅ database migration pass.
-------------------------------------
▲ Next.js 16.x.x
- Local: http://localhost:3210
- Network: http://0.0.0.0:3210
✓ Starting...
✓ Ready in 95ms
```
</Steps>
<Callout type="tip">
In our official Docker image, the database schema migration is automatically executed before
starting the image. We ensure stability from an empty database to all tables being formally
available. Therefore, we recommend using an empty table instance for your database to avoid the
cost of manually maintaining table structure migration.
</Callout>
## Using Locally (Mac / Windows)
The data version of LobeHub also supports direct use on a local Mac/Windows machine.
Here, we assume that you have a pg instance available on port 5432 locally on your Mac/Windows, with the account `postgres` and password `mysecretpassword`, accessible at `localhost:5432`.
The script command you need to execute is:
```shell
$ docker run -it -d --name lobehub -p 3210:3210 \
-e DATABASE_URL=postgres://postgres:mysecretpassword@host.docker.internal:5432/postgres \
-e KEY_VAULTS_SECRET=jgwsK28dspyVQoIf8/M3IIHl1h6LYYceSYNXeLpy6uk= \
-e AUTH_SECRET=jgwsK28dspyVQoIf8/M3IIHl1h6LYYceSYNXeLpy6uk= \
-e JWKS_KEY='{"keys":[...]}' \
-e APP_URL=http://localhost:3210 \
-e S3_ACCESS_KEY_ID=xxxxxxxxxx \
-e S3_SECRET_ACCESS_KEY=xxxxxxxxxx \
-e S3_ENDPOINT=https://xxxxxxxxxx.r2.cloudflarestorage.com \
-e S3_BUCKET=LobeHub \
lobehub/lobehub
```
<Callout type="tip">
`Docker` uses a virtual machine solution on `Windows` and `macOS`. If you use `localhost` /
`127.0.0.1`, it will refer to the container's `localhost`. In this case, try using
`host.docker.internal` instead of `localhost`.
</Callout>
[docker-pulls-link]: https://hub.docker.com/r/lobehub/lobehub
[docker-pulls-shield]: https://img.shields.io/docker/pulls/lobehub/lobehub?color=45cc11&labelColor=black&style=flat-square
[docker-release-link]: https://hub.docker.com/r/lobehub/lobehub
[docker-release-shield]: https://img.shields.io/docker/v/lobehub/lobehub?color=369eff&label=docker&labelColor=black&logo=docker&logoColor=white&style=flat-square&sort=semver
[docker-size-link]: https://hub.docker.com/r/lobehub/lobehub
[docker-size-shield]: https://img.shields.io/docker/image-size/lobehub/lobehub?color=369eff&labelColor=black&style=flat-square&sort=semver