DjangoCon 2011 – Real world Django deployment using Chef

After another great lunch (I din’t blog about it this time) we’ll be starting off the afternoons with Noah Kantrowitz and his talk on “Real world Django deployment using Chef”

Chef, a configuration management tool, is increasingly popular in the Django community. Many people have yet to take the plunge, and are still managing production systems exclusively through tools like Fabric or Buildout. In this talk I will quickly show the basics of building Chef recipes, both in general and a tour of the Django-and-Python-specific tools available. I will then walk through a suite of cookbooks built to deploy Packaginator as a production site in the cloud. If suitable wireless is available, I would like to do a live demonstration at the end, bringing up a new site from scratch.

You can find the slides for this presentation at http://www.slideshare.net/coderanger/real-world-django-deployment-using-chef

Updates Below:

16.56

Deploying multiple apps to clusters is as simple as copying code and running twice (obviously changing paths)

16.56

Chef doesn’t really worry about migrations. General feel is that you should run migrations after the deployment

16.55

Code from the talk can be found at http://github.com/coderanger/djangocon2011

16.52

You can specify which servers you wan the code to execute on depending on it’s specific role.

16.51

database keyword allows you to specify your Django. It’ll also set up the Django settings.py file

16.45

Extremely easy to setup virtualenv, pip, django, supervisor, and gunicorn using pre-defined cookbooks

16.44

  • Cookbooks are collection of recipes
  • Environments are pegged cookbooks
  • Servers are Nodes
  • Data bags are JSON data

16.43

“Roles are a group of other Roles and Recipes”

16.42

You can extend recipes with Ruby.

16.42

Recipes can include other recipes
Included recipes are processed in order

16.41

“Recipes are collections of Resources”

Like manifests in Puppet

16.40

Resources take action through Providers

package "haproxy" {
yum install haproxy
apt-get install haproxy
...
}

Tries to find the optimal way to install on your given system

16.39

Resources all have:

  • Types
  • Names
  • Paramaters
  • Actions (enabled, start, install)
  • Can send notifications to other resources

16.37

How does Chef Work

  • Divided into Resources, Recipes and Roles
  • These are just text files that you can write in your own editor

16.35

n-Tier Infrastructure:

  • Provision Servers
  • Configure your Servers (Load Balancers, App Servers, DB Servers)
  • Integrate all of your servers

16.32

Infrastructure as Code: Building and managing infrastructure programmatically.

16.31

Noah taking the stage. Lets get this talk started.