Hugo

I am finally getting around to publishing again. This time from a hugo powered site generator. It’s been much easier to get hugo working than to fight with ruby. I’ve rebuilt and reformated my main computer multiple times and each time I want to write my Jekyll install was busted. So I ditched Jekyll this week.

Migration to hugo

Hugo was a quick and easy install. I’d played with it in the past for another project (one that hasn’t gone to production yet). I grabbed a pre-made theme for now (much like I did with Jekyll) to get started. Hugo also seems to be easier for me to grok from a content perspective. I hope to add more sections to this site over time to experiment with that possibility. Another big change that I wanted to try but wasn’t sure about was how I’d publish.

Using AWS

This site was always S3 hosted via Cloudfront but managing that also proved tough at times. I used the s3_website gem (since I was already tied to ruby for jekyll) to help but most of the time my AWS creds also were not usually configured either. Now that is less of a problem of late, as I use AWS for more stuff than I did in 2017 and 2018. However, I still needed a sustainable and quick publishing pipeline.

Hugo supports publishing to s3 much like s3_website did for me. However, now I can run builds in AWS without managing a CI server! It’s called AWS CodeBuild and it can pull my code from github triggered from a webhook and run like jenkins!

Now all I need on my computer to push new content is VSCode (my favorite editor of late) and git. The only credentials I need are my SSH key for github, which is one of the first things I do when I setup a computer. I can even handle permissions like any other AWS resource. I just needed to create a service role for my build and grant it the necessary permissions to call s3. Now my build and publish process is just as “serverless” as the site itself!

Publish pipeline

Now I publishing looks like this:

  1. Write content
  2. Commit to git
  3. Push to github
  4. AWS Codebuild is triggered from push event
  5. Codebuild runs a hugo build and publish
  6. There is no step 6