Blogging with Netlify and Jekyll

Written on December 1, 2017

New job, international travel, flu, recovery from jetlag have all been factors attributing to my lack of posts to my site. It wasn’t that there was any lack of things or ideas to share about. But one technical factor that did also get in the way was the fact that the ability to publish my site has become a little tedious.

Prior to writing this post, I am using Jekyll — a static site generator — to build my site. Once the site is built, I used s3_website to take the built site and push it up to S3 and update the CDN.

The process to kick off this whole process is a couple of commands, which made it fairly simple. But the limitations were glaring when I wasn’t at my computer or was in front of a new computer.

Recently, I started a new job and soon after took a vacation overseas. With a new machine assigned to me, I had to set up the essentials such as an SSH key to access GitHub. But in order to get my site building and published for the machine was a bit daunting.

The reason for the resistance to get the build environment up and running is the fact that even though I’m able to clone the repo for my site, now I had to provision my new machine with my AWS account and set up environment variables to get s3_website the ability to push up my site to AWS.

The process could probably take less than 30 minutes but I was dreading it because there are so many steps.

The other limitation mentioned above is that I had to always be at my computer to build and push new content to my site. Although my machine of choice is pretty compact and easy to transport, the reality is, it isn’t always with me. This was the case when I was overseas in Seoul, South Korea recently.

Being in a big city and being with my family on vacation meant, I spent little to no time in front of my laptop. This was expected as I wanted to focus on rest and spending quality time with my family. But being in Korea for the first time in over 20+ years, there were a few times I wanted to quickly capture my thoughts and emotions but couldn’t.

I could’ve captured those thoughts and moments via my phone — which was always with me — and then at the end of the day copy that over to my laptop to push and publish. But at the end of the day, I was just so exhausted that I didn’t even want to open up my laptop. Instead it would’ve been great to just lay in bed at night, do some editing and then publish straight from my phone.

These limitations that I ran into definitely made me long for a fully hosted CMS like Wordpress for a moment. With things like dedicated mobile apps and the ability to publish from a browser is really appealing. I did toy with the idea of maybe deploying something like Ghost, but the mere thought of moving my content over to a new blogging system and the cost increase in hosting made me not dwell on the idea for long.

The approach I did decide to look into and eventually settled on, was to figure out a method of cutting out the build and publish process on my local machine. By doing that, I could simply push to my GitHub repo and then an intermediary process would handle building and pushing the site up to AWS. By going this route, it would mitigate my two concerns of having to be in front of a computer to publish and having to set up the environment on a new machine.

Seeing how I just started in the continuous integration/deployment industry, I wanted to first look into if there was any options there. While I’m getting familiar with Jenkins and all it has to offer, in order to get it up and running, I would have to set up an external server, maintain and then also provision with the correct credentials to have it building and pushing up my site. This didn’t seem to really ease the burden of setting up a “new machine”. Not to mention I’d pay anywhere from $5 - $10 per month to host this setup.

While trying to get a scope of the industry, I came across a hosted solution for continuous integration/deployment with Travis CI. One nice thing about Travis is that it is absolutely free for open source projects. With my site being open source, this was definitely a feasible option.

So I spent an evening setting up Travis CI to build my site. The set up was fairly easy in getting GitHub connected. But some of the complexities crept up when I had to configure a file in order to tell Travis what dependencies my project had and how it should be built. I’m hoping things like this will become more trivial as I gain more understanding of the space and technology. But for the mean time it was complex. Not to mention, the daunting task of provisioning Travis with AWS was a missing link.

After spending an evening with Travis CI, I backed out of that path. My next course of action was to reevaluate using AWS as my hosting solution for my site, as provisioning was something that had become an overhead for the setup. Upon researching, I stumbled upon many people suggesting the use of Netlify to host static sites.

Looking over the features, Netlify seemed to provide everything that I needed out of the box and then some. They provide a free tier and out of the box, man this service is awesome. It has one-click SSL with Let’s Encrypt, hosting on super fast CDN and continuous deployment. Which means, upon hosting to Netlify, I can do away with building locally and pushing it up to my site’s host. All I have to do is commit to my GitHub repo and Netlify will automatically build and push out changes to their CDN. Suhhhhweet :sunglasses:

Netlify’s dashboard and onboarding is top notch. Getting everything pointed over to them and hooked up probably took less than 15 minutes and felt very intuitive. That includes signing up, hooking up GitHub, updating nameservers on my domain registrar, Hover to use Netlify’s, setting up SSL, flipping on forced SSL and publishing my site.

The sweetest part is, like when I was hosting using GitHub Pages, I could even forgo commiting changes from my machine if I wanted to and directly make changes to my repo on GitHub.com since it allows you to do everything within the browser — almost feels like a traditional CMS :wink:

Netlify has definitely made me excited about blogging again. It mitigates two of the biggest pains I was recently experiencing with blogging with Jekyll and provides a very slick onboarding process and interface. If you’re looking to host your static site somewhere, I can’t recommend Netlify enough. I’m excited to explore some of their other offerings (especially form handling) and use it for future projects.

Stay in touch

Thanks for reading this article. I'd love to stay in touch and share more tips on programming and side projects with you. Sign up and I'll send you my articles straight to your email, you'll also get a free copy of the light themed version of my Git cheat sheet.
Git cheat sheet preview image