Deploy Django with NginX, Gunicorn, PostgreSQL, virtualenv

Step 0 – Update and upgrade

We are using Ubuntu 16.04 LTS for this tutorial
ubuntu version
apt-get update update the list of available packages and their versions, but it does not install or upgrade any packages. apt-get upgrade actually installs newer versions of the packages you have. After updating the lists, the package manager knows about available updates for the software you have installed.
$ sudo apt-get update
$ sudo apt-get upgrade

Continue reading “Deploy Django with NginX, Gunicorn, PostgreSQL, virtualenv”

Deploy Django using Docker Compose


Related posts

With the adaptation of micro-service architecture i.e. various components as independent services, docker community came up with docker-compose (previously FIg). Using a single (YAML) configuration file (docker-compose.yml) to specify all the components, which docker compose build and spawn as independent services i.e. docker containers.
Use-case: You have a web project, with web application developed using Django, using a Postgres database, redis as caching engine, and NginX for serving over the web. Using docker-compose you can deploy this stack with a single command:
docker-compose build --no-cache && docker-compose up
The complete project is available here.

This blog post is about using docker compose, for deploying your Django application with Postgres, Redis, and Nginx. It is presumed, you already have your Django project, and want to deploy your full stack.

High level steps

  1. Install and start Docker compose
  2. Setup project – presume you already have a Django project.
  3. Create Dockerfile(s) and docker-compose.yml
  4. Build service images – docker-compose build
  5. Create database and database migrations – docker-compose run web python manage.py migrate
  6. Start services containers – docker-compose up
  7. View in browser http://127.0.0.1

Continue reading “Deploy Django using Docker Compose”

OpenStack all-in-one setup on CentOS

OpenStack is an open-source cloud operating system for setting up IAAS (infrastructure as a service). OpenStack provides a flexible solution for both public and private clouds, covering the two important requirements i.e. cloud must be simple to implement and massively scalable. For production a minimal OpenStack setup requires at-least 2 separate machine, one controller and one compute node. To get started with OpenStack, a common practice is to setup an all-in-one deployment i.e. using a single machine.
This guide is about setting-up an all-in-one setup for OpenStack Queens, the latest release.

Continue reading “OpenStack all-in-one setup on CentOS”

Configure static IP address on CentOS

After a fresh installation CentOS uses DHCP (dhclient -v) to assign an IP to the machine, which keep in changing on reboots, or service restarts, etc.

Use-case: Various service setups, especially involving a clustered configuration we need to set a fixed IP for each machine, so they can communication with each other, in case of DHCP the installation may break on the reboot, as anyone of the machine gets a new IP address. So the first step is to set a static IP address. Continue reading “Configure static IP address on CentOS”