Created
October 26, 2025 05:43
-
-
Save gemnioo/109d8af54420135324c1e17e0a6c0e45 to your computer and use it in GitHub Desktop.
LobeChat Database 自部署
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Docs | |
| ## LobeChat | |
| ## https://lobehub.com/zh/docs/self-hosting/server-database/docker | |
| ## https://lobehub.com/zh/docs/self-hosting/advanced/online-search | |
| ## docker command | |
| ``` | |
| root@japan:~# touch lobe-chat.env | |
| root@japan:~# nano lobe-chat.env | |
| FEATURE_FLAGS='-welcome_suggest' | |
| ENABLE_AUTH_PROTECTION=1 | |
| APP_URL=https://japan.tailscale_name.ts.net | |
| DATABASE_URL=postgres://postgres:密码密码_密码对应@pgvector:4321/postgres | |
| KEY_VAULTS_SECRET= | |
| NEXT_AUTH_SECRET= | |
| NEXT_AUTH_SSO_PROVIDERS=cloudflare-zero-trust | |
| AUTH_CLOUDFLARE_ZERO_TRUST_ID= | |
| AUTH_CLOUDFLARE_ZERO_TRUST_SECRET= | |
| AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER= | |
| NEXTAUTH_URL=https://japan.tailscale_name.ts.net/api/auth | |
| S3_ACCESS_KEY_ID= | |
| S3_SECRET_ACCESS_KEY= | |
| S3_ENDPOINT= | |
| S3_PUBLIC_DOMAIN=h | |
| OPENAI_API_KEY= 推荐使用第三方 如 ohmygpt | |
| OPENAI_PROXY_URL=https://apic1.ohmycdn.com/v1 | |
| ACCESS_CODE= | |
| OPENAI_MODEL_LIST=gpt-4,gpt-4o-mini | |
| ANTHROPIC_API_KEY= | |
| ANTHROPIC_PROXY_URL=https://api.anthropic.com | |
| AZURE_API_KEY= | |
| AZURE_API_VERSION=2024-08-01-preview | |
| AZURE_ENDPOINT=https://name.openai.azure.com | |
| AZURE_MODEL_LIST=gpt-4,gpt-4o-mini | |
| DEEPSEEK_API_KEY= | |
| XAI_API_KEY=xai- | |
| GOOGLE_API_KEY= | |
| GOOGLE_PROXY_URL= | |
| AWS_ACCESS_KEY_ID= | |
| AWS_SECRET_ACCESS_KEY=W | |
| AWS_REGION=us-east-1 | |
| SEARCH_PROVIDERS=exa | |
| SEARXNG_URL=http://localhost:24321/ | |
| EXA_API_KEY= | |
| CRAWLER_IMPLS="browserless,firecrawl,exa" | |
| FIRECRAWL_URL=https://api.firecrawl.dev/v1 | |
| FIRECRAWL_API_KEY= | |
| BROWSERLESS_URL=https://chrome.browserless.io | |
| BROWSERLESS_TOKEN= | |
| BROWSERLESS_BLOCK_ADS=1 | |
| BROWSERLESS_STEALTH_MODE=1 | |
| ``` | |
| ## 先 db 后 lobechat | |
| ``` | |
| ## Postgres pgvector 数据库实例 | |
| docker network create pg | |
| # First, create a named volume 持久化存储位置 | |
| docker volume create postgres_vector | |
| # Then modify your run command to use the volume | |
| docker run --name pgvector \ | |
| --network pg \ | |
| -e POSTGRES_PASSWORD=密码密码_密码对应 \ | |
| -p 4321:4321 \ | |
| -v postgres_vector:/var/lib/postgresql/data \ | |
| -d pgvector/pgvector:pg18 | |
| docker run -it -d -p 3210:3210 --network pg --env-file lobe-chat.env --name lobe-chat-database lobehub/lobe-chat-database | |
| 不太建议自建 SearXNG 还是用 exa + firecrawl | |
| ``` | |
| ## Tailscale tailnet serve / funnel 使用 | |
| Docs: https://tailscale.com/kb/1242/tailscale-serve | |
| ``` | |
| #tailscale funnel background process | |
| tailscale funnel --bg 34321 | |
| #disable the proxy | |
| tailscale funnel --https=443 off | |
| ``` |
Author
As the DB pgvector update!
PostgreSQL 18+ now uses version-specific data directories (like /var/lib/postgresql/18/docker) instead of the generic /var/lib/postgresql/data. Your current mount configuration is causing a conflict. update claim
Key Change
Before: -v postgres_vector:/var/lib/postgresql/data
After: -v postgres_vector:/var/lib/postgresql
This allows PostgreSQL 18 to create its version-specific subdirectory (18/docker) automatically.
Need update pgvector command to below:
docker run --name pgvector \
--network pg \
-e POSTGRES_PASSWORD=密码密码_密码对应 \
-p 4321:4321 \
-v postgres_vector:/var/lib/postgresql \
-d pgvector/pgvector:pg18
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!!!