Capistrano for Python

Posted 29 Jul 2016 to python, fabric and has Comments

In the Python world, Fabric seems like the de facto method for deploying code. At its core, though, Fabric is just a way to streamline the use of SSH, much like Ruby’s SSHKit. Reliable deployments, however, typically involve more than just running a few commands on a remote server. For instance, Ruby’s Capistrano builds on it’s underlying ssh library SSHKit and provides a lot of useful functionality, like:

  1. the ability to inject tasks in a dependency chain (before you run TaskA, always run TaskB)
  2. configuration variables with values that are role specific, where each server has one or more roles
  3. configuration values that are evaluated at run time (i.e., the ability to have values that are callable at runtime)
  4. the ability to define a sane flow convention for deployment and then give people the ability to override/inject only what they need. Convention over configuration!

I feel like there should be a way to reliably do these things, and Fabric isn’t enough. So I made a project called Fake - for Fabric + Make (in the same way that Rake is Ruby + Make). It includes all of this functionality, including Capistrano’s default deploy tasks for reliable code checkouts (and super fast rollbacks!).

Check it out at https://github.com/bmuller/fake for documentation and examples.