-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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] 在服务端数据库的方案中,文档需要进一步说明避免用户落到坑里 #3000
Comments
📦 Deployment environmentVercel 📌 Software version1.1.6 💻 System environmentmacOS 🌐 BrowserEdge 🐛 Problem descriptionWhen trying the current server-side database solution, I encountered several pitfalls that were not mentioned in the documentation. You need to explore it yourself (and search related problems of other people from the repo) to solve it.
In short, thank you to the team for this update of the server database, but the documentation still needs some improvement, otherwise various problems will inevitably arise for users like us who are not familiar with the code structure. 📷 Steps to reproduceNo response 🚦 Expected resultsImprove documentation. 📝 Supplementary informationNo response |
Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. |
3.1. 这一点你不完全按照文档指示,自己瞎搞为啥还要赖文档没写清楚… 如果没用,为啥我要把这个变量写上?😅 本身服务端数据库就是一个比较复杂的部署方案。我问过好几个玩 self-hosting 的用户,他们甚至觉得现在的文档写的过于详细了。所以目前应该应该没什么需要再修改的。 如果有用户觉得现在这个文档还是过于简略,出了问题不知道该怎么解决,那我还是推荐用我们 hosting 的版本吧,省心一些🥲 |
The server-side database itself is a relatively complex deployment solution. I have asked several users who are playing with self-hosting, and they even think that the current documentation is too detailed. So there should be nothing that needs to be modified at the moment. If some users feel that the current document is too simple and they don’t know how to solve problems if they arise, then I still recommend using our hosting version to save worry🥲 |
关于第一点。。。懒得再切换了,太折腾。。。
我根本就没有设置 NEXT_PUBLIC_SERVICE_MODE=server 这个变量,部署时实际上就进入了数据库的迁移逻辑。 |
Regarding the first point. . . I'm too lazy to switch again, it's too much trouble. . . Serverless Postgres DB UrlDATABASE_URL= Specify service mode as server, otherwise the server database will not be enteredNEXT_PUBLIC_SERVICE_MODE=server |
可能这一部分是需要补充说明下。刚看了下文档里关于 S3 图片的使用在这里一笔带过了: 在客户端 db 的情况下是都通过 base64 传输的,但是在服务端 db 模式中是直接传图片 url。其实后者才是 OpenAI 最推荐的方案(文档),可以大大降低请求传输的流量开销,响应速度也会更快。只是之前在没有服务端 db 的情况下,只能用 base64 编码。现在有 server db 了,自然走图片 URL 更好。
数据库迁移和应用是两个不同的逻辑。数据库迁移就只依赖 DATABASE_URL 的,而且只在构建时执行,这个逻辑没问题。如果你没配置 NEXT_PUBLIC_SERVICE_MODE ,构建出来的应用就还是 client db 的。 |
Maybe this part needs additional explanation. The use of S3 images in the document is briefly mentioned here: In the case of client db, it is transmitted through base64, but in server db mode, the image url is transmitted directly. In fact, the latter is the most recommended solution by OpenAI (Document), which can greatly reduce the traffic overhead of request transmission and improve the response speed. Faster. It’s just that before there was no server db, base64 encoding could only be used. Now that there is a server db, it is naturally better to use the image URL.
Database migration and application are two different logics. Database migration only relies on DATABASE_URL and is only executed at build time. This logic is no problem. If you do not configure NEXT_PUBLIC_SERVICE_MODE, the built application will still be client db. |
I feel that the current documentation is indeed a bit conflicted. I just upgraded from 0.x operation to 1.x configuration with server persistence last night. Some issues with the documentation:
As for whether ACCESS_CODE is still needed, I don’t know yet. . |
docker部署需要自己修改dockerfile然后build,官方目前的docker镜像由于next环境变量和构建问题不支持db版 |
Docker deployment requires you to modify the dockerfile and then build it. The official current docker image does not support the db version due to next environment variables and build issues. |
Right... For me, it's a bit disappointing but it doesn't matter. I'm not in a hurry, I just use it for myself. But does the document not mention it? Or how to solve this "env variables and build issues"? |
文档开头就说了不支持 Docker ,你是没看到么… |
The document says at the beginning that Docker is not supported. Didn’t you see it? |
Since the author said it, it must be there, but I really don’t know which page said it, my fault. |
我感觉你大概率就是没看这个: https://lobehub.com/zh/docs/self-hosting/advanced/server-database ,直接上手配。这样不出问题才怪 🤦♂️ |
I feel that you most likely haven’t read this: https://lobehub.com/zh/docs/self-hosting/advanced/server-database and start configuring it directly. It would be strange if there is no problem like this 🤦♂️ |
I did look at it, and I did scan it ten lines at a time. . . |
现在你配置 next-auth 是没法正常完成用 db 实现鉴权的,要用也只能用 clerk。然后 @cy948 正在做 next-auth 和db 的集成,到时候我会专门给 serverdb 打一个 docker 镜像,届时应该直接配置就好了。 如果你熟悉 dockerfile 会做 build 的话,那么只需要记住 |
Now that you configure next-auth, you cannot use db to implement authentication normally. If you want to use it, you can only use clerk. Then @cy948 is working on the integration of next-auth and db. When the time comes, I will create a docker image specifically for serverdb, which should be configured directly. If you are familiar with dockerfile and know how to build, then you only need to remember that the environment variables prefixed with |
On an 8C8Gmem VPS, docker build ran for more than 40 minutes and was killed. Alas, even the device could not be found. |
但或许现在你还可以找回你原来的聊天记录,去回档到未启用clerk前的部署,然后导出所有文件,再在新的部署上导入即可 It may be possible to retrieve your original chat history, revert to the deployment prior to the introduction of Clerk, export the files, and then import them to the new deployment. |
@utccnu 自己fork一个版本,关掉typecheck和lintcheck,就像这样: https://github.com/cy948/lobe-chat/blob/5095b9fa5b2939d394b7b71b2f003b3173ced1ec/next.config.mjs#L58-L63 。关掉之后亲测 2C8G 的机器也能完成构建。 |
@utccnu Fork a version yourself and turn off typecheck and lintcheck, like this: https://github.com/cy948/lobe-chat/blob/5095b9fa5b2939d394b7b71b2f003b3173ced1ec/next.config.mjs#L58-L63 |
Even after turning it off, it still failed. . It just took longer to run. This time it took half an hour, but it still failed with exit code 137. I've given up, I'm waiting for you brother! Estimated how long? |
@utccnu 看看日志?返回 code137 的话,应该没有内存溢出了吧? |
@utccnu Look at the log? If code137 is returned, there should be no memory overflow, right? |
@utccnu 我最近也构建不成功,直接 heap out of memory 了 |
@utccnu I also failed to build recently and it directly heap out of memory. |
刚在自己电脑上build成功了,用时6分钟。🫠 |
I just built it successfully on my computer and it took 6 minutes. 🫠 |
I also did it in a few minutes on my m1 pro. . But it doesn't work. It gives an error when running. It still says that SECRET cannot be found, but in fact env has been set. Forget it, give up. . Wait for you! |
@utccnu 不如加入 discord,试试使用 NextAuth 的后端数据库版本。 |
@utccnu Why not join discord and try using the backend database version of NextAuth. |
构建的话也不一定非要用自己的机器吧,用容器镜像服务就行了。 |
You don’t have to use your own machine to build, just use a container image service. |
使用Node Postgres的时候,还需要注意自签名证书的问题 此时如果使用服务方提供的URL的话,就会出现自签名证书问题:
原因在于,node-postgres在解析 早在2年前便已经有人提出了修复pr使行为对齐官方文档,但至今未合并。brianc/node-postgres#2709 太长不看:node-postgres实现跟官方不一致,将URL中的 |
非serverless的postgres实例需要添加环境变量更改driver,参见官方文档(现在访问不了服务端数据库的页面?)
|
This issue is closed, If you have any questions, you can comment and reply. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
📦 部署环境
Vercel
📌 软件版本
1.1.6
💻 系统环境
macOS
🌐 浏览器
Edge
🐛 问题描述
在尝试现在的服务端数据库的方案时,遇到了好几个坑文档里面都没有提及。需要自己摸索(以及从 repo 里搜到相关的其他人的问题)才能解决。
3.1 第一次尝试更改部署时,我只是尝试着加入了 Database_url 的环境变量,尚未配置 NEXT_PUBLIC_SERVICE_MODE=server 这个变量。本想着只是依次先把各种变量准备好后再切换成服务端。结果就导致重新部署后实际上已经变成服务端的机制了,看到后台有数据库 migrate 失败的提示。
3.2 等到我的 S3 等都准备好,进行第二次重新部署,发现都部署好后无法上传图片,上传图片时客户端/浏览器会报错。搜了搜 repo 的 issues 时,发现居然要删除掉原有的 ACCESS_CODE 这个环境变量。。。从字面意义上来看,这个环境变量和这部分功能并无直接关系。 删除环境变量,重新部署,随后一切正常。(不,还有刚才第二点说的权限问题,那个是摸索猜测才搞定)。
总之,感谢团队这次的服务端数据库的更新,但是在文档上还需要一些加强,否则对于像我们不熟悉代码结构的用户来说还是难免会出现各种问题。
📷 复现步骤
No response
🚦 期望结果
完善文档。
📝 补充信息
No response
The text was updated successfully, but these errors were encountered: