Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Ubuntu Natty -> Web Node installer
branch: master
Failed to load latest commit information.
etc Added a uwsgi config that doesn't quite work for some reason
shortcuts/uwsgi Whoops.
wwwroot Removed the old file. This isn't used anymore
.gitignore Initial version of my natty web server build script Fixed the wsgi script changed the install root to /opt/ which it should of been in the firs… Initial version of my natty web server build script Initial version of my natty web server build script

This build a base Ubuntu Natty system that has the following infrastructure:

  1. nginx - web
  2. supervisord - process management
  3. redis - persistent caching
  4. memcached - transient caching
  5. uwsgi - wsgi application server


  1. Start from a fresh Natty install
  2. Build a common starting point for a web service root
  3. Enable local deployment within a VM


As root run:

curl | bash

This will do the following:

  1. checkout the latest version of ubuntu-natty-web to /opt/ubuntu-natty-web
  2. Install base services and packages

Development pattern

Using this allows me to deploy a project quickly to a common starting point.


Your project must be developed external to this system and provide a build script that starts with the assumption of a null server state.

Let's create a script:

mkdir ~/project
cd ~/project
echo 'Hello, World!' > hello.txt
cat > << EOF
cp ~/project/hello.txt static/

This creates a new who's job is to create a static hello.txt file.

This script acts is a bootstrap to pull your project's resources into the server's null state. In this example, we are generating the resource but in practice the resources will be pulled in via a version control system

Deploying a project

Now that we have a usable script. we can create a new service using this project.

cd /opt/ubuntu-natty-web/

This creates a /var/www/servers/ directory.

By default the only thing a new service does is serve content out of it's static/ directory.

Let's deploy our project to this service

cd /var/www/servers/
bash ~/project/

Now restart nginx to pick up the new site's etc/nginx.conf file

sudo /etc/init.d/nginx restart

We will now be able to curl our hello.txt file

curl -H "Host:" http://localhost/hello.txt
# => Hello, World!

That's about it. You're responsible to set up DNS and Networking.

Platform shortcuts

Python / WSGI

Currently there is a shortcut for setting up a server for serving WSGI apps. In the the shortcuts/uwsgi directory there is a script that configures uwsgi and supervisord for running a wsgi app.

By default the uwsgi shortcut configures uwsgi to set the PWD to code/app. This enables you to create simple single module services with little effort using your microframework of choice.

More complex projects should use virtualenv and python deployment tools to install your project or derive a shortcut from the built in uwsgi shortcut. For instance, one such shortcut could be a Django shortcut, Pyramid, or other framework.

Installing the uwsgi shortcut

To install the uwsgi shortcut, do the following:

cd /opt/ubuntu-natty-web/shortcuts/uwsgi
./ hello hello:application

This creates the neccessary configuration for a WSGI service called "hello" that exists as the python module hello.application.

Let's modify our hello project to be a WSGI application called hello.application that dynamically says "Hello, World!":

cd ~/project
mkdir -p code/app/
cat > code/app/ << EOF
def application(enivron, start_response):
      start_response("200 OK", [("Content-Type", "text/plain")])
      return ["Hello, World!"]
# Rewrite our      
cat > << EOF
cp -R ~/project/code/app/ ./code/app/

Now let's deploy our WSGI app:

cd /var/www/servers/
bash ~/project/

Update supervisord to pick up the new configuration:

supervisorctl update

Now we should have a running service:

curl -H "Host:" http://localhost/
# => Hello, World!

The uwsgi shortcut reroutes the static content to /static/

Something went wrong with that request. Please try again.