Charlie Reese

SaaS founder @ https://clientelify.com Former tech lead, product lead, developer, investment banker

Should Deploying Production Infrastructure be Hard?

Below I'll explain why I built terra_boi to deploy Clientelify, why I think it was downloaded 1,000 times in the first 10 days (despite not promoting it anywhere), and why deploying an application to production shouldn't suck.

Terra(form)_boi

10 days ago I created an open-source ruby gem called terra_boi for deploying Rails applications to AWS as quickly and easily as possible.
Terra_boi contains generators (i.e. code that writes code) that create Terraform, Packer, Docker, and Rails files that allow you to immediately deploy a rails application (app servers, load balancer, DB, and S3 bucket) to production with zero downtime.

Why I Built Terra_boi

Creating AWS production infrastructure is still annoying.
I recently deployed staging and production infrastructure for my appointment reminder application Clientelify. It was something I had done many times before.
Although it has gotten easier to do with each iteration, every time I create new production application infrastructure for a new application, I get some small configuration detail incorrect, causing the entire application to crash on the first several deploys.
Why isn't it dead simple to deploy a rails application to AWS by now? Why can't I type rake deploy and be done with it?

Easily Deploying Production Infrastructure - Existing Solutions

As you are probably aware, there are some reasonable solutions for quickly deploying production-grade infrastructure with zero downtime. For the sake of keeping this blog post short (and because I am the furthest person from an expert on the topic), I am only going to discuss two of them: Heroku and Terraform.
Option A: Heroku
Heroku is a platform as a service (PaaS) that enables developers to easily deploy applications to the cloud.
It is fairly stable and supports a reasonable variety of infrastructure needs, but it costs several times more per month than custom infrastructure.
Heroku: we are cheaper then hiring a full-time DevOps developer!
Me: why would I hire a full-time DevOps developer for my very basic rails app?
Heroku: ಠ_ಠ
Me: ಠ_ಠ
Option B: Terraform
Terraform is an IaC tool for defining and provisioning custom infrastructure.
Once you create your Terraform IaC, destroying, creating, and deploying infrastructure becomes very simple. It does, however, often require some material leg work to port the Terraform IaC from one application to another.
Note: If you are looking to learn Terraform, check out Terraform: Up & Running by Yevgeniy Brikman. It's brilliant.

Easily Deploying Production Infrastructure - My Solution

Since Clientelify is a relatively simple rails app with one small DB, one load balancer, one SSL cert, and one S3 bucket, I couldn't help but wonder why I should need to pick between (A) paying Heroku an arm and a leg to take care of my simple infrastructure needs, and (B) tinkering with Terraform, Packer, and Docker to satisfy my simple infrastructure needs myself.
So I didn't pick either. Instead, I decided to create rails generators to build all of the infrastructure as code (IaC) files I needed to deploy a simple rails application (servers + load balancer + DB + S3) using Terraform, Packer, Docker, and various rails configuration files. The result of this was terra_boi, an open source ruby gem for immediately deploying rails applications to AWS staging and production environments.

Does Terra_boi Work?

Absolutely. My application has been using it to deploy to staging and production environments for the past several days. Further, you can add your own Terraform / Packer files (to the IaC files generated) to tailor your infrastructure / deployment process to your own needs!
Terra_boi's Shortcomings:
  1. Deployment requires running several commands (listed in the README.md) by hand (I haven't written a deployment script to automate these steps yet). Ideally, deployment would only require running the command rake deploy
  2. It is currently only built to generate IaC files for rails apps
  3. It is still rapidly changing
  4. Deployment is slow (~15 minutes) since terra_boi creates new AWS AMIs (terra_boi uses immutable infrastructure) for each deployment

Why Terra_boi Was Downloaded 1,000 Times In 10 Days:

Ignoring automated downloads (which I'm sure made up a material percentage of the 1,000 downloads), I think terra_boi's early demand, in spite of no promotion, is a testament to the fact that developers are sick of either (A) over-paying to delegate infrastructure concerns, or (B) spending time setting up basic infrastructure for basic applications.

Deploying Infrastructure Should Be Easy

For simple applications not operating at massive scale, deploying application infrastructure should be cheap, easy, and immediate.
One day soon, manually writing (or copying and pasting) boilerplate infrastructure code, or any boilerplate code for that matter, will be a thing of the past.
Bring on the IaC generators!

Tags

More by Charlie Reese

Topics of interest