-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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
Server DB Docker Image Feedback | 服务端 Database Docker 镜像问题反馈 #3391
Comments
First of all, I am very grateful to @cy948 for his efforts in completing the integration of Next Auth and LobeChat’s existing Database system, allowing us to build LobeChat’s server image. The docker image of the server database is now officially available. The image name is The deployment guide is here: https://lobehub.com/docs/self-hosting/server-database
# DB required
KEY_VAULTS_SECRET=jgwsK28dspyVQoIf8/M3IIHl1h6LYYceSYNXeLpy6uk=
DATABASE_URL=postgres://postgres:mysecretpassword@my-postgres:5432/postgres
# NEXT_AUTH related
NEXT_AUTH_SECRET=3904039cd41ea1bdf6c93db0db96e250
NEXT_AUTH_SSO_PROVIDERS=auth0
NEXTAUTH_URL=https://your-prod-domain.com/api/auth
AUTH0_CLIENT_ID=xxxxxx
AUTH0_CLIENT_SECRET=cSX_xxxxx
AUTH0_ISSUER=https://lobe-chat-demo.us.auth0.com
# S3 related
S3_ACCESS_KEY_ID=xxxxxxxxxx
S3_SECRET_ACCESS_KEY=xxxxxxxxxx
S3_ENDPOINT=https://xxxxxxxxxx.r2.cloudflarestorage.com
S3_BUCKET=lobechat
NEXT_PUBLIC_S3_DOMAIN=https://s3-for-lobechat.your-domain.com
docker run -it -d -p 3210:3210 --network pg --env-file lobe-chat.env --name lobe-chat-database lobehub/lobe-chat-database |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
@sqkkyzx 欢迎将其提交为文档,帮助更多 LobeChat 用户 |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
I saw that the document has been updated Using server-side database deployment, which mentions the two variables NEXT_PUBLIC_SERVICE_MODE and DATABASE_DRIVER. |
@darkelfzdy 需要,你得设置为:
但我不太建议使用 vercel + node PG 的模式,大概率会存在通信延迟的问题,导致响应比较慢。如果在同一处的话,可以做到百毫秒的响应,但如果分开来的话,估计得到秒级了 |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Indeed, I am also a little worried. If it is Vercel + Serverless Postgres model, Vercel's Postgres free time seems to be only 60 hours a month, which is obviously not enough. The best way seems to be Docker image + Node Postgres, all local |
This comment was marked as resolved.
This comment was marked as resolved.
@darkelfzdy Serverless PG instance, it is recommended to use neon, this combination is better |
This comment was marked as resolved.
This comment was marked as resolved.
之前一直使用 Dockerfile 构建的镜像,传入了clark参数用于登录。今天保留原有构建环境变量(clark / s3 / db),尝试使用 Dockerfile.database 构建镜像,发现起不了。bash进入镜像后, 也看了上面自己建表的问题,我这个是早期通过 db:push 建立的。 麻烦帮忙看一下是否需要重新建立数据库,另外 Dockerfile.database 镜像是否还兼容构建时传入clark参数用于登录。 |
@morningtzh 可以看下这段迁移 sql ,https://github.com/lobehub/lobe-chat/blob/main/src/database/server/migrations/0001_add_client_id.sql 这里的步骤是都会执行一遍的,如果你是用的db:push ,那么数据库里已经有 解决方案有两种:
理论上应该是还支持的。你可以试下。 |
@morningtzh You can take a look at this migration sql, https://github.com/lobehub/lobe-chat/blob/main/src/database/server/migrations/0001_add_client_id.sql The steps here are all executed once. If you use db:push, then there is already There are two solutions:
Theoretically it should be supported. You can try it. |
谢谢 确实可以,我把0001和0002都注释掉了,运行时环境变量补全S3和DB的就能使用,auth0并不是强制依赖的,clerk也能结合新的 Dockerfile.database 镜像运行。 使用手机登录(电脑也在线),切换助手后端会报错 session not found,偶尔前端会报一下,但不影响使用。接下来持续观察一下~
|
@morningtzh 手机端的 session 的问题应该在 #3428 这里会修复 |
好的 👌,原来是已知问题。 |
Ok 👌, it turns out to be a known issue. |
@arvinxx 抱歉是我没表达清楚,我并没有建表只是新建了数据库;数据库镜像和文件我删了重装很多次都是报错 error: relation "nextauth_accounts" does not exist;想问一下自动建表的过程是在什么时候,能否多打印一些日志方便排查问题,现在启动日志里没有日志。URL: 链接没看出啥问题
pg镜像的日志
|
参考下这篇:https://alwq.xyz/post/2024-08-07-lobechat-database-deploy/
|
Refer to this article: https://alwq.xyz/post/2024-08-07-lobechat-database-deploy/ |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
服务器版本不支持 clerk,在 |
@CHENXCHEN database 官方 docker 镜像不支持 clerk,请使用 auth0。如果要使用 clerk,请采用以下两种方式:
|
@CHENXCHEN database official docker image does not support clerk, please use auth0. If you want to use clerk, please use the following two methods:
|
请问你这个解决了吗,我是直接本地建了一个数据库,没有用docker之类的,连接上去也不会自动建表啥的,在auth.ts设置好了adapter 就报错: |
ACCESS_CODE 没有任何作用, 这是预期的结果吗
登录后不需要 |
ACCESS_CODE has no effect, is this the expected result?
It can take effect without |
嗯这段是教程里面的是否删除就好了?
发自我的iPhone
…------------------ 原始邮件 ------------------
发件人: Rory ***@***.***>
发送时间: 2024年8月22日 12:07
收件人: lobehub/lobe-chat ***@***.***>
抄送: zhangleijun111 ***@***.***>, Comment ***@***.***>
主题: Re: [lobehub/lobe-chat] Server DB Docker Image Feedback | 服务端 Database Docker 镜像问题反馈 (Issue #3391)
ACCESS_CODE 没有任何作用, 这是预期的结果吗
lobe-chat.env:
KEY_VAULTS_SECRET=***** ***@***.***:***/postgres # NEXT_AUTH related NEXT_AUTH_SECRET=1ea8*****************09a NEXT_AUTH_SSO_PROVIDERS=github GITHUB_CLIENT_ID=Iv***********l GITHUB_CLIENT_SECRET=6********************c ACCESS_CODE=m********** NEXTAUTH_URL=https://lobe.****.com/api/auth
登录后不需要 ACCESS_CODE 也可以生效
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
|
用 DB 的话就不应该再用密码了,都按用户实例做隔离了。 |
经过三周左右的反馈,lobechat-database 的大部分自部署问题已经解决,此贴完结。如果有其余自部署问题,请继续在 #3527 下反馈。 |
✅ @arvinxx This issue is closed, If you have any questions, you can comment and reply. |
After about three weeks of feedback, most of the self-deployment issues of lobechat-database have been resolved, and this post is complete. If you have any other self-deployment issues, please continue to report them under #3527. |
首先非常感谢 @cy948 的努力,完成了 Next Auth 和 LobeChat 现有 Database 系统的集成,使得我们可以构建起 LobeChat 的服务端数据库的 Docker 镜像。
服务端数据库的 docker 镜像已正式可用,镜像名为
lobehub/lobe-chat-database
。关于服务端数据库的部署文档,详见: https://lobehub.com/docs/self-hosting/server-database
在此也列出一个简版的部署指南,供大家参考。如有其他问题,欢迎在下方留言。
lobe-chat.env
文件用于存放环境变量:注意事项:确保数据库和 LobeChat DB 镜像在同一网络中
The text was updated successfully, but these errors were encountered: