Morgan Conrad

New Website Infrastructure-1

Tags: all metalsmith cloud-services     Nov 02 2017

Background

For the last year my website was hosted on a traditional ISP (A Small Orange) which offered all the basics, plus the unusual option to host a Ghost blog. Ghost was fine, no real complaints, though I wasn't really using it often. When my yearly contract was coming up for renewal, the smart and easy move would be to just pay some money and renew, but I starting thinking about alternatives

Why change?


1. The price was going up (after the sweetheart 1st year discount) 2. They only supported a very old (0.10) Ghost while the current is v1.16.2 3. It's an excuse to learn something new.

Alternative 1: Amazon

One intriguing option was Amazon Lightsail. Amazon is taking over the world, why not learn about their Cloud platform for $5 a month? I also looked at Amazon EC2, which would be free for a year. Briefly considered some of the alternatives, such as Linode, Digital Ocean, and Vultr, but since the whole point was to lear about Amazon's products they didn't make much sense.

I found a few tutorials on installing Ghost on Lightsail. The all looked a little finicky. One issue was (temporarily) adding swap space, because apparently the base 512MB is too small. Having once programmed computers with 32KB, that's an interesting reflection on technology... But this plan was still very much in the running.

Alternative 2: Ditch Ghost

Another option was to ditch Ghost, and process the blog through Metalsmith, which I use to build the "main" part of the site. A big advantage is that it is easy to have the blogs match the visual theme of the main site. Assuming you like the look of the main site. The metalsmith-collections plugin can collect your posts. There are other plugins to tag or organize them. Some of them look good. I ended up writing my own tagger plugin, much inspired by this post and the desire to have multiple categories of tags.

One disadvantage of this approach is that, to add a new blog post, I need my computer handy. In my "dream" setup, would be able to blog from my tablet while sipping margaritas on my (non-existant) sailboat.

Another issue would be how/where to deploy the site. There are a lot of options here. GitHub pages are an obvious place for a developer. I actually tried that for a while. It works, but the whole workflow is messy. First, the "source" files really should be backed up somewhere. And I'm not thrilled about having them in a public GitHub repository. Maybe that's a bit old-fashioned fuddy-duddy my privacy is long gone anyhow. But then you need a separate "gh-pages" branch for the built pages. (unless you use Jekyll) The idea of version controlling built assets is slightly distasteful to a purist programmer. I use and usually tolerate git, but I don't enjoy using it, and this is a multi-step hurdle. Yes, there are scripts to help so I was leaning this way.

GitLab would offer something similar, and I can keep my source files private there. Definite plus. And you can build it there, though I saw complaints that it could be slow. O.K., this was really looking intriging.

Winner: Netlify

Not sure exactly when, but somewhere in my research I ran across Netlify. Their motto is "Write frontend code. Push it. We handle the rest.". Sounded perfect. Reading further, they

  1. Integrate with GitLab, GitHub, or BitBucket
  2. Have global CDN (not that my website would need it...)
  3. Snapshots let you revert back to an earlier version
  4. Easy to setup SSL with Let's Encrypt (so they say, haven't tried yet)
  5. Domain management
  6. CLI, API, Webhooks...

And, for a one-person team, it is free. Even more important, it was very quick and easy to setup. Here's the minimum:

Setting Value / Notes
Repository https://gitlab.com/user/reponame
Branch master
Build Command node build
Publish Directory dist/

I setup the four values, pushed my content, nice and private on GitLab, and geez, was it fast!. Within seconds there was my site, up on netlify.com.

The Dream Comes Closer

This still doesn't completely the answer the blog from my tablet while sipping margaritas on a sailboat. I'm thinking Contentful will handle that. More in a later post...