diff --git a/_posts/2017-12-29-jekyll-setup.md b/_posts/2017-12-29-jekyll-setup.md new file mode 100644 index 0000000..835288c --- /dev/null +++ b/_posts/2017-12-29-jekyll-setup.md @@ -0,0 +1,62 @@ +--- +layout: post +title: "Notes from setting up a Jekyll blog on AWS S3 and CloudFront" +slug: jekyll-aws-s3-cloudfront +date: 2017-12-29 15:00:00 +0000 +categories: jekyll setup +--- + +Here are my notes from today's task of setting up this blog. + +* Using [Jekyll](https://jekyllrb.com/) + * Easy to setup + * Built-in syntax highlighting + * write/commit/push workflow + * easy to deploy as static website + * Compatible with GitHub and GitLab pages +* Theme + * Using [minima theme](https://github.com/jekyll/minima) + * Basic but easy to customize and extend + * Overrides: + * [`home.html`](https://gitlab.com/rfwatson/techblog/commit/1f9e5bcc69b1d25329c7552a7d3152ff63725250#f87bb2fcce406e16253570011cce02227981f242_0_25) to add full post content to homepage + * [`assets/main.scss`](https://gitlab.com/rfwatson/techblog/blob/1f9e5bcc69b1d25329c7552a7d3152ff63725250/assets/main.scss) with CSS/design changes + * Fonts + * Webfonts from [Google Fonts](https://fonts.google.com/) +* Hosting + * Considered [GitHub pages](https://pages.github.com/), [GitLab pages](https://about.gitlab.com/features/pages/) and static hosting using [AWS S3](https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html) + * Requirements: + * free (gratis) + * easy-to-maintain, preferably static/serverless + * Basic HTTPS support, with redirect from HTTP + * GitLab Pages + * Free static site hosting comparable to GitHub Pages + * Pros: + * Powerful containerized [CI/build system](https://about.gitlab.com/features/gitlab-ci-cd/) + * HTTPS support for static site, even on custom domains + * Cons: + * No option to force HTTPS + * Tricky to get LetsEncrypt TLS certs to work with CI/build system - [official tutorial](https://about.gitlab.com/2016/04/11/tutorial-securing-your-gitlab-pages-with-tls-and-letsencrypt/) is slightly out-of-date + * GitHub pages + * Pros: + * Popular and well-documented + * HTTPS support, including option to force HTTPS + * Cons: + * No HTTPS support for custom domains + * AWS S3 + * Pros: + * less managed than GitLab/GitHub - so a bit more setup, but also more flexibility + * HTTPS support, as well as supporting "redirect objects" which effectively allow us to set up arbitrary 301 redirects on our site programatically. + * supports multiple subdomains + * Cons: + * Not quite free, but very low cost for low usage + * Ended up choosing S3 + * Created bucket, enabled static website hosting option + * Added Cloudfront web distribution + * Follow approach [here](http://someguyontheinter.net/blog/serving-index-pages-from-a-non-root-location-via-cloudfront/) to avoid 403 errors from S3 when serving paths without an explicit `index.html`, like `/about` + * Added simple deploy script making use of [AWS CLI](https://aws.amazon.com/cli://aws.amazon.com/cli/) +* DNS + * Registered domain + * Added hosted zone to [AWS Route 53](https://aws.amazon.com/route53/) + * Updated nameserver records in Namecheap control panel to point at AWS + * Added alias record to point at Cloudfront distribution + * Added MX record to point at pre-existing [Mailinabox](http://mailinabox.email/) setup