Posts

Showing posts from March, 2018

Deploy Python Application with Gunicorn and Supervisor on Ubuntu

Suppose we have to deploy 3 python applications on a Ubuntu server. The applications and their python versions are as follows: 1. Analytics application (analytics.example.com): python2 2. Android API (android.example.com): python3.5 3. Auth API (auth.example.com): python3.6 What will be the solution? How can we run 3 different python applications on 3 different python versions on same machine? Here is a simple solution to achieve this goal. I'm assuming you know about python virtual environments and wsgi. If not Google will help you on this. The following steps should work with most of Ubuntu versions. Here are our plans to achieve our goal: 1. We'll create 3 separate virtual environment to run these applications 2. We'll use gunicorn inside these virtual environments to run these applications on 3 different ports e.g. 8001, 8002, 8003 3. We'll use supervisor to start, stop and monitor these 3 applications running on gunicorn Lets assume we've the co