Sunday, 15 November 2015

Installation of OpenStack with Murano on Cloud (Digital Ocean)

As OpenStack and Murano's system prerequisites is high. (shown below)

System prerequisite for Murano:

Criteria Minimum Requirement
CPU 4 core @ 2.4 GHz
HDD 2 x 500 GB (7200 rpm)
RAID Software RAID-1 (use mdadm as it will improve read performance almost two times)

It might not be possible for everyone to have it on local system. Here is the solution for this problem. You can install OpenStack and Murano on cloud. Here I am using Digital Ocean cloud service.

Lets follow some simple and basic steps:

Step 1: First sign up Digital Ocean website. (If you already have it skip this step)

Add required information and credit card and you are done with account setup formality.

Step 2: Now create a Droplate (a virtual machine).

Creation of Droplet requires:

1. Provide a host name for your droplet.

2. Select the size for droplet. (Recommended size is 8GB RAM)

3. Now select the region in which droplet will be hosted.

4. Select image to be installed on droplet. Here select Ubuntu 14.04 image.

5. Add ssh key of your local system. To generate ssh key on ubuntu

$ ssh-keygen -t rsa

This command will prompt you to:
a. Select a file to store key. (Hit enter if you want to store key in /home/demo/.ssh/id_rsa file)
b. Enter passphrase. (Hit enter if you don't want)

Copy ssh key from /home/demo/.ssh/ file and enter it in the submission box.

6. Now hit "Create Drolet " button. Your Droplet is ready to use.

After successful creation of droplet, you will get public IP address of your droplet which will be used for login into droplet.

Step 3: Login into virtual machine via ssh
Open terminal of your local machine and run

$ ssh root@<IP address of droplet>

Now you are in virtual machine. Lets start installation of OpenStack.

Step 4: Installation of OpenStack via Devstack
DevStack is a set of scripts and utilities to quickly deploy an OpenStack cloud. So lets start with devstack.

a. Since you are using fresh new Ubuntu machine, first update and upgrade it.

$ apt-get update
$ apt-get upgrade

b. Install Git, since installation of devstack, will require cloning of repository.

$ apt-get install git

c. Clone Devstack repository that contains a script to install dev OpenStack. Clone it, where you want to reside your devstack.

$ git clone

now move into devstack directory.

$ cd devstack

d. Create stack user. Since you are logged in a system as root user, you need to create stack user to start installation. For it there is a script in devstack repo located in tools/ It will create stack user.

$ ./tools/

now provide ownership to the stack user.

$ chown -R stack:stack .

e. Now modify stackrc file to collect all the git repository via https protocol. For it open stackrc file and find GIT_BASE and alter it.

$ vim stackrc

Step 5. Now install murano as plugin for horizon
1. The contrib/devstack directory contains the files necessary to integrate Murano with Devstack.  Copy this integration scripts at their respective places.

a. First copy contrib/devstack/lib/murano file inside devstack/lib.
b. Copy contrib/devstack/lib/murano-dashboard file inside devstack/lib.
c. Copy contrib/devstack/extras.d/ file inside devstack/extras.d.

2. Now create a "localrc" file as input to devstack. This file contains all the necessary settings for murano. It starts Murano, Heat and Neutron services.

$ vim localrc

and paste following

# Enable Neutron

# Enable Heat
enable_service heat h-api h-api-cfn h-api-cw h-eng

# Enable Murano
enable_service murano murano-api murano-engine  

3. Change user from root to stack (newly created one).

$ su stack

4. Install devstack via running script.

$ ./

It will prompt you for passwords for various components of OpenStack. After successfully running script, it will provide end point for horizon service of OpenStack. Bu using this end point you can explore OpenStack services. Now you have successfully installed Openstack with murano.

Enjoy developing with OpenStack and Murano!

Sunday, 8 November 2015

Installation of Django in Virtual Environment

This post will lead you through successful installation of Django in Virtual Environment on Debian based system like Ubuntu. Here we will create virtual environment using most popular and recommended tool virtualenv and virtualwrapper.

What is Virtual Environment?
Virtual environment is a isolated Python environment that keeps python files in a isolation manner from system's python files and other virtual environment's python files.

Some important note about virtual environment: 
  • If you install any program using apt-get repository from virtual environment (created by virtualenv or virtualwrapper) then it will get install on whole system.
  • To install python package only inside virtual environment, use pip or easy_install like python package managers.

Why to install Django in virtual environment?
After installing Django you will create several projects using it. It may happen that your two projects have same dependency but requires different version. And on a particular system, you can have only single version of any file. Now what??
Solution is Virtual Environment. Python virtual environment solves this problem easily because virtual environment keeps the dependencies required by different projects in separate places. It keeps your global site-packages directory clean and manageable.

What is virtualenv?
Virtualenv is a tool to cretae isolated Python environments. virtualenv creates a folder which contains all the executables you installed inside the virtual environment.

Now, what is virtualwrapper?
virtualenvwrapper is just a wrapper utility around virtualenv that makes easy to deal with virtual environments. This post will cover working with virtualenv via virtualwrapper to provide ease.
virtualenvwrapper includes set of shell functions that are guaranteed to work in the following shells:
bash (Bourne again shell)
ksh (Korn shell)
zsh (Z shell)

Good news for windows lover, virtualwrapper also has window version that is virtual-wrapper-win.

Installation Procees 
1. Before any installation, it is a best practice to update our packages so run:

sudo apt-get update

2. We will install virtaulenv and virtualwrapper using pip (pyhton index package). Hence first you need to install pip. For it use following command:

sudo apt-get -y install python-pip

3. Install virtualenv:

pip install virtualenv

4. Install virtualwrapper:

pip install virtualenvwrapper

Now you have installed virtualenv and virtualwrapper tool. Now you need to do some congifugration setting. Lets walk through that.

Configuration of virtualwrapper

To use virtualwrapper, you need to add following two lines in your shell startup file, most probably .bash_profile or .bashrc. Lets do it. First open shell startup file using your faviourite editor and add:

export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/

The first line instructs virtualenvwrapper where to store the virtualenvs that will be created by you. Here we are storing it in a folder called .virtualenvs inside your home folder. The second line runs the shell script to set up the virtualenvwrapper commands. It should point to the location where virtualenvwrapper is installed.

Now you have done with installation and configuration process. Its time to play with it. Here are some basic commands, you need to create and manage virtual environments:
  • mkvirtualenv – It is used to create a new virtual environment. Created new environment automatically becomes the active environment. 
  • rmvirtualenv – It is used to remove an existing virtual environment. The environment must be deactivated (explained below) before it can be removed. 
  • workon – It is used to activate a virtual environment. Will also list all existing virtual environments if no argument is passed. 
  • deactivate - used to deactivate the currently active virtual environment. Note that workon will automatically deactivate the current environment before activating a new one.

Django In Virtual environment

1. Lets create virtual enviroment first. So run:
mkvirtualenv test

2. Now tou are in virtual environment. You can identify it by seeing test in round bracket at left side of your terminal. Now install Djnago:
pip install django

Now you have successfully installed Django in virtual environment. Thankyou for reading.