lobe-chat icon indicating copy to clipboard operation
lobe-chat copied to clipboard

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

Open chenchengzi opened this issue 1 year ago • 39 comments

📦 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/[email protected]_@[email protected]_@[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 avatar Sep 14 '24 03:09 chenchengzi

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/[email protected]_@[email protected]_@[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 avatar Sep 14 '24 03:09 lobehubbot

👀 @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。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

lobehubbot avatar Sep 14 '24 03:09 lobehubbot

@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.

dosubot[bot] avatar Sep 14 '24 03:09 dosubot[bot]

.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

chenchengzi avatar Sep 14 '24 03:09 chenchengzi

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

lobehubbot avatar Sep 14 '24 03:09 lobehubbot

.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

SpeedupMaster avatar Sep 14 '24 04:09 SpeedupMaster

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

lobehubbot avatar Sep 14 '24 04:09 lobehubbot

.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

chenchengzi avatar Sep 14 '24 05:09 chenchengzi

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

lobehubbot avatar Sep 14 '24 05:09 lobehubbot

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

SpeedupMaster avatar Sep 14 '24 08:09 SpeedupMaster

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.

lobehubbot avatar Sep 14 '24 08:09 lobehubbot

看下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=..

chenchengzi avatar Sep 14 '24 11:09 chenchengzi

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=..

lobehubbot avatar Sep 14 '24 11:09 lobehubbot

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个都正常运行吗?

SpeedupMaster avatar Sep 14 '24 17:09 SpeedupMaster

看下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都不需要了

zhangleijun111 avatar Sep 16 '24 05:09 zhangleijun111

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.

lobehubbot avatar Sep 16 '24 05:09 lobehubbot

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

cy948 avatar Sep 17 '24 03:09 cy948

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


Forced update of the lobe-chat-database image

lobehubbot avatar Sep 17 '24 03:09 lobehubbot

我是最新的兄弟

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: Yao Cai @.> 发送时间: 2024年9月17日 11:34 收件人: lobehub/lobe-chat @.> 抄送: zhangleijun111 @.>, Comment @.> 主题: Re: [lobehub/lobe-chat] [Bug] docker-compose部署LobeChat 服务端数据库版本provider logto is not supported (Issue #3963)

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

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

zhangleijun111 avatar Sep 17 '24 07:09 zhangleijun111

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

chenchengzi avatar Sep 18 '24 01:09 chenchengzi

Same issue here. +1

yaleh avatar Sep 18 '24 03:09 yaleh

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

cy948 avatar Sep 18 '24 03:09 cy948

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

lobehubbot avatar Sep 18 '24 03:09 lobehubbot

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.

yaleh avatar Sep 18 '24 03:09 yaleh

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重新拉取试试。

SpeedupMaster avatar Sep 18 '24 03:09 SpeedupMaster

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.

lobehubbot avatar Sep 18 '24 03:09 lobehubbot

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

zhangleijun111 avatar Sep 18 '24 07:09 zhangleijun111

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

lobehubbot avatar Sep 18 '24 07:09 lobehubbot

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/[email protected]_@[email protected][email protected]__@[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]@[email protected][email protected]__@[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]@[email protected][email protected]__@[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]@[email protected][email protected]__@[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' }

zhangleijun111 avatar Sep 18 '24 07:09 zhangleijun111

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

cy948 avatar Sep 18 '24 07:09 cy948