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

Migration to GitHub pages #103

Closed
penalosa opened this issue Sep 11, 2020 · 4 comments
Closed

Migration to GitHub pages #103

penalosa opened this issue Sep 11, 2020 · 4 comments

Comments

@penalosa
Copy link
Member

Since this is a fairly static site, I'm thinking that it could be hosted on GitHub pages, building on push with a GitHub action. The Co-sign stuff needs to be hosted on Tardis, of course, but the site itself should be fine on Pages, I think? This would reduce the number of services that need to be managed, and simplify the setup. Unless there are any issues with this that I haven't thought of (cc @qaisjp), I can take a stab at this tonight.

@qaisjp
Copy link
Member

qaisjp commented Sep 11, 2020

This seems perfectly reasonable!

In fact, the website itself already works on GitHub Pages, because it's just a basic Jekyll website. There's already a CNAME file in the root of the repo: when Tardis or the uni's internet went down, I used to update the DNS to point to GitHub Pages instead.

The only downside is that the website will build and update less fast. This is actually one of the main reasons we moved away from GitHub Pages (except for emergencies) — because it was quite slow to update. Their caching is crazy aggressive. (It's your decision — maybe they've improved or maybe it's still worth it anyway.)

It's just the other services that break when we point the domain to GitHub Pages. You can view the nginx.conf file to see what things are likely to break / need fixed:

  • L17 /courses.json needs special headers to be set, so that mapp can access the list of courses too. (mapp uses this list to show the full name of courses when there's a tutorial running in a lab room.)
  • L22 - /update_github receives a GitHub push webhook, so that we can pull and rebuild the website.
  • L26/cosign — we'll need to ask Informatics to update our CoSign redirect URL from https://betterinformatics.com/cosign to something like https://app.betterinformatics.com/cosign.
  • L32 - /drive — we can probably add some redirection code on the frontend, to redirect to https://app.betterinformatics.com/drive
  • L38 - /search — this is used to search for exams when the website is in "Exam Mode". It's a thin reverse proxy to access the exams.is.ed.ac.uk API. (Or you can ask IS to update the Access-Control-Allow-Origin header to allow any website to use the API.) This could be moved to https://api.betterinformatics.com/exams.

@penalosa
Copy link
Member Author

So some first attempts at making sure this can go smoothly

  • /courses.json now uploads to CompSoc's object storage after updating (piggybacking off the GitHub Action for updating). URL is https://compsoc.ams3.digitaloceanspaces.com/betterinformatics/courses.json (https://cdn.comp-soc.com/betterinformatics/courses.json with a CDN), which mapp can access
  • /update_github should be fine — updates will be through Actions, so this won't be needed
  • /cosign + /drive + /search since the site's already going through Cloudflare, I'll add a simple CF worker to do the necessary redirection and proxying here (thinking about it, this could work for /courses.json too), and modify nginx.conf to listen from api. or app.

@qaisjp
Copy link
Member

qaisjp commented Sep 16, 2020

Nice!

I'll add a simple CF worker to do the necessary redirection and proxying here

Oh that's a very good point — we don't need to ask Informatics to update the CoSign redirect URL, because you can just redirect Cloudflare side! Nice find.

One problem (unrelated to Cloudflare redirection, but related to CoSign) is that certain cookies will probably now only be set for the app.betterinformatics.com domain, instead of betterinformatics.com itself. (This stops mapp.betterinformatics.com from accessing the cosign cookie.)

Two possible solutions for that:

@penalosa
Copy link
Member Author

I got every so slightly sidetracked by #23 😂, and I think the outcome of that will decide the outcome of this, so I'm closing this for now

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

2 participants