Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] docker-compose部署LobeChat 服务端数据库版本provider logto is not supported #3963

Closed
chenchengzi opened this issue Sep 14, 2024 · 42 comments
Labels
🐛 Bug Something isn't working | 缺陷

Comments

@chenchengzi
Copy link

📦 Environment

Docker

📌 Version

latest

💻 Operating System

Other Linux

🌐 Browser

Chrome

🐛 Bug Description

采用docker-compose部署LobeChat 服务端数据库版本,打开主页面xxxx:3210时页面显示500
image

查看日志报错如下
lobe-database |
lobe-database | Error: [NextAuth] provider logto is not supported
lobe-database | at /app/.next/server/src/middleware.js:400:60330
lobe-database | at Array.map ()
lobe-database | at 9353 (/app/.next/server/src/middleware.js:400:60266)
lobe-database | at t (/app/.next/server/edge-runtime-webpack.js:1:143)
lobe-database | at /app/.next/server/src/middleware.js:423:8108
lobe-database | at r (/app/.next/server/edge-runtime-webpack.js:1:1539)
lobe-database | at /app/.next/server/src/middleware.js:1:51
lobe-database | at Script.runInContext (node:vm:148:12)
lobe-database | at runInContext (node:vm:300:6)
lobe-database | at evaluateInContext (/app/node_modules/.pnpm/next@14.2.5_@babel+core@7.23.6_@opentelemetry[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/web/sandbox/context.js:403:38)

相关配置如下
.env

# NextAuth 鉴权服务提供商部分,以 Logto 为例
# 其他鉴权服务提供商所需的环境变量,请参考:https://lobehub.com/zh/docs/self-hosting/environment-variables/auth
LOGTO_CLIENT_ID=pstvtqe4x0yeduik0ndxx
LOGTO_CLIENT_SECRET=gex9RqyLLtzwb7cGdukYmiWI7VnO3cH5
LOGTO_ISSUER=http://82.157.65.83:3001/oidc

docker-compose.yml

logto:
    image: svhd/logto
    container_name: lobe-logto
    ports:
      - '3001:3001'
      - '3002:3002'
    depends_on:
      postgresql:
        condition: service_healthy
    environment:
      - 'TRUST_PROXY_HEADER=1'
      - 'DB_URL=postgresql://postgres:uWNZugjBqixf8dxC@postgresql:5432/logto'
      - 'ENDPOINT=http://82.157.65.83:3001/'
      - 'ADMIN_ENDPOINT=http://82.157.65.83:3002'
    entrypoint: ['sh', '-c', 'npm run cli db seed -- --swe && npm start']

请问这种情况如何解决

📷 Recurrence Steps

No response

🚦 Expected Behavior

No response

📝 Additional Information

No response

@chenchengzi chenchengzi added the 🐛 Bug Something isn't working | 缺陷 label Sep 14, 2024
@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


📦 Environment

Docker

📌 Version

latest

💻 Operating System

Other Linux

🌐 Browser

Chrome

🐛 Bug Description

Use docker-compose to deploy the LobeChat server database version. When you open the main page xxxx:3210, the page displays 500
image

Check the log and the error is as follows
lobe-database |
lobe-database | Error: [NextAuth] provider logto is not supported
lobe-database | at /app/.next/server/src/middleware.js:400:60330
lobe-database | at Array.map ()
lobe-database | at 9353 (/app/.next/server/src/middleware.js:400:60266)
lobe-database | at t (/app/.next/server/edge-runtime-webpack.js:1:143)
lobe-database | at /app/.next/server/src/middleware.js:423:8108
lobe-database | at r (/app/.next/server/edge-runtime-webpack.js:1:1539)
lobe-database | at /app/.next/server/src/middleware.js:1:51
lobe-database | at Script.runInContext (node:vm:148:12)
lobe-database | at runInContext (node:vm:300:6)
lobe-database | at evaluateInContext (/app/node_modules/.pnpm/next@14.2.5_@babel+core@7.23.6_@opentelemetry[email protected][email protected][email protected][email protected] /node_modules/next/dist/server/web/sandbox/context.js:403:38)

The relevant configuration is as follows
.env

# NextAuth authentication service provider part, taking Logto as an example
# For other environment variables required by authentication service providers, please refer to: https://lobehub.com/zh/docs/self-hosting/environment-variables/auth
LOGTO_CLIENT_ID=pstvtqe4x0yeduik0ndxx
LOGTO_CLIENT_SECRET=gex9RqyLLtzwb7cGdukYmiWI7VnO3cH5
LOGTO_ISSUER=http://82.157.65.83:3001/oidc

docker-compose.yml

logto:
    image: svhd/logto
    container_name: lobe-logto
    ports:
      - '3001:3001'
      - '3002:3002'
    depends_on:
      postgresql:
        condition: service_healthy
    environment:
      - 'TRUST_PROXY_HEADER=1'
      - 'DB_URL=postgresql://postgres:uWNZugjBqixf8dxC@postgresql:5432/logto'
      - 'ENDPOINT=http://82.157.65.83:3001/'
      - 'ADMIN_ENDPOINT=http://82.157.65.83:3002'
    entrypoint: ['sh', '-c', 'npm run cli db seed -- --swe && npm start']

How to solve this situation?

📷 Recurrence Steps

No response

🚦 Expected Behavior

No response

📝 Additional Information

No response

@lobehubbot
Copy link
Member

👀 @chenchengzi

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

Copy link

dosubot bot commented Sep 14, 2024

@chenchengzi 你好! 我是 Dosu,我是一个可以帮助解决bug,回答问题,并成为贡献者的机器人。我在这里帮助你,等待人类维护者。

To resolve the error "[NextAuth] provider logto is not supported" when deploying LobeChat using docker-compose, ensure that you have correctly set the environment variables, particularly NEXT_AUTH_SSO_PROVIDERS, to include logto. Here is the relevant configuration:

environment:
  - NEXT_AUTH_SECRET=your_generated_secret
  - NEXT_AUTH_SSO_PROVIDERS=logto
  - LOGTO_CLIENT_ID=your_logto_client_id
  - LOGTO_CLIENT_SECRET=your_logto_client_secret
  - LOGTO_ISSUER=http://82.157.65.83:3001/oidc
  - NEXTAUTH_URL=http://82.157.65.83:3210/api/auth

Make sure that NEXT_AUTH_SSO_PROVIDERS is set to logto as shown above. This should enable the Logto provider for NextAuth in your LobeChat deployment. Additionally, ensure that the APP_URL is correctly set and whitelisted in your NextAuth providers and S3 service CORS settings:

environment:
  - APP_URL=http://82.157.65.83:3210/

This configuration should help resolve the error and enable the Logto provider for authentication in your LobeChat deployment [1][2].

To continue talking to Dosu, mention @dosu.

@chenchengzi
Copy link
Author

.env中已配置

# 必填,LobeChat 域名,用于 tRPC 调用
# 请保证此域名在你的 NextAuth 鉴权服务提供商、S3 服务商的 CORS 白名单中
APP_URL=http://82.157.65.83:3210

# NEXT_AUTH 相关,也即鉴权服务必需的环境变量
NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg
# 必填,指定鉴权服务提供商,这里以 Logto 为例
NEXT_AUTH_SSO_PROVIDERS=logto
NEXTAUTH_URL=http://82.157.65.83:9000/api/auth
LOGTO_CLIENT_ID=pstvtqe4x0yeduik
LOGTO_CLIENT_SECRET=gex9RqyLLtzwb7cGdukYmiW
LOGTO_ISSUER=http://82.157.65.83:3001/oidc

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Configured in .env

# Required, LobeChat domain name, used for tRPC calls
# Please ensure that this domain name is in the CORS whitelist of your NextAuth authentication service provider and S3 service provider
APP_URL=http://82.157.65.83:3210

# NEXT_AUTH related, that is, the environment variable necessary for the authentication service
NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg
# Required, specify the authentication service provider, take Logto as an example here
NEXT_AUTH_SSO_PROVIDERS=logto
NEXTAUTH_URL=http://82.157.65.83:9000/api/auth
LOGTO_CLIENT_ID=pstvtqe4x0yeduik
LOGTO_CLIENT_SECRET=gex9RqyLLtzwb7cGdukYmiW
LOGTO_ISSUER=http://82.157.65.83:3001/oidc

@SpeedupMaster
Copy link
Contributor

.env中已配置

# 必填,LobeChat 域名,用于 tRPC 调用
# 请保证此域名在你的 NextAuth 鉴权服务提供商、S3 服务商的 CORS 白名单中
APP_URL=http://82.157.65.83:3210

# NEXT_AUTH 相关,也即鉴权服务必需的环境变量
NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg
# 必填,指定鉴权服务提供商,这里以 Logto 为例
NEXT_AUTH_SSO_PROVIDERS=logto
NEXTAUTH_URL=http://82.157.65.83:9000/api/auth
LOGTO_CLIENT_ID=pstvtqe4x0yeduik
LOGTO_CLIENT_SECRET=gex9RqyLLtzwb7cGdukYmiW
LOGTO_ISSUER=http://82.157.65.83:3001/oidc

NEXTAUTH_URL=http://82.157.65.83:9000/api/auth
改成
NEXTAUTH_URL=http://82.157.65.83:3210/api/auth

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Configured in .env

# Required, LobeChat domain name, used for tRPC calls
# Please ensure that this domain name is in the CORS whitelist of your NextAuth authentication service provider and S3 service provider
APP_URL=http://82.157.65.83:3210

# NEXT_AUTH related, that is, the environment variable necessary for the authentication service
NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg
# Required, specify the authentication service provider, take Logto as an example here
NEXT_AUTH_SSO_PROVIDERS=logto
NEXTAUTH_URL=http://82.157.65.83:9000/api/auth
LOGTO_CLIENT_ID=pstvtqe4x0yeduik
LOGTO_CLIENT_SECRET=gex9RqyLLtzwb7cGdukYmiW
LOGTO_ISSUER=http://82.157.65.83:3001/oidc

NEXTAUTH_URL=http://82.157.65.83:9000/api/auth
Change to
NEXTAUTH_URL=http://82.157.65.83:3210/api/auth

@chenchengzi
Copy link
Author

.env中已配置

# 必填,LobeChat 域名,用于 tRPC 调用
# 请保证此域名在你的 NextAuth 鉴权服务提供商、S3 服务商的 CORS 白名单中
APP_URL=http://82.157.65.83:3210

# NEXT_AUTH 相关,也即鉴权服务必需的环境变量
NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg
# 必填,指定鉴权服务提供商,这里以 Logto 为例
NEXT_AUTH_SSO_PROVIDERS=logto
NEXTAUTH_URL=http://82.157.65.83:9000/api/auth
LOGTO_CLIENT_ID=pstvtqe4x0yeduik
LOGTO_CLIENT_SECRET=gex9RqyLLtzwb7cGdukYmiW
LOGTO_ISSUER=http://82.157.65.83:3001/oidc

NEXTAUTH_URL=http://82.157.65.83:9000/api/auth 改成 NEXTAUTH_URL=http://82.157.65.83:3210/api/auth

感谢指正,不过修改后出现了新的错误日志如下
image

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Configured in .env

# Required, LobeChat domain name, used for tRPC calls
# Please ensure that this domain name is in the CORS whitelist of your NextAuth authentication service provider and S3 service provider.
APP_URL=http://82.157.65.83:3210

# NEXT_AUTH related, that is, the environment variable necessary for the authentication service
NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg
# Required, specify the authentication service provider, take Logto as an example here
NEXT_AUTH_SSO_PROVIDERS=logto
NEXTAUTH_URL=http://82.157.65.83:9000/api/auth
LOGTO_CLIENT_ID=pstvtqe4x0yeduik
LOGTO_CLIENT_SECRET=gex9RqyLLtzwb7cGdukYmiW
LOGTO_ISSUER=http://82.157.65.83:3001/oidc

NEXTAUTH_URL=http://82.157.65.83:9000/api/auth changed to NEXTAUTH_URL=http://82.157.65.83:3210/api/auth

Thanks for the correction, but after the modification, a new error log appeared as follows:
image

@SpeedupMaster
Copy link
Contributor

看下docker compose和.enn文件里的其他配置有没有问题

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Check if there are any problems with other configurations in docker compose and .enn files.

@chenchengzi
Copy link
Author

看下docker compose和.enn文件里的其他配置有没有问题

详细配置如下
docker-compose.yml

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

  minio:
    image: minio/minio
    container_name: lobe-minio
    ports:
      - '9000:9000'
      - '9001:9001'
    volumes:
      - './s3_data:/etc/minio/data'
    environment:
      - 'MINIO_ROOT_USER=cz'
      - 'MINIO_ROOT_PASSWORD=cz111111'
      - 'MINIO_DOMAIN=http://82.157.65.83:9000'
      - 'MINIO_API_CORS_ALLOW_ORIGIN=http://82.157.65.83:3210' # Your LobeChat's domain name.
    restart: always
    command: >
      server /etc/minio/data --address ":9000" --console-address ":9001"

  logto:
    image: svhd/logto
    container_name: lobe-logto
    ports:
      - '3001:3001'
      - '3002:3002'
    depends_on:
      postgresql:
        condition: service_healthy
    environment:
      - 'TRUST_PROXY_HEADER=1'
      - 'DB_URL=postgresql://postgres:uWNZugjBqixf8dxC@postgresql:5432/logto'
      - 'ENDPOINT=http://82.157.65.83:3001/'
      - 'ADMIN_ENDPOINT=http://82.157.65.83:3002'
    entrypoint: ['sh', '-c', 'npm run cli db seed -- --swe && npm start']

  lobe:
    image: lobehub/lobe-chat-database
    container_name: lobe-database
    ports:
      - '3210:3210'
    depends_on:
      - postgresql
      - minio
      - logto
    env_file:
      - .env
    restart: always

volumes:
  data:
    driver: local
  s3_data:
    driver: local

.env

# 必填,LobeChat 域名,用于 tRPC 调用
# 请保证此域名在你的 NextAuth 鉴权服务提供商、S3 服务商的 CORS 白名单中
APP_URL=http://82.157.65.83:3210

# Postgres 相关,也即 DB 必需的环境变量
KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ=
DATABASE_URL=postgresql://postgres:uWNZugjBqixf8dxC@postgresql:5432/lobe

# NEXT_AUTH 相关,也即鉴权服务必需的环境变量
NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg
NEXT_AUTH_SSO_PROVIDERS=logto
NEXTAUTH_URL=http://82.157.65.83:3210/api/auth

# NextAuth 鉴权服务提供商部分,以 Logto 为例
LOGTO_CLIENT_ID=pstvtqe4x0yeduik0ndxx
LOGTO_CLIENT_SECRET=gex9RqyLLtzwb7cGdukYmiWI7VnO3cH5
LOGTO_ISSUER=http://82.157.65.83:3001/oidc

# 代理相关,如果你需要的话(比如你使用 GitHub 作为鉴权服务提供商)
# HTTP_PROXY=http://localhost:7890
# HTTPS_PROXY=http://localhost:7890

# S3 相关,也即非结构化数据(文件、图片等)存储必需的环境变量
# 这里以 MinIO 为例
S3_ACCESS_KEY_ID=9VXsvLu592YIc3ORCRdA
S3_SECRET_ACCESS_KEY=AzZD7gMCmDqNYGlO3B6L0Dbzbwwg9T65j8FBeYL8
# 必填,S3 的 Endpoint,用于服务端/客户端连接到 S3 API
S3_ENDPOINT=http://82.157.65.83:9000
S3_BUCKET=lobe
S3_PUBLIC_DOMAIN=http://82.157.65.83:9000
S3_ENABLE_PATH_STYLE=1
NEXT_PUBLIC_S3_DOMAIN=http://82.157.65.83:9000
# 其他基础环境变量,视需求而定。注意不要有 ACCESS_CODE
# 请参考:https://lobehub.com/zh/docs/self-hosting/environment-variables/basic
# 请注意,对于服务端版本,其 API 必须支持嵌入(OpenAI text-embedding-3-small)模型,否则无法对上传文件进行处理,但你无需在 OPENAI_MODEL_LIST 中指定此模型
# OPENAI_API_KEY=sk-xxxx
# OPENAI_PROXY_URL=https://api.openai.com/v1
# OPENAI_MODEL_LIST=..

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Check if there are any problems with other configurations in docker compose and .enn files

Detailed configuration is as follows
docker-compose.yml

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

  minio:
    image: minio/minio
    container_name: lobe-minio
    ports:
      - '9000:9000'
      - '9001:9001'
    volumes:
      - './s3_data:/etc/minio/data'
    environment:
      - 'MINIO_ROOT_USER=cz'
      - 'MINIO_ROOT_PASSWORD=cz111111'
      - 'MINIO_DOMAIN=http://82.157.65.83:9000'
      - 'MINIO_API_CORS_ALLOW_ORIGIN=http://82.157.65.83:3210' # Your LobeChat's domain name.
    restart: always
    command: >
      server /etc/minio/data --address ":9000" --console-address ":9001"

  logto:
    image: svhd/logto
    container_name: lobe-logto
    ports:
      - '3001:3001'
      - '3002:3002'
    depends_on:
      postgresql:
        condition: service_healthy
    environment:
      - 'TRUST_PROXY_HEADER=1'
      - 'DB_URL=postgresql://postgres:uWNZugjBqixf8dxC@postgresql:5432/logto'
      - 'ENDPOINT=http://82.157.65.83:3001/'
      - 'ADMIN_ENDPOINT=http://82.157.65.83:3002'
    entrypoint: ['sh', '-c', 'npm run cli db seed -- --swe && npm start']

  lobe:
    image: lobehub/lobe-chat-database
    container_name: lobe-database
    ports:
      - '3210:3210'
    depends_on:
      -postgresql
      - minio
      -logto
    env_file:
      - .env
    restart: always

volumes:
  data:
    driver:local
  s3_data:
    driver: local

.env

# Required, LobeChat domain name, used for tRPC calls
# Please ensure that this domain name is in the CORS whitelist of your NextAuth authentication service provider and S3 service provider
APP_URL=http://82.157.65.83:3210

# Postgres related, that is, DB necessary environment variables
KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ=
DATABASE_URL=postgresql://postgres:uWNZugjBqixf8dxC@postgresql:5432/lobe

# NEXT_AUTH related, that is, the environment variable necessary for the authentication service
NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg
NEXT_AUTH_SSO_PROVIDERS=logto
NEXTAUTH_URL=http://82.157.65.83:3210/api/auth

# NextAuth authentication service provider part, taking Logto as an example
LOGTO_CLIENT_ID=pstvtqe4x0yeduik0ndxx
LOGTO_CLIENT_SECRET=gex9RqyLLtzwb7cGdukYmiWI7VnO3cH5
LOGTO_ISSUER=http://82.157.65.83:3001/oidc

# Proxy related, if you need it (for example, if you use GitHub as the authentication service provider)
# HTTP_PROXY=http://localhost:7890
# HTTPS_PROXY=http://localhost:7890

# S3 related, that is, environment variables necessary for storing unstructured data (files, pictures, etc.)
# Here we take MinIO as an example
S3_ACCESS_KEY_ID=9VXsvLu592YIc3ORCRdA
S3_SECRET_ACCESS_KEY=AzZD7gMCmDqNYGlO3B6L0Dbzbwwg9T65j8FBeYL8
# Required, S3 Endpoint, used for server/client to connect to S3 API
S3_ENDPOINT=http://82.157.65.83:9000
S3_BUCKET=lobe
S3_PUBLIC_DOMAIN=http://82.157.65.83:9000
S3_ENABLE_PATH_STYLE=1
NEXT_PUBLIC_S3_DOMAIN=http://82.157.65.83:9000
# Other basic environment variables, depending on needs. Be careful not to have ACCESS_CODE
# Please refer to: https://lobehub.com/zh/docs/self-hosting/environment-variables/basic
# Please note that for the server version, its API must support the embedding (OpenAI text-embedding-3-small) model, otherwise the uploaded file cannot be processed, but you do not need to specify this model in OPENAI_MODEL_LIST
# OPENAI_API_KEY=sk-xxxx
# OPENAI_PROXY_URL=https://api.openai.com/v1
# OPENAI_MODEL_LIST=..

@SpeedupMaster
Copy link
Contributor

MINIO_ROOT_USER length should be at least 3, and MINIO_ROOT_PASSWORD length at least 8 characters
minio用户名和密码长度太短
NEXT_PUBLIC_S3_DOMAIN=http://82.157.65.83:9000 这个不需要了
其他的没啥问题,不过这两个也不影响lobechat站点的呀
image
这4个都正常运行吗?

@zhangleijun111
Copy link

看下docker compose和.enn文件里的其他配置有没有问题

详细配置如下 docker-compose.yml

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

  minio:
    image: minio/minio
    container_name: lobe-minio
    ports:
      - '9000:9000'
      - '9001:9001'
    volumes:
      - './s3_data:/etc/minio/data'
    environment:
      - 'MINIO_ROOT_USER=cz'
      - 'MINIO_ROOT_PASSWORD=cz111111'
      - 'MINIO_DOMAIN=http://82.157.65.83:9000'
      - 'MINIO_API_CORS_ALLOW_ORIGIN=http://82.157.65.83:3210' # Your LobeChat's domain name.
    restart: always
    command: >
      server /etc/minio/data --address ":9000" --console-address ":9001"

  logto:
    image: svhd/logto
    container_name: lobe-logto
    ports:
      - '3001:3001'
      - '3002:3002'
    depends_on:
      postgresql:
        condition: service_healthy
    environment:
      - 'TRUST_PROXY_HEADER=1'
      - 'DB_URL=postgresql://postgres:uWNZugjBqixf8dxC@postgresql:5432/logto'
      - 'ENDPOINT=http://82.157.65.83:3001/'
      - 'ADMIN_ENDPOINT=http://82.157.65.83:3002'
    entrypoint: ['sh', '-c', 'npm run cli db seed -- --swe && npm start']

  lobe:
    image: lobehub/lobe-chat-database
    container_name: lobe-database
    ports:
      - '3210:3210'
    depends_on:
      - postgresql
      - minio
      - logto
    env_file:
      - .env
    restart: always

volumes:
  data:
    driver: local
  s3_data:
    driver: local

.env

# 必填,LobeChat 域名,用于 tRPC 调用
# 请保证此域名在你的 NextAuth 鉴权服务提供商、S3 服务商的 CORS 白名单中
APP_URL=http://82.157.65.83:3210

# Postgres 相关,也即 DB 必需的环境变量
KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ=
DATABASE_URL=postgresql://postgres:uWNZugjBqixf8dxC@postgresql:5432/lobe

# NEXT_AUTH 相关,也即鉴权服务必需的环境变量
NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg
NEXT_AUTH_SSO_PROVIDERS=logto
NEXTAUTH_URL=http://82.157.65.83:3210/api/auth

# NextAuth 鉴权服务提供商部分,以 Logto 为例
LOGTO_CLIENT_ID=pstvtqe4x0yeduik0ndxx
LOGTO_CLIENT_SECRET=gex9RqyLLtzwb7cGdukYmiWI7VnO3cH5
LOGTO_ISSUER=http://82.157.65.83:3001/oidc

# 代理相关,如果你需要的话(比如你使用 GitHub 作为鉴权服务提供商)
# HTTP_PROXY=http://localhost:7890
# HTTPS_PROXY=http://localhost:7890

# S3 相关,也即非结构化数据(文件、图片等)存储必需的环境变量
# 这里以 MinIO 为例
S3_ACCESS_KEY_ID=9VXsvLu592YIc3ORCRdA
S3_SECRET_ACCESS_KEY=AzZD7gMCmDqNYGlO3B6L0Dbzbwwg9T65j8FBeYL8
# 必填,S3 的 Endpoint,用于服务端/客户端连接到 S3 API
S3_ENDPOINT=http://82.157.65.83:9000
S3_BUCKET=lobe
S3_PUBLIC_DOMAIN=http://82.157.65.83:9000
S3_ENABLE_PATH_STYLE=1
NEXT_PUBLIC_S3_DOMAIN=http://82.157.65.83:9000
# 其他基础环境变量,视需求而定。注意不要有 ACCESS_CODE
# 请参考:https://lobehub.com/zh/docs/self-hosting/environment-variables/basic
# 请注意,对于服务端版本,其 API 必须支持嵌入(OpenAI text-embedding-3-small)模型,否则无法对上传文件进行处理,但你无需在 OPENAI_MODEL_LIST 中指定此模型
# OPENAI_API_KEY=sk-xxxx
# OPENAI_PROXY_URL=https://api.openai.com/v1
# OPENAI_MODEL_LIST=..

你成功了吗,你这样配法是不是nginx都不需要了

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Check if there are any problems with other configurations in docker compose and .enn files.

Detailed configuration is as follows docker-compose.yml

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

minio:
image: minio/minio
container_name: lobe-minio
ports:
- '9000:9000'
- '9001:9001'
volumes:
- './s3_data:/etc/minio/data'
environment:
- 'MINIO_ROOT_USER=cz'
- 'MINIO_ROOT_PASSWORD=cz111111'
- 'MINIO_DOMAIN=http://82.157.65.83:9000'
- 'MINIO_API_CORS_ALLOW_ORIGIN=http://82.157.65.83:3210' # Your LobeChat's domain name.
restart: always
command: >
server /etc/minio/data --address ":9000" --console-address ":9001"

logto:
image: svhd/logto
container_name: lobe-logto
ports:
- '3001:3001'
- '3002:3002'
depends_on:
postgresql:
condition: service_healthy
environment:
- 'TRUST_PROXY_HEADER=1'
- 'DB_URL=postgresql://postgres:uWNZugjBqixf8dxC@postgresql:5432/logto'
- 'ENDPOINT=http://82.157.65.83:3001/'
- 'ADMIN_ENDPOINT=http://82.157.65.83:3002'
entrypoint: ['sh', '-c', 'npm run cli db seed -- --swe && npm start']

lobe:
image: lobehub/lobe-chat-database
container_name: lobe-database
ports:
- '3210:3210'
depends_on:
- postgresql
- minio
-logto
env_file:
- .env
restart: always

volumes:
data:
driver: local
s3_data:
driver: local

.env

# Required, LobeChat domain name, used for tRPC calls
# Please ensure that this domain name is in the CORS whitelist of your NextAuth authentication service provider and S3 service provider
APP_URL=http://82.157.65.83:3210

# Postgres related, that is, DB necessary environment variables
KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ=
DATABASE_URL=postgresql://postgres:uWNZugjBqixf8dxC@postgresql:5432/lobe

# NEXT_AUTH related, that is, the environment variable necessary for the authentication service
NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg
NEXT_AUTH_SSO_PROVIDERS=logto
NEXTAUTH_URL=http://82.157.65.83:3210/api/auth

# NextAuth authentication service provider part, taking Logto as an example
LOGTO_CLIENT_ID=pstvtqe4x0yeduik0ndxx
LOGTO_CLIENT_SECRET=gex9RqyLLtzwb7cGdukYmiWI7VnO3cH5
LOGTO_ISSUER=http://82.157.65.83:3001/oidc

# Proxy related, if you need it (for example, if you use GitHub as the authentication service provider)
# HTTP_PROXY=http://localhost:7890
# HTTPS_PROXY=http://localhost:7890

# S3 related, that is, environment variables necessary for storing unstructured data (files, pictures, etc.)
# Here we take MinIO as an example
S3_ACCESS_KEY_ID=9VXsvLu592YIc3ORCRdA
S3_SECRET_ACCESS_KEY=AzZD7gMCmDqNYGlO3B6L0Dbzbwwg9T65j8FBeYL8
# Required, S3 Endpoint, used for server/client to connect to S3 API
S3_ENDPOINT=http://82.157.65.83:9000
S3_BUCKET=lobe
S3_PUBLIC_DOMAIN=http://82.157.65.83:9000
S3_ENABLE_PATH_STYLE=1
NEXT_PUBLIC_S3_DOMAIN=http://82.157.65.83:9000
# Other basic environment variables, depending on needs. Be careful not to have ACCESS_CODE
# Please refer to: https://lobehub.com/zh/docs/self-hosting/environment-variables/basic
# Please note that for the server version, its API must support the embedded (OpenAI text-embedding-3-small) model, otherwise the uploaded file cannot be processed, but you do not need to specify this model in OPENAI_MODEL_LIST
# OPENAI_API_KEY=sk-xxxx
# OPENAI_PROXY_URL=https://api.openai.com/v1
# OPENAI_MODEL_LIST=..

Have you succeeded? If you configure it this way, nginx doesn’t even need it.

@cy948
Copy link
Contributor

cy948 commented Sep 17, 2024

强制更新下 lobe-chat-database 这个镜像

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Forced update of the lobe-chat-database image

@zhangleijun111
Copy link

zhangleijun111 commented Sep 17, 2024 via email

@chenchengzi
Copy link
Author

MINIO_ROOT_USER length should be at least 3, and MINIO_ROOT_PASSWORD length at least 8 characters minio用户名和密码长度太短 NEXT_PUBLIC_S3_DOMAIN=http://82.157.65.83:9000 这个不需要了 其他的没啥问题,不过这两个也不影响lobechat站点的呀 image 这4个都正常运行吗?

其他未发现报错,不配置NEXT_PUBLIC_S3_DOMAIN=http://82.157.65.83:9000的话会报下面这个错误,不清楚什么原因,docker-compose拉取的都是最新版镜像
image

@yaleh
Copy link

yaleh commented Sep 18, 2024

Same issue here. +1

@cy948
Copy link
Contributor

cy948 commented Sep 18, 2024

@zhangleijun111 看一下你的 docker 镜像的 hash ,tag 在 https://hub.docker.com/r/lobehub/lobe-chat-database/tags

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@zhangleijun111 Take a look at the hash of your docker image. The tag is at https://hub.docker.com/r/lobehub/lobe-chat-database/tags

@yaleh
Copy link

yaleh commented Sep 18, 2024

Mine: sha256:e495a07763f8120081ee010f30be290aeec7c8c15eb0ecad7344b9941abe7493 . Which is different from the one at Docker Hub.

I pulled it no more than 24 hours ago. I'll pull it again.

@SpeedupMaster
Copy link
Contributor

SpeedupMaster commented Sep 18, 2024

NEXT_PUBLIC_S3_DOMAIN=http://82.157.65.83:9000

NEXT_PUBLIC_S3_DOMAIN这个现在改成S3_PUBLIC_DOMAIN了,应该是不再需要了。
你把lobechat的镜像改成lobehub/lobe-chat-database:v1.17.7重新拉取试试。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


NEXT_PUBLIC_S3_DOMAIN=http://82.157.65.83:9000

NEXT_PUBLIC_S3_DOMAIN has now been changed to S3_PUBLIC_DOMAIN, which should no longer be needed.
You can change the image of lobechat to lobehub/lobe-chat:v1.17.7 and try to pull it again.

@zhangleijun111
Copy link

NEXT_PUBLIC_S3_DOMAIN=http://82.157.65.83:9000

NEXT_PUBLIC_S3_DOMAIN这个现在改成S3_PUBLIC_DOMAIN了,应该是不再需要了。 你把lobechat的镜像改成lobehub/lobe-chat-database:v1.17.7重新拉取试试。

我用ip地址部署现在点击登录的时候报这个问题
2c2f6209a75451bfeb978cc051faaf2

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


NEXT_PUBLIC_S3_DOMAIN=http://82.157.65.83:9000

NEXT_PUBLIC_S3_DOMAIN is now changed to S3_PUBLIC_DOMAIN, which should no longer be needed. Change the lobechat image to lobehub/lobe-chat-database: v1.17.7 and try to pull it again.

I used the IP address to deploy and now when I click to log in, I get this problem
2c2f6209a75451bfeb978cc051faaf2

@zhangleijun111
Copy link

NEXT_PUBLIC_S3_DOMAIN=http://82.157.65.83:9000

NEXT_PUBLIC_S3_DOMAIN这个现在改成S3_PUBLIC_DOMAIN了,应该是不再需要了。 你把lobechat的镜像改成lobehub/lobe-chat-database:v1.17.7重新拉取试试。

我用了谷歌绕过

NEXT_PUBLIC_S3_DOMAIN=http://82.157.65.83:9000

NEXT_PUBLIC_S3_DOMAIN这个现在改成S3_PUBLIC_DOMAIN了,应该是不再需要了。 你把lobechat的镜像改成lobehub/lobe-chat-database:v1.17.7重新拉取试试。

我用了谷歌烧过https的那个设置,这是我报错的日志
LOGTO_CLIENT_ID will be removed in the future. Please set AUTH_LOGTO_ID instead.
LOGTO_CLIENT_SECRET will be removed in the future. Please set AUTH_LOGTO_SECRET instead.
LOGTO_ISSUER will be removed in the future. Please set AUTH_LOGTO_ISSUER instead.
LOGTO_CLIENT_ID will be removed in the future. Please set AUTH_LOGTO_ID instead.
LOGTO_CLIENT_SECRET will be removed in the future. Please set AUTH_LOGTO_SECRET instead.
LOGTO_ISSUER will be removed in the future. Please set AUTH_LOGTO_ISSUER instead.
\u26a0\ufe0f NEXT_PUBLIC_S3_DOMAIN will be de deprecated in the next major version, please replace it with S3_PUBLIC_DOMAIN in your env
LOGTO_CLIENT_ID will be removed in the future. Please set AUTH_LOGTO_ID instead.
LOGTO_CLIENT_SECRET will be removed in the future. Please set AUTH_LOGTO_SECRET instead.
LOGTO_ISSUER will be removed in the future. Please set AUTH_LOGTO_ISSUER instead.
\u26a0\ufe0f NEXT_PUBLIC_S3_DOMAIN will be de deprecated in the next major version, please replace it with S3_PUBLIC_DOMAIN in your env
[auth][error] TypeError: fetch failed
at node:internal/deps/undici/undici:13178:13
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ib (/app/.next/server/chunks/56239.js:368:43941)
at async iv (/app/.next/server/chunks/56239.js:368:46576)
at async ix (/app/.next/server/chunks/56239.js:368:49215)
at async iU (/app/.next/server/chunks/56239.js:368:53430)
at async /app/node_modules/.pnpm/next@14.2.8_@babel[email protected]_supports-color@8.1.1__@opentelemetry[email protected][email protected].itjmu72s7n7tov6po6nkhcdpya/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:36932
at async eC.execute (/app/node_modules/.pnpm/[email protected]
@babel[email protected]_supports-color@8.1.1__@opentelemetry[email protected][email protected].itjmu72s7n7tov6po6nkhcdpya/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:27548)
at async eC.handle (/app/node_modules/.pnpm/[email protected]
@babel[email protected]_supports-color@8.1.1__@opentelemetry[email protected][email protected].itjmu72s7n7tov6po6nkhcdpya/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:38186)
at async doRender (/app/node_modules/.pnpm/[email protected]
@babel[email protected]_supports-color@8.1.1__@opentelemetry[email protected][email protected]._itjmu72s7n7tov6po6nkhcdpya/node_modules/next/dist/server/base-server.js:1359:42)
[NextAuth] Error: {
cause: 'Configuration',
message: 'Wrong configuration, make sure you have the correct environment variables set. Visit https://lobehub.com/docs/self-hosting/advanced/authentication for more details.',
name: 'NextAuth Error'
}

@cy948
Copy link
Contributor

cy948 commented Sep 18, 2024

fetch failed 是网络问题,服务器可能与auth endpoint不互通

@zhangleijun111
Copy link

fetch failed 是网络问题,服务器可能与auth endpoint不互通

您回答的是我这个问题嘛,另外和logto有关的配置全部使用http而不是https是吧

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


fetch failed is a network problem. The server may not be able to communicate with the auth endpoint.

You are answering my question. In addition, all configurations related to logto use http instead of https, right?

@zhangleijun111
Copy link

fetch failed 是网络问题,服务器可能与auth endpoint不互通

我现在点击登录报这个错误
{"code":"oidc.invalid_redirect_uri","message":"无效返回链接, 该 redirect_uri 未被此应用注册。","error":"invalid_redirect_uri","error_description":"redirect_uri did not match any of the client's registered redirect_uris","state":"eyJyYW5kb20iOiJxOFhndnRmc3ZCSEM0QlpvTGtqZGd6ODJCbnl6UldOVE9uTjNPRnczaUd3In0","iss":"http://172.20.8.120:3001/oidc"}

@cy948
Copy link
Contributor

cy948 commented Sep 18, 2024

先用 AUTH_URL ,另外 logto 只支持https。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Use AUTH_URL first, and logto only supports https.

@zhangleijun111
Copy link

NEXT_PUBLIC_S3_DOMAIN

我知道不是说--ignore加谷歌浏览器绕过他嘛,我现在logto倒是登陆配置好了,但是进lobechat点登陆不行了,这是啥问题呀???

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


NEXT_PUBLIC_S3_DOMAIN

I know it's not about using --ignore and adding Google Chrome to bypass it. Now I have logged in and configured logto, but I can't log in at lobechat. What's the problem? ? ?

@zhangleijun111
Copy link

先用 AUTH_URL ,另外 logto 只支持https。


14b876f3ef415939c90bcb919fd96eb
这里要改伐

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Use AUTH_URL first, and logto only supports https.


14b876f3ef415939c90bcb919fd96eb
This needs to be changed

@arvinxx
Copy link
Contributor

arvinxx commented Oct 13, 2024

新版文档已上线,推荐使用 Casdoor。 https://lobehub.com/zh/docs/self-hosting/server-database/docker-compose

@arvinxx arvinxx closed this as completed Oct 13, 2024
@lobehubbot
Copy link
Member

@chenchengzi

This issue is closed, If you have any questions, you can comment and reply.
此问题已经关闭。如果您有任何问题,可以留言并回复。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


A new version of the documentation is now online, and it is recommended to use Casdoor. https://lobehub.com/en/docs/self-hosting/server-database/docker-compose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working | 缺陷
Projects
Archived in project
Development

No branches or pull requests

7 participants