Django Hosting

Post on 23-Jan-2015

377 views 2 download

description

 

Transcript of Django Hosting

Deploying Django Apps

Discovering Your ApproachDerek Stegelman 2013

Boulder Django

Our To-dos

Who am I?

The problem

Solutions

Story Telling Time/Deploying is more than a server

Discussion

Who am ISoftware Developer at Five Q

Previously at Kansas State University

Developed and maintained several > 10,000 user applications (all Python/Django)

New to the Front Range

https://github.com/dstegelman

Self taught; Business/MIS Background

Django Hosting ???

I wrote this app...now what?

The ProblemHosting a Django app is hard!

Significant learning curve for new developers from the PHP, other web worlds

Too many options (uWSGI, mod_wsgi, Gunicorn)

No clear path on where to begin.

Significant deterrent to growing the Python/Django community.

Solution(s)

Roll your own (AWS, Rackspace, Datacenter)

Story Time

Middle Managed (Webfaction, etc)

Managed (Heroku, Gondor, etc)

Ultimately use what’s best for you and your situation. (Time, Money, Headaches..)

Roll Your OwnNot that difficult

Large learning curve, but maximum control

Best suited for Enterprise or large scale business environments

Often requires a SysAdmin to work properly

Cheap and getting cheaper

A Deployment StoryMore than just hardware

With a happy ending..

Where we startedSingle web/database server

Mercurial copy and update to deploy or, umm FTP??? FTW?!

Sys Admins had to manually “kick” apache

No migrations or collect static

Very unstable deployments.

Not all that uncommon

Oh, the server broke. Let me debug that.

Inefficient use of developer’s time.

Difficult, painful, and scary deployments

Database changes were even more painful

Django deployment was immature

How to Fix?? Bring in an Expert.

Solution(s)

Evaluated Managed options (Heroku, Webfaction etc)

Too Expensive for our scale (and budget)

Did not have expertise to build the system ourselves

Hired an expert on Django

Where we wentFully automated environment with Chef

Fabric controlled, repeatable deployments

Centralized infrastructure control (Chef/Ops Code)

Inherited Fabric files and configurations (Repeatability across projects)

Bundle infrastructure into your applications (Version Control All the Things)

Version control ALL THE THINGS

Optimize Happiness

New stack optimized for developer happiness

Scratch your own itch

All but eliminated deployment headaches

Instituted a semi formal standards system through trial and error

Happy ending

Middle Managed

Example: Webfaction

Entire box is managed, but you are left largely to your own devices for details

Good solution for DIYs

A good middle ground.

Fully Managed

Heroku/Gondor

Their way or the highway

Great for prototyping/feature branches

Limited customization

Easiest to start with

Friend for new developers!!

Start Ups!

What should you do?

Evaluate your needs and how many headaches you can stand

Evaluate your staffing needs/expertise and planned scale

Roll Your Own takes a significant amount of expertise. Don’t underestimate it.

Tools

Many tools exist to make deployment and automated tasks easier.

Fabric

Capistrano/Fabistrano

Chef/Salt

Just use something!

Fabric

Please, please use fabric. (Or another similar tool)

Codified, version controlled deployment mechanisms that can be distributed FTW!

When you make a change to your workflow, codify it.

AUTOMATE!

Fabric Examples

Shameless plug

Hadrian https://github.com/dstegelman/hadrian/blob/master/hadrian/conf/fab.py

https://github.com/jacobian/django-deployment-workshop/blob/master/fabfile.py

Lessons to Live By

AUTOMATE EVERYTHING

Version Control and codify your processes

Don’t live with broken windows

Deployment is really important, invest in it!

Choose the provider and solution that fits your team and specific needs

Questions?Comments?

Thanks!

github.com/dstegelmantwitter.com/

derekstegelmanderek@stegelman.com