uv icon indicating copy to clipboard operation
uv copied to clipboard

:construction_worker: build: Add demo application

Open Kludex opened this issue 1 year ago • 19 comments

💻 变更类型 | Change Type

  • [ ] ✨ feat
  • [ ] 🐛 fix
  • [ ] ♻️ refactor
  • [ ] 💄 style
  • [x] 👷 build
  • [ ] ⚡️ perf
  • [x] 📝 docs
  • [ ] 🔨 chore

🔀 变更说明 | Description of Change

  • rename docker-compose/local/ => docker-compose/local-logto/
  • docs/self-hosting/server-database/docker-compose.mdx: 重命名后更新文档;
  • docker-compose/local/.env.example, docker-compose/demo/.env.zh-CN.example: 提前定义Casdoor的环境变量;
  • docker-compose/local/docker-compose.yml: 接入Casdoor,定义初始化行为;
  • docker-compose/local/init_data.json.tar.gz: Casdoor初始化配置,ref;
  • docker-compose/local/s3_data.tar.gz: Minio初始化配置,
  • docker-compose/local/setup.sh: 准备阶段脚本;
  • close https://github.com/lobehub/lobe-chat/issues/3875

📝 补充信息 | Additional Information

  1. 使用说明:
  • 下载配置
bash <(curl -fsSL https://raw.githubusercontent.com/cy948/lobe-chat/run/casdoor/docker-compose/local/setup.sh) -f -l zh_CN --url https://raw.githubusercontent.com/cy948/lobe-chat/run/casdoor

脚本参数说明:

  • -f: 强制下载附件
  • -l:选择脚本语言,有 zh_CN 可选,默认为en
  • 修改.env
  • 启动
docker compose up
  • 访问 http://localhost:3210
  • 登录,账号密码为:
admin
123
  1. 重新生成init_data.json
  • 使用casdoor镜像,连接一个空的数据库,在UI界面进行操作、配置
  • clone casdoor项目,运行
# Require go >= 1.17
go mod download
go test ./object -v -run TestDumpToFile
cd ./object
mv init_data_dump.json init_data.json
tar -czvf init_data.json.tar.gz init_data.json
  1. 重新生成s3_data

该部分为minio的挂载文件夹,.env.example中的S3_*发生变更则需要重新打包;

  • 运行minio,按照文档的方式创建Bucket和AccessKey,并进行记录;
  • 根据BucketName和AccessKey修改环境变量示例env.example;
  • 直接对文件夹进行压缩
tar -czvf s3_data.tar.gz s3_data

Kludex avatar Sep 09 '24 11:09 Kludex

@cy948 is attempting to deploy a commit to the LobeHub Pro Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Sep 09 '24 10:09 vercel[bot]

👍 @cy948

Thank you for raising your pull request and contributing to our Community Please make sure you have followed our contributing guidelines. We will review it as soon as possible. If you encounter any problems, please feel free to connect with us.
非常感谢您提出拉取请求并为我们的社区做出贡献,请确保您已经遵循了我们的贡献指南,我们会尽快审查它。 如果您遇到任何问题,请随时与我们联系。

lobehubbot avatar Sep 09 '24 10:09 lobehubbot

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 92.45%. Comparing base (8170889) to head (6094095). Report is 96 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3855      +/-   ##
==========================================
+ Coverage   91.73%   92.45%   +0.72%     
==========================================
  Files         481      482       +1     
  Lines       34215    34354     +139     
  Branches     3297     2276    -1021     
==========================================
+ Hits        31388    31763     +375     
+ Misses       2827     2591     -236     
Flag Coverage Δ
app 92.45% <ø> (+0.72%) :arrow_up:
server 97.36% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Sep 09 '24 10:09 codecov[bot]

这个方案是本地体验还是生产也可以用?

arvinxx avatar Sep 09 '24 16:09 arvinxx

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


Is this solution a local experience or can it also be used in production?

lobehubbot avatar Sep 09 '24 16:09 lobehubbot

这个方案是本地体验还是生产也可以用?

@arvinxx 推荐本地体验,用于生产则需要更改密钥。但改密钥又会回到像logto那样复杂的配置过程,还是作为本地体验版本好点?

cy948 avatar Sep 10 '24 00:09 cy948

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


Is this solution a local experience or can it also be used in production?

@arvinxx recommends local experience, for production use you need to change the key.

lobehubbot avatar Sep 10 '24 00:09 lobehubbot

@cy948 那就直接替换本地那个 logto 的文件夹吧。或者 logto 的改个别的名字,local-logto

arvinxx avatar Sep 11 '24 02:09 arvinxx

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


@cy948 Then just replace the local logto folder directly. Or change logto to another name, local-logto

lobehubbot avatar Sep 11 '24 02:09 lobehubbot

~~睡了 20 个小时,来干活了!~~

  1. 下载下来的 .env 没有根据语言参数切换
  2. 应该是 docker compose up -d
  3. 首先打开的应该是 8000 端口,而不是 lobe 的 3210

zhuozhiyongde avatar Sep 15 '24 09:09 zhuozhiyongde

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


~~After 20 hours of sleep, come to work! ~~

  1. The downloaded .env is not switched according to the language parameters.
  2. It should be docker compose up -d
  3. The port 8000 should be opened first, not the lobe’s 3210

lobehubbot avatar Sep 15 '24 09:09 lobehubbot

docker compose up -d 现在也启动不起来,lobe 报错 Error: [NextAuth] provider generic-oidc is not supported

是由于相关 PR 没有合并触发 docker 的相应构建吗

zhuozhiyongde avatar Sep 15 '24 09:09 zhuozhiyongde

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


docker compose up -d cannot be started now, lobe reports an error Error: [NextAuth] provider generic-oidc is not supported

Is it because the relevant PR is not merged to trigger the corresponding build of docker?

lobehubbot avatar Sep 15 '24 09:09 lobehubbot

@zhuozhiyongde 你看看是不是本地的 lobechat-database 镜像没有更新?

cy948 avatar Sep 15 '24 09:09 cy948

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


@zhuozhiyongde Could you please check if the local lobechat-database image has not been updated?

lobehubbot avatar Sep 15 '24 09:09 lobehubbot

@zhuozhiyongde 你看看是不是本地的 lobechat-database 镜像没有更新?

我去,睡傻了

zhuozhiyongde avatar Sep 15 '24 09:09 zhuozhiyongde

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


@zhuozhiyongde Can you see if the local lobechat-database image has not been updated?

I'm going to sleep like crazy

lobehubbot avatar Sep 15 '24 09:09 lobehubbot

  1. 下载下来的 tar.gz 压缩格式没有删除

zhuozhiyongde avatar Sep 15 '24 10:09 zhuozhiyongde

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


  1. The downloaded tar.gz compressed format is not deleted.

lobehubbot avatar Sep 15 '24 10:09 lobehubbot

image

为什么需要重新生成

arvinxx avatar Sep 24 '24 11:09 arvinxx

image

为什么需要重新生成

这部分主要是留给以后开发维护用的 如果需要改minio的配置才需要重新生成。

cy948 avatar Sep 24 '24 11:09 cy948

❤️ Great PR @cy948 ❤️

The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world.
项目的成长离不开用户反馈和贡献,感谢您的贡献! 如果您对 LobeHub 开发者社区感兴趣,请加入我们的 discord,然后私信 @arvinxx 或 @canisminor1990。他们会邀请您加入我们的私密开发者频道。我们将会讨论关于 Lobe Chat 的开发,分享和讨论全球范围内的 AI 消息。

lobehubbot avatar Sep 24 '24 12:09 lobehubbot

:tada: This PR is included in version 1.19.26 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

lobehubbot avatar Sep 24 '24 12:09 lobehubbot

我目前测下来没问题了

我也成功了本地,我想吧localhost全部改成ip,让内网的其他机器访问可以嘛 现在报这个错误 8cf425ed427965d8af6f35cb35a0591

490ec76a51636f86a6282fc0d1c6461

zhangleijun111 avatar Sep 25 '24 06:09 zhangleijun111

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


I have tested it so far and there is no problem.

I also successfully installed it locally. I think it is okay to change all localhost to IP so that other machines on the intranet can access it. Now I get this error. 8cf425ed427965d8af6f35cb35a0591

490ec76a51636f86a6282fc0d1c6461

lobehubbot avatar Sep 25 '24 07:09 lobehubbot

这个方案是本地体验还是生产也可以用?

@arvinxx 推荐本地体验,用于生产则需要更改密钥。但改密钥又会回到像logto那样复杂的配置过程,还是作为本地体验版本好点?

这个本地本地部署方便很多,但是我前面吧localhost换成ip想让其他内网机器用就不行了,另外可以支持生产部署嘛

zhangleijun111 avatar Sep 25 '24 07:09 zhangleijun111

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


Is this solution a local experience or can it also be used in production?

@arvinxx Recommend local experience, for production use you need to change the key. But changing the key will return to a complicated configuration process like logto, or is it better to use a local experience version?

This local deployment is much more convenient, but if I change localhost to IP earlier and want other intranet machines to use it, it won’t work. In addition, it can support production deployment.

lobehubbot avatar Sep 25 '24 07:09 lobehubbot

这个本地本地部署方便很多,但是我前面吧localhost换成ip想让其他内网机器用就不行了,另外可以支持生产部署嘛

不支持,当前的本地体验版配置在网络和安全性上未达到生产要求。

cy948 avatar Sep 25 '24 07:09 cy948

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


This local deployment is much more convenient, but if I change localhost to IP earlier and want other intranet machines to use it, it won’t work. In addition, it can support production deployment.

Not supported. The current local trial version configuration does not meet production requirements in terms of network and security.

lobehubbot avatar Sep 25 '24 07:09 lobehubbot

这个本地本地部署方便很多,但是我前面吧localhost换成ip想让其他内网机器用就不行了,另外可以支持生产部署嘛

不支持,当前的本地体验版配置在网络和安全性上未达到生产要求。

那我把localhost换成ip给内网其他机器访问,报前面这个错误是正常的是吧?????

zhangleijun111 avatar Sep 25 '24 07:09 zhangleijun111