Site and blogctl Overview

« Previous Next »
Jan 9, 2019
Why and how'd you build this?
I wanted to write a quick post to go over how this blog is structured and what it's origin story was.
I wanted a blog that could:
  1. Be a stream of photos I'd taken.
  2. Resize the photos from the originals to thumbnail sizes.
  3. Be statically hosted on S3, and fronted with CloudFront.
  4. Extract and structure EXIF data.
  5. Use SSL.
  6. Occasionally handle a text post or two.
  7. Draw clear abstractions between what was provided by the tool (data) and the blog's own code (formatting).
  8. Leverage golang templates to some degree, as they're something I'm familiar with.
Originally I used the fantastic hugo, but I ran into a bunch of limitations, namely how it handled images and not being able to generate thumbnails easily.
So I ended up writing a tool called blogctl. The name is a combination of blog and control, in the same vein as kubectl (something I use every day).
One key consideration with this is the tool itself provides very specific things in producing the final output; it enumerates the posts, renders given templates (some for each post), copies the files to S3 and invalidates the Cloudfront caches. It does not have any coupling to how the blog will eventually look or function, that is left to the individual implementations of blogs (very much like how hugo works).
The code for this blog is in a separate repo, charczuk.com, which includes all the post templates, static files like css, and the posted images themselves.
The result is a pretty expressive way to build the blog, as I can play around with how it's formatted and the tool just processes the post data, golang templates handle the rest. Also, because it's hosted statically I don't have to worry about runtime components or scale problems.
If you'd like to get started messing around with it, there are a couple helper commands (namely blogctl init) that will help you get started and create a shell blog for you.