Django Hosting

21
Deploying Django Apps Discovering Your Approach Derek Stegelman 2013 Boulder Django

description

 

Transcript of Django Hosting

Page 1: Django Hosting

Deploying Django Apps

Discovering Your ApproachDerek Stegelman 2013

Boulder Django

Page 2: Django Hosting

Our To-dos

Who am I?

The problem

Solutions

Story Telling Time/Deploying is more than a server

Discussion

Page 3: Django Hosting

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

Page 4: Django Hosting

Django Hosting ???

I wrote this app...now what?

Page 5: Django Hosting

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.

Page 6: Django Hosting

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..)

Page 7: Django Hosting

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

Page 8: Django Hosting

A Deployment StoryMore than just hardware

With a happy ending..

Page 9: Django Hosting

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

Page 10: Django Hosting

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.

Page 11: Django Hosting

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

Page 12: Django Hosting

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

Page 13: Django Hosting

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

Page 14: Django Hosting

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.

Page 15: Django Hosting

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!

Page 16: Django Hosting

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.

Page 17: Django Hosting

Tools

Many tools exist to make deployment and automated tasks easier.

Fabric

Capistrano/Fabistrano

Chef/Salt

Just use something!

Page 18: Django Hosting

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!

Page 19: Django Hosting

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

Page 20: Django Hosting

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

Page 21: Django Hosting

Questions?Comments?

Thanks!

github.com/dstegelmantwitter.com/

[email protected]