lobehub / lobe-chat

🤯 Lobe Chat - an open-source, modern-design AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Azure / DeepSeek), Knowledge Base (file upload / knowledge management / RAG ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT/ Claude application.
https://chat-preview.lobehub.com
Other
44.47k stars 9.98k forks source link

[Bug] 在使用docker在服务器上进阶部署服务时,点击database,跳出弹窗,请进行登录。 #4601

Closed BravoDD44 closed 1 week ago

BravoDD44 commented 1 week ago

📦 部署环境

Docker

📌 软件版本

知识库版本

💻 系统环境

Other Linux

🌐 浏览器

Edge

🐛 问题描述

20241104-200217

image

在官方文档中,进行使用 Docker 部署服务端数据库版后。https://lobehub.com/zh/docs/self-hosting/server-database/docker 在浏览器端打开ip:3210后,点击知识库按钮,弹出未登录,页面报错。

📷 复现步骤

在官方文档中,进行使用 Docker 部署服务端数据库版后。https://lobehub.com/zh/docs/self-hosting/server-database/docker 在浏览器端打开ip:3210后,点击知识库按钮,弹出未登录,页面报错。 环境变量如下:

网站域名

APP_URL=http://xxxxx:3210

DB 必须的环境变量

用于加密敏感信息的密钥,可以使用 openssl rand -base64 32 生成

KEY_VAULTS_SECRET='xxxxx'

Postgres 数据库连接字符串

格式:postgres://username:password@host:port/dbname,如果你的 pg 实例为 Docker 容器,请使用容器名

DATABASE_URL=postgres://postgres:mysecretpassword@postgres:5432/postgres

NEXT_AUTH 相关,可以使用 auth0、Azure AD、GitHub、Authentik、zitadel 等,如有其他接入诉求欢迎提 PR

NEXT_AUTH_SECRET='xxxx' NEXT_AUTH_SSO_PROVIDERS=auth0 NEXTAUTH_URL=http://8.153.105.15:3210/api/auth AUTH_AUTH0_ID=xxx AUTH_AUTH0_SECRET=xxxx AUTH_AUTH0_ISSUER=dev-bkdrqeyrpygny8qc.us.auth0.com

S3 相关

S3_ACCESS_KEY_ID=xxxx S3_SECRET_ACCESS_KEY=xxxxx

用于 S3 API 访问的域名

S3_ENDPOINT=xxxx S3_BUCKET=xxx S3_REGION=xxxxx # 如果需要指定地域 S3_PUBLIC_DOMAIN=xxxx

OPENAI_API_KEY='xxxx' OPENAI_PROXY_URL=xxxx

PROXY_URL=http://127.0.0.1:18081

🚦 期望结果

期望可以正常登录,并实现知识库新功能

📝 补充信息

No response

lobehubbot commented 1 week ago

👀 @BravoDD44

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 commented 1 week ago

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


📦 Deployment environment

Docker

📌 Software version

Knowledge base version

💻 System environment

Other Linux

🌐 Browser

Edge

🐛 Problem description

20241104-200217

image

In the official documentation, after using Docker to deploy the server database version. https://lobehub.com/zh/docs/self-hosting/server-database/docker After opening ip:3210 on the browser, click the knowledge base button, and a page of not logged in and an error will pop up.

📷 Steps to reproduce

In the official documentation, after using Docker to deploy the server database version. https://lobehub.com/zh/docs/self-hosting/server-database/docker After opening ip:3210 on the browser, click the knowledge base button, and a not logged in page will pop up with an error. The environment variables are as follows:

Website domain name

APP_URL=http://xxxxx:3210

DB required environment variables

The key used to encrypt sensitive information can be generated using openssl rand -base64 32

KEY_VAULTS_SECRET='xxxxx'

Postgres database connection string

Format: postgres://username:password@host:port/dbname, if your pg instance is a Docker container, please use the container name

DATABASE_URL=postgres://postgres:mysecretpassword@postgres:5432/postgres

NEXT_AUTH related, you can use auth0, Azure AD, GitHub, Authentik, zitadel, etc. If you have other access requirements, please submit a PR.

NEXT_AUTH_SECRET='xxxx' NEXT_AUTH_SSO_PROVIDERS=auth0 NEXTAUTH_URL=http://8.153.105.15:3210/api/auth AUTH_AUTH0_ID=pM6nFvpSZ1wkEd2JHY43t3K0KAHGC2Fp AUTH_AUTH0_SECRET=Z36_gxIBjjTO11LcXnGgTgSzje8puG_p6ou641lJ82wnkGjRmtLtySmj8gs0ZIiS AUTH_AUTH0_ISSUER=dev-bkdrqeyrpygny8qc.us.auth0.com

S3 related

S3_ACCESS_KEY_ID=xxxx S3_SECRET_ACCESS_KEY=xxxxx

Domain name used for S3 API access

S3_ENDPOINT=xxxx S3_BUCKET=xxx S3_REGION=xxxxx # If you need to specify the region S3_PUBLIC_DOMAIN=xxxx

OPENAI_API_KEY='xxxx' OPENAI_PROXY_URL=xxxx

PROXY_URL=http://127.0.0.1:18081

🚦 Expected results

It is expected that you can log in normally and implement new functions of the knowledge base

📝 Supplementary information

No response

dosubot[bot] commented 1 week ago

Hello, @BravoDD44! I'm here to help you with any bugs, questions, or contributions you may have. Let's tackle this issue together!

The login error you're experiencing when accessing the knowledge base after deploying the server database version using Docker is likely due to the authentication setup. Here are some relevant discussions and solutions:

  1. Authentication Service Limitation: The official documentation notes that you cannot use Clerk as an authentication service when deploying LobeChat using Docker or Docker Compose due to the inability to expose NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY using Docker environment variables. If you're using Clerk, consider switching to another authentication provider or deployment method, such as Vercel, or building your own Docker image [1].

  2. Alternative Authentication Setup: The documentation suggests using Casdoor as a local authentication service when deploying with Docker Compose. Ensure that Casdoor is configured correctly according to the instructions provided in the documentation [1].

  3. Similar Issues: There are similar discussions about login issues and Docker deployments:

    • A closed issue where using the localhost version of Docker Compose resulted in login errors. The solution involved using specific configuration files for Docker Compose [2].
    • An unsolved discussion about redirect/unknown-session errors when using Docker Compose for LobeChat [3].

Make sure your environment variables and authentication settings are correctly configured. If you're using Auth0, verify that the callback URLs and other settings are correctly set up in your Auth0 dashboard.

To continue talking to Dosu, mention @dosu.

BravoDD44 commented 1 week ago

我使用的auth0验证方法。设置的Allowed Callback URLs是http(s)://(ip 地址):3210/api/auth/callback/auth0

lobehubbot commented 1 week ago

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


I am using auth0 authentication method. The set Allowed Callback URLs are http(s)://(ip address):3210/api/auth/callback/auth0

SpeedupMaster commented 1 week ago

AUTH_AUTH0_ISSUER=https://dev-bkdrqeyrpygny8qc.us.auth0.com加上https试试 PROXY_URL=http://127.0.0.1:18081/这个应该不用设置吧

lobehubbot commented 1 week ago

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


AUTH_AUTH0_ISSUER=https://dev-bkdrqeyrpygny8qc.us.auth0.com Try adding https PROXY_URL=http://127.0.0.1:18081/ There should be no need to set this.

BravoDD44 commented 1 week ago

加上https后依旧会报错。 页面报错

image

跳转如下页面

image

最新的环境变量配置如下

网站域名

APP_URL=http://xxxx:3210

DB 必须的环境变量

用于加密敏感信息的密钥,可以使用 openssl rand -base64 32 生成

KEY_VAULTS_SECRET=w/CwFP1d0u4cdM/fjqFzqIz30aw+Omfd2PErVpYrbn0=

Postgres 数据库连接字符串

格式:postgres://username:password@host:port/dbname,如果你的 pg 实例为 Docker 容器,请使用容器名

DATABASE_URL=postgres://postgres:mysecretpassword@postgres:5432/postgres

NEXT_AUTH 相关,可以使用 auth0、Azure AD、GitHub、Authentik、zitadel 等,如有其他接入诉求欢迎提 PR

NEXT_AUTH_SECRET=QV5yLLYWaYiH/ZheWIMfGTRe74j+LiVyHybLYF/3v+0= NEXT_AUTH_SSO_PROVIDERS=auth0 NEXTAUTH_URL=http://8.153.105.15:3210/api/auth AUTH_AUTH0_ID=xxxxx AUTH_AUTH0_SECRET=xxxx AUTH_AUTH0_ISSUER=https://dev-bkdrqeyrpygny8qc.us.auth0.com

S3 相关

S3_ACCESS_KEY_ID=xxx S3_SECRET_ACCESS_KEY=xxx

用于 S3 API 访问的域名

S3_ENDPOINT=https://oss-cn-shanghai.aliyuncs.com S3_BUCKET=lobe-file S3_REGION=cn-shanghai # 如果需要指定地域 S3_PUBLIC_DOMAIN=https://lobe-file.oss-cn-shanghai.aliyuncs.com

OPENAI_API_KEY=xxxx OPENAI_PROXY_URL=xxxx

lobehubbot commented 1 week ago

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


After adding https, the error will still be reported. Page error

image

Jump to the following page

image

The latest environment variable configuration is as follows

Website domain name

APP_URL=http://xxxx:3210

DB required environment variables

The key used to encrypt sensitive information can be generated using openssl rand -base64 32

KEY_VAULTS_SECRET=w/CwFP1d0u4cdM/fjqFzqIz30aw+Omfd2PErVpYrbn0=

Postgres database connection string

Format: postgres://username:password@host:port/dbname, if your pg instance is a Docker container, please use the container name

DATABASE_URL=postgres://postgres:mysecretpassword@postgres:5432/postgres

NEXT_AUTH related, you can use auth0, Azure AD, GitHub, Authentik, zitadel, etc. If you have other access requirements, please submit a PR.

NEXT_AUTH_SECRET=QV5yLLYWaYiH/ZheWIMfGTRe74j+LiVyHybLYF/3v+0= NEXT_AUTH_SSO_PROVIDERS=auth0 NEXTAUTH_URL=http://8.153.105.15:3210/api/auth AUTH_AUTH0_ID=xxxxx AUTH_AUTH0_SECRET=xxxx AUTH_AUTH0_ISSUER=https://dev-bkdrqeyrpygny8qc.us.auth0.com

S3 related

S3_ACCESS_KEY_ID=xxx S3_SECRET_ACCESS_KEY=xxx

Domain name used for S3 API access

S3_ENDPOINT=https://oss-cn-shanghai.aliyuncs.com S3_BUCKET=lobe-file S3_REGION=cn-shanghai # If you need to specify the region S3_PUBLIC_DOMAIN=https://lobe-file.oss-cn-shanghai.aliyuncs.com

OPENAI_API_KEY=xxxx OPENAI_PROXY_URL=xxxx

SpeedupMaster commented 1 week ago

加上https后依旧会报错。 页面报错 image 跳转如下页面 image

最新的环境变量配置如下

网站域名

APP_URL=http://xxxx:3210

DB 必须的环境变量

用于加密敏感信息的密钥,可以使用 openssl rand -base64 32 生成

KEY_VAULTS_SECRET=w/CwFP1d0u4cdM/fjqFzqIz30aw+Omfd2PErVpYrbn0=

Postgres 数据库连接字符串

格式:postgres://username:password@host:port/dbname,如果你的 pg 实例为 Docker 容器,请使用容器名

DATABASE_URL=postgres://postgres:mysecretpassword@postgres:5432/postgres

NEXT_AUTH 相关,可以使用 auth0、Azure AD、GitHub、Authentik、zitadel 等,如有其他接入诉求欢迎提 PR

NEXT_AUTH_SECRET=QV5yLLYWaYiH/ZheWIMfGTRe74j+LiVyHybLYF/3v+0= NEXT_AUTH_SSO_PROVIDERS=auth0 NEXTAUTH_URL=http://8.153.105.15:3210/api/auth AUTH_AUTH0_ID=xxxxx AUTH_AUTH0_SECRET=xxxx AUTH_AUTH0_ISSUER=https://dev-bkdrqeyrpygny8qc.us.auth0.com

S3 相关

S3_ACCESS_KEY_ID=xxx S3_SECRET_ACCESS_KEY=xxx

用于 S3 API 访问的域名

S3_ENDPOINT=https://oss-cn-shanghai.aliyuncs.com S3_BUCKET=lobe-file S3_REGION=cn-shanghai # 如果需要指定地域 S3_PUBLIC_DOMAIN=https://lobe-file.oss-cn-shanghai.aliyuncs.com

OPENAI_API_KEY=xxxx OPENAI_PROXY_URL=xxxx

页面报错显示callback url有问题

SpeedupMaster commented 1 week ago

http://xxxx:3210/api/auth/callback/auth0 callback url 填的是这个吗?

lobehubbot commented 1 week ago

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


http://xxxx:3210/api/auth/callback/auth0 Is this the callback url you filled in?