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

Migrate unpkg CDN to local files #404

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

smartspot2
Copy link
Member

Unpkg was down briefly today (3/15), which caused the entire website to break. Migrating to local React assets would fix similar issues in the future.

However, there are many potential downsides to this:

  • Most importantly, using CDNs redirects traffic away from the Heroku servers, lowering the load we need to support. Especially since this is a very popular React CDN, it'll almost always be cached on the client's computer, which would improve their load speeds as well.
  • Unpkg seems to be the official CDN that React recommends, and the downtime is almost certainly going to be resolved very quickly, as many larger companies use the same CDNs.

As an alternative, we could still have the React assets stored locally as a back-up in case this ever happens again—we'd always hit the unpkg CDN endpoint first, and only use local files if that fails. (We'd need to look into how to do this check and fallback.) This would give benefits of using an external CDN as well as the back-up in case it goes down.

We can also probably look into other CDNs if this becomes another issue in the future, though again it is unlikely, since many other production servers also use the unpkg CDN.

Ideally, with this talk of CDNs, it'll be a lot better for our Heroku servers to offload all static assets (i.e. all of the compiled javascript files) to an external endpoint (see AWS Cloudfront, which caches S3 files). This would require some code changes and would incur an additional cost—we'd need to get an estimate by looking through the logs, but we'll likely fall under the free tier for CloudFront (the first 10 million requests and 1TB data transfer per month is free), and the amount of data we store is very little, so S3 costs would also be small too.

@smartspot2 smartspot2 added bug Something isn't working help wanted Extra attention is needed sev4 Normal severity - System impaired labels Mar 16, 2023
@smartspot2 smartspot2 self-assigned this Mar 16, 2023
@cypress
Copy link

cypress bot commented Mar 16, 2023

Passing run #98 ↗︎

0 78 0 0 Flakiness 0

Details:

Migrate unpkg CDN to local files
Project: csm_web Commit: cc58aecc8a
Status: Passed Duration: 02:13 💡
Started: Mar 16, 2023 2:58 AM Ended: Mar 16, 2023 3:00 AM

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed sev4 Normal severity - System impaired
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant