X-lab2017 / open-leaderboard

OpenLeaderboard
https://open-leaderboard.x-lab.info
20 stars 23 forks source link

[CI/CD] Chances the online website cannot be accessed after deploy #65

Open tyn1998 opened 1 year ago

tyn1998 commented 1 year ago

Several days ago we encountered it. Now twice:

image

Network tab in DevTools:

image

...folded content:

image
tyn1998 commented 1 year ago

But can be accessed by https://open-leaderboard.x-lab.info/static/js/

image

...folded content:

image

Do you think it might be caused by a wrongly set cache strategy? @zhicheng-ning

zhicheng-ning commented 1 year ago

@gymgym1212 Do you know whyopen-leaderboard.x-lab.infowill be resolved by CNAME to open-leaderboard.x-lab.info.w.kunlunaq.com ?

5574ccd432a08686905b6ee300f3120

frank-zsy commented 1 year ago

I config the DNS since the OpenLeaderboard is hosted on CDN service but not simply OSS. The CNAME is the CDN address for corresponding OSS. So I don't think it is something wrong about the DNS, maybe caused by CDN cache strategy. @zhicheng-ning

zhicheng-ning commented 1 year ago

The CNAME is the CDN address for corresponding OSS.

ok

bifenglin commented 1 year ago

CNAME is used to map another domain, and usually could be found in DNS. And I think the reason is the Nginx config. Plz delete the zip function in nginx.conf file which located in /etc/nginx.

frank-zsy commented 1 year ago

Not sure what you mean but we build and publish the website directly to OSS and add a DNS service on it, so we don't host any Nginx service on ourselves. @bifenglin

bifenglin commented 1 year ago

I'm not sure about the deployment architecture. And I don't know this method to deploy, I will ask to @tyn1998 face-to-face. And thanks for reply @frank-zsy .

publish the website directly to OSS and add a DNS service on it

frank-zsy commented 1 year ago

Here is the publish action: https://github.com/X-lab2017/open-leaderboard/blob/main/.github/workflows/publish.yml

tyn1998 commented 1 year ago

I have read:

  • 刷新任务从提交到生效,大约需要5~6分钟,
  • 预热任务从提交到预热完成,实际执行时间视预热文件大小而定,大约需要5~30分钟。

Still cannot have a conclusion, but I suspect that delete-oss before update-oss might be the cause:

https://github.com/X-lab2017/open-leaderboard/blob/1af79f3926d13032c0b39eb703a961ea43a4af2a/.github/workflows/publish.yml#L28-L44

I don't think a delete operation is necessary as the old files should be covered by new ones.

tyn1998 commented 1 year ago

66 removed code of delete-oss, but it didn't bring any change of built files so the files on the oss remained the same(i.e. main.xxxx.js is still main.xxxx.js).

Following merges into main should be observed to test if the problem is resolved.

frank-zsy commented 1 year ago

@tyn1998 It could be the problem. Delete the files first because for the generated files, I am not sure but perhaps the numbers are random number by building timestamp. So if we do not clean the files in time, there will be lots of legacy files left on OSS.

tyn1998 commented 1 year ago

Hi @frank-zsy, do you have access to the oss console? Would you mind checking if old files were simply covered? Since main.xxxx.js and some other files are in the /static folder I think they will be removed when the /static folder is covered by a new one.

I am not sure but perhaps the numbers are random number by building timestamp.

xxxx of main.xxxx.js is file content related, not generated randomly. So xxxx will remain the same if there is no JS change in the codebase between two builds.

frank-zsy commented 1 year ago

Hi @frank-zsy, do you have access to the oss console? Would you mind checking if old files were simply covered? Since main.xxxx.js and some other files are in the /static folder I think they will be removed when the /static folder is covered by a new one.

Upload a folder to the OSS will cover the old files with same name but do not remove old files unless explicitly remove them like in the action. Actually I think we can set some flag to remove old files on upload but not in 2 steps, although this may cause file inconsistent for a short time.