Skip to content
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

Casdoor Online Deployment #933

Closed
12 tasks done
nighca opened this issue Sep 25, 2024 · 3 comments
Closed
12 tasks done

Casdoor Online Deployment #933

nighca opened this issue Sep 25, 2024 · 3 comments
Assignees

Comments

@nighca
Copy link
Collaborator

nighca commented Sep 25, 2024

close #878

  • 使用最新代码发布线上现有 casdoor 服务,测试登录功能 OK
  • 添加 acc-api.goplus.org 指向现有 casdoor 服务
  • 添加 vercel 项目,部署 casdoor 前端,配置其 api endpoint 为 acc-api.goplus.org
    • 需要配置域名 acc-web.goplus.org 指向 vercel 项目
    • 配置使用与测试环境一致的 github app(原本是 github oauth app)
    • 需要长军配置线上 github app 的 callback url 新增 acc-web.goplus.org
  • 使用本地项目测试走 acc-web.goplus.org 登录 OK
  • 调整线上 builder 配置,测试登录 OK
    • spx-gui 配置 VITE_CASDOOR_ENDPOINT 为 acc-web.goplus.org
    • spx-backend 配置 GOP_CASDOOR_ENDPOINT 为 acc-api.goplus.org
  • 配置 acc.goplus.org 指向 vercel 项目
  • 调整线上 builder 配置,测试登录 OK
    • spx-gui 配置 VITE_CASDOOR_ENDPOINT 为 acc.goplus.org
  • 配置 CDN 域名 acc-static.gopluscdn.com 源站为 acc.goplus.org
  • 配置现有 casdoor 服务,静态资源使用 CDN 域名
  • 干掉 acc-web.goplus.org、acc-api.goplus.org 域名解析
  • 添加新的 organization(可能已存在)& application/client
  • 调整 spx-gui & spx-backend 配置,使用 organization GoPlus,测试登录 OK
@nighca nighca self-assigned this Sep 25, 2024
@nighca
Copy link
Collaborator Author

nighca commented Sep 26, 2024

  • 使用最新代码发布线上现有 casdoor 服务,测试登录功能 OK

最新代码发布线上后遇到登录状态丢失的问题;排查是 casdoor 在未配置 redis endpoint 作为 session storage 的情况下会使用本地的临时文件存储 session,多台机器间 session 信息不共享;之前没问题应该是因为之前线上 casdoor 只有一台服务器在提供服务。

因为 LB 是 QVM(luckin)提供的能力,不支持 session 保持,计划在 LB 与 casdoor 服务之间的 nginx 上增加基于 iphash 的 session persistence 作为临时方案;长期来看我们可以部署一个 redis 用于 session 共享。

@nighca
Copy link
Collaborator Author

nighca commented Sep 26, 2024

@hsluoyz We plan to deploy the Casdoor frontend (everything built from casdoor/web/) on Vercel at the domain acc.goplus.org, and the Casdoor backend (the Go service) on our VM at acc-api.goplus.org. We will set ServerUrl in casdoor/web/ to acc-api.goplus.org. Users will access the frontend via acc.goplus.org, taking advantage of Vercel's CDN for pages and assets.

Are there any potential risks we should consider?

@nighca
Copy link
Collaborator Author

nighca commented Sep 27, 2024

使用本地项目测试走 acc-web.goplus.org 登录 OK

配置 builder 走 vercel 部署的 casdoor,会有个问题,从登录跳转的角度看应该配置 endpoint acc-web.goplus.org,但是从接口调用看应该走 acc-api.goplus.org,配置 VITE_CASDOOR_ENDPOINT=https://acc-web.goplus.org 的话就会接口不通

调整方案为,只将静态资源走 CDN(acc-static.gopluscdn.com),页面与接口一起走 VM(acc.goplus.org)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant