This post series is meant to be a summary of what openstack is, and how it can be used as a tool to increase productivity.

The context, or reason, for why I’m writing these posts is that I recently built a small internal OpenStack cloud for use in the Planet Labs office. This is the first job I’ve had that isn’t all about the cloud, and it turns out that most people in the world still do not understand how to leverage the cloud in their day-to-day workflows. So it is my goal to help everyone in the office, as well as anyone who stumbles across this blog series.

What is OpenStack?

OpenStack is an open source implementation of Infrastructure as a Service (IaaS). This basically means that you have a few physical hardware servers, which can virtualize several virtual servers. There are a few main components: Compute, Network, Storage, and an Object Store.

What does ‘compute’ mean?

By compute I basically mean hardware virtualization/virtual machines.

When people hear virtual machine they usually think about things like virtual box, or VMWare Fusion. These are common consumer/desktop virtualization applications which behave similarly to how OpenStack works behind the scenes. When you create a virtual machine using one of these applications you are using a component called the Hypervisor.

A hypervisor is a piece of software that runs on a host (a host is a physical hardware server), and launches + monitors + maintains several guests (a guest (a.k.a instance) is a virtual machine that runs inside of the host).

A few of the most common hypervisors are Xen, KVM, and ESXi. Xen is used by most large public cloud providers such as Amazon EC2, Rackspace Cloud, HP Cloud, many others. KVM is used more in startups, devshops, and smaller companies as it is free and open source. ESXi is actually what is used when you use a VMWare-based virutalization application like VMWare Fusion.

What does ‘network’ mean?

By compute I mean software defined networking. In OpenStack this component is called Neutron, and it allows you to virtualize complex networking architecture on a simple flat network. This can be useful for when you are trying to replicate what a physical hardware network looks like in a real datacenter, in the cloud.

[insert example here – note: I suck at networking]

What does ‘storage’ mean?

By storage I mean block storage. Block storage is commonly used on instances which need to maintain portable data for long periods of time. For example if I launch an instance, make a bunch of changes, save the data to a block storage device, I should be able to unmount the block storage device from inside the instance, and attach it to any new instance in the future.

The interface, or how you use block storage, is basically identical to what it looks like to mount and write to a USB Flash Drive.

What is an ‘object store’?

An object store is basically an ever-growing bucket of files. Typically when using an object store you can upload millions of keys (aka files) to a single bucket. Each key is replicated across several servers, for redundancy, and you can be assured that your data will be both available, and safe in the event of hardware failure.

In OpenStack this is called ‘Cinder’. You also may have heard of Amazon’s S3 service.

To my knowledge the most frequent way of deploying OpenStack’s Horizon django application is via apache, and modwsgi. I think this is primarily because in the early days of devstack the community decided that apache was (at the time) the most common web server.

But now it’s 2013, and things have changed. NGINX is the new hottness, and gunicorn has been replaced with uWSGI for speed and reliability.

Since I didn’t have any specific Horizon instructions, I would like to share some of the configuration I used recently to deploy Horizon using NGINX and uWSGI.

The operating system I used was Ubuntu 13.04 (raring), with the addition of Ubuntu’s cloud archive apt repositories.

Install Dependencies

# Remove the backslash, my websites markdown parser is broken
sudo echo "deb http:\//ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/grizzly main" | tee -a /etc/apt/sources.list.d/ubuntu-cloud-archive-grizzly

sudo apt-get update
sudo apt-get install -y build-essential python-dev python-pip nginx-extras memcached node-less openstack-dashboard

sudo update-rc.d -f  apache2 remove # Disable apache

sudo pip install uwsgi

/etc/nginx/sites-enabled/horizon.conf

server {
    listen 80;
    server_name openstack.foo.com;

    location / { try_files $uri @horizon; }
    location @horizon {
        include uwsgi_params;
        uwsgi_pass unix:/tmp/horizon.sock;
    }
    location /static {
      alias /usr/share/openstack-dashboard/static/;
    }
}

/etc/uwsgi/horizon.ini

[uwsgi]
master = true
processes = 10
threads = 2
chmod-socket = 666

socket = /tmp/horizon.sock
pidfile = /tmp/horizon.pid
log-syslog = '[horizon]'

chdir = /usr/share/openstack-dashboard/
env = DJANGO_SETTINGS_MODULE=openstack_dashboard.settings
module = django.core.handlers.wsgi:WSGIHandler()

/etc/init/horizon.conf

description "OpenStack Horizon App"

start on runlevel [2345]
stop on runlevel [!2345]

respawn

exec uwsgi --ini /etc/uwsgi/horizon.ini

Then you can control horizon via upstart:

sudo service horizon start
sudo service horizon stop
sudo service horizon restart