Quickshiftin - Clever Crazy Code

Fabric for Application Deployments

October 20th, 2013

I’ve finally gotten to the point where I’m working with Puppet and automating application deployments. Initially I investigated Capistrano as I’ve heard so much about it over the years. I was sorely disappointed. I couldn’t figure out how to parameterize the hosts component of tasks and wasn’t interested in dirtying my projects with a config directory just for deployments. I turned to Fabric, and I’m not looking back!

Updated Article Available!

This article has an update based on a lot of lessons I learned after writing it, please check it out before implementing everything from this article!

Fabric high level

Fabric is fundamentally like Capistrano, a utility that facilitates execution of commands on remote machines over SSH. What Fabric isn’t is dependent upon some sort of known directory format, which is a limitation of Capistrano. I also found the declarative language of Capistrano limiting. Fabric feels very simple, and for that reason I find it very effective. Fabric is written in Python, so Fabric scrips are just basically Python code.

Fabric for application deployments

One thing I’m starting to understand, and still hashing out my disposition thereof is the dividing line between system configuration and application configuration. Something of a grey line when you’re talking about things like .htaccess files, but that’s a conversation for another time! That said, I’m using Fabric for application deployments. Application deployments could be implemented a number of ways, but in my current situation I’m delivering RPMs of the applications. Without delving into many of the details of my deployments, I’d like to share the paradigm I’m using in Fabric, which I think could be extended to many other projects.