Fabric, and making your life easy

We love Python, one-line deploys, and doing whatever we can to make our lives easier. Fabric does all this and more: anything from setting up a new server or local dev environments, to creating automatic backups, to just generally making development easy by automating any administrative task.

Fabric is a Python library and command-line tool for streamlining the use of SSH for application deployment or systems administration tasks.

A bit more from the docs: http://docs.fabfile.org/en/1.8/

It provides a basic suite of operations for executing local or remote shell commands and uploading/downloading files, as well as auxiliary functionality, such as prompting the running user for input or aborting execution.

Typical use involves creating a Python module containing one or more functions (fabfile.py), then executing them via the fab command-line tool.

Let’s walk through a fabric file and run some of it:

Click here to view on github: https://gist.github.com/Raisins/7781097

There are a lot more commands, and this tiny file is only scratching the surface of what is possible with Fabric. One of our favorite commands is fab bootstrap, which will set up an entire project and all its requirements on a local Macbook for you, so anyone can get their dev environment up and running in minutes. You know all those long commands and snippets you have saved somewhere that only you know about? Fabric saves you from having to look them up every time, and makes it possible (and easy) for everyone else to use.

Be sure to check out the docs or check out this great talk: http://www.slideshare.net/andymccurdy/python-deployment-with-fabric.

Fabric, and making your life easy

Leave a Reply

Your email address will not be published. Required fields are marked *