by Akshar Raaj (@akshar-raaj) on Saturday, May 3, 2014

Vote on this proposal
Status: Confirmed & Scheduled
View session in schedule

Technical level


People attending this talk will leave with an understanding of continous deployment and continous deployment tools in general and Fabric in particular.

They will appreciate the usefulness of a continous deployment tool like Fabric. Essentially they will realise the time they save by using a single step build process. By the time they leave, they would have learned how to write a Fabric script which can automate deployment.


Expectation from attendees
  • Understands what it means to ssh to a production server.
  • Must have deployed a web application to production.
  • Basic understanding of Python.

Your time is precious and is best spent writing code. It should not be wasted on a production server doing the repetitive task again and again. And by repetitive task I mean fetching the code changes to server, installing the libraries, restarting the web server, restarting the proxy server and so on.

Code changes continously. And you need to deploy the code to production every day, possibly you want to deploy with every code push. And sshing to the server everytime you want to deploy, and doing the repetitive tasks is a waste of time and energy.

So, deployment of code should be automated. Joel's test has a requirement that build should be a one step process.

Fabric is a command-line tool for streamlining the use of SSH for application deployment (taken from docs).

We will write a basic web application using Python. This application will serve few urls, it will depend on certain third party libraries which are installble from PyPI. We will use gunicorn as the web server and nginx as the reverse proxy.

Everytime we want to deploy we need to do the following:

  • cd to required directory.
  • Fetch the code from the repository and checkout to master. (We will use github)
  • Activate the virtual environment.
  • Install the requirements i.e the third party libraries on which the application depends.
  • Kill existing gunicorn process.
  • Start a new gunicorn process.
  • Restart nginx.

We will ssh to a server and will deploy the code there. We will perform the steps mentioned above. You will notice the time it takes and pain involved in performing those steps manually. And then we will write a Fabric script which can automate these steps for us, which will be much faster than the previous approach where we manually had to do every step involved in build.


  • We need a web application for this workshop. We will use Python to write our web application. So, you must know the basics of Python.

  • Every person attending the workshop would not be aware about the same Python web framework, so we can't use a framework for the web application. Our web application will only use standard Python library. Our web application will be WSGI compliant, and we will use Gunicorn which is WSGI compliant too. Read this to get a basic idea of WSGI.

  • Gunicorn is a wsgi server. Read about gunicorn here.

  • You need a deployment server to gain a first hand experience of deployment. I have an ec2 server, and suggest you to have a server too.

  • Make sure you have port 8000 and 8001 open on your server.

    • We will finally make port 8001 non-public. But in the initial stages it might help with debugging.
  • Have the following things installed on your development machine as well as on deployment server.

    • virtualenv
    • nginx
    • git-core
  • Make sure your server public key is added on github, so you would be able to pull from github.

  • I have created the web application which we will use throughout this workshop. Check it here.

Speaker bio

I am a web developer at Agiliq. I primarily work with Python, Django and the related technology stack. I help people by writing open source code, blog, and by answering questions on Stack Overflow.


  • 1
    [-] Sreekandh Balakrishnan (@gnuyoga) 2 years ago

    Its a interesting topic to be covered for this conference. Am curious to see if we can do a Workshop around this and a Crips talk ( 15 mins ) during the conference.

    • 1
      [-] Akshar Raaj (@akshar-raaj) 2 years ago

      Yes, doing a workshop around it would be interesting too. In case we do a workshop, do you suggest adding few more tools apart from fabric, because I believe we will have to plan for 3 hours in such case. eg: We can talk about travis, which is a continous integration tool, which I always use in my workflow. I can talk about supervisor, which I find useful too. Please suggest anything else you want to include.

      I think doing a crisp talk would be a little difficult. I want to first demonstrate the pain involved in explicitly executing all steps involved in deployment and then want to show how fabric minimizes that pain. I want the attendees to learn how to write fabric script too. 15 mins seem a little less to cover all these.
      But I am open to do it as a crisp talk in case it's difficult to get a slot for full talk. Please provide suggestion.

  • 1
    [-] Anant Shrivastava (@anantshri) 2 years ago

    @akshar can you also list out if there would be any specific module required to be installed for just the standard python installation on linux or activepython setup on windows would be enough for this workshop.

    • 1
      [-] Akshar Raaj (@akshar-raaj) 2 years ago

      You should have pip, nginx and virtualenv installed on your machine. Apart from that, we would do everything inside a virtual environment, so you'll have to install gunicorn and any other library we want inside the environment while we are going through the workshop.
      In case you don't want to install things in your environment and have it ready before coming to the workshop, you can have gunicorn and requests installed on your machine.

Login with Twitter or Google to leave a comment