# 部署
docker-compose 部署方式
首先需要安装 docker 和 docker-compose
# docker 安装
- sudo apt update
- sudo apt install docker.io
- 安装 docker-compose
1
| sudo curl -SL https://github.com/docker/compose/releases/download/v2.32.2/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
|
docker-compose.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| services: postgresql: image: pgvector/pgvector:pg16 container_name: lobe-postgres ports: - '5432:5432' volumes: - './data:/var/lib/postgresql/data' environment: - 'POSTGRES_DB=lobe' - 'POSTGRES_PASSWORD=uWNZugjBqixf8dxC' healthcheck: test: ['CMD-SHELL', 'pg_isready -U postgres'] interval: 5s timeout: 5s retries: 5 restart: always
lobe: image: lobehub/lobe-chat-database container_name: lobe-database ports: - '3210:3210' depends_on: - postgresql env_file: - .env restart: always
volumes: data: driver: local s3_data: driver: local
|
.env
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| # 必填,LobeChat 域名,用于 tRPC 调用 # 请保证此域名在你的 NextAuth 鉴权服务提供商、S3 服务商的 CORS 白名单中 APP_URL=https://lobechat.example.com/
# Postgres 相关,也即 DB 必需的环境变量 # 必填,用于加密敏感信息的密钥,可以使用 openssl rand -base64 32 生成 KEY_VAULTS_SECRET=your_generated_random_key_here # 必填,Postgres 数据库连接字符串,用于连接到数据库 # 格式:postgresql://username:password@host:port/dbname(用户密码在docker compose文件中) #如果Postgres实例为 Docker 容器;且位于同一 docker-compose 文件中,亦可使用容器名作为 host DATABASE_URL=postgresql://postgres:uWNZugjBqixf8dxC@postgresql:5432/postgres
# NEXT_AUTH 相关,也即鉴权服务必需的环境变量 #以auth0为例,也可以使用Azure AD、GitHub、Authentik、Zitadel、Logto 等 NEXT_AUTH_SECRET=another_generated_random_key_here NEXT_AUTH_SSO_PROVIDERS=auth0 AUTH0_CLIENT_ID=your_auth0_client_id AUTH0_CLIENT_SECRET=your_auth0_client_secret AUTH0_ISSUER=https://your_auth0_domain.auth0.com/ NEXTAUTH_URL=https://lobechat.example.com/api/auth # 代理相关,如果需要的话(比如使用 GitHub 作为鉴权服务提供商) # HTTP_PROXY=http://localhost:7890 # HTTPS_PROXY=http://localhost:7890
# S3 相关,也即非结构化数据(文件、图片等)存储必需的环境变量 S3_ACCESS_KEY_ID=your_s3_access_key S3_SECRET_ACCESS_KEY=your_s3_secret_key # 必填,S3 的 Endpoint,用于服务端/客户端连接到 S3 API S3_ENDPOINT=http://minio.example.com:9000 # 必填,S3 的 Bucket S3_BUCKET=lobechat_storage_bucket # 必填,S3 的 Public Domain,用于客户端通过公开连接访问非结构化数据 S3_PUBLIC_DOMAIN=http://minio.example.com:9000/lobechat_storage_bucket # 选填,S3 的 Enable Path Style # 对于主流 S3 Cloud 服务商,一般填 0 即可;对于自部署的 MinIO,请填 1 # 请参考:https://lobehub.com/zh/docs/self-hosting/advanced/s3 S3_ENABLE_PATH_STYLE=1
|
下载 minio
1、wget https://dl.min.io/server/minio/release/linux-amd64/minio
2、
配置好后执行 sudo docker-compose up -d