Python Fabric

Dan Corin October 13, 2015
Source

To help facilitate my blogging workflow, I wanted to go from written to published post quickly. My general workflow for writing a post for this blog looks like this:

  1. Create a post in _posts
  2. Write the post
  3. Run fab sync

Here is the repo

fab sync is a custom command that uses the magic of Fabric to stage, commit and push changes in my blog repo to Github. Next, Fabric uses an ssh session in the Python process to connect to the server on which my blog is hosted, pull down the newest changes from the blog repo and finally, build the Jekyll blog so that the changes are immediately reflected on this site.

A nice part about Fabric is it requires relatively little code to accomplish a lot. It also integrates with the system ssh config so you don't need to supply server credentials in yet another place, you can just configure the Fabric env hosts.

Happy automating!

Discussion in the ATmosphere

Loading comments...