Skip to content

Deployment

ches edited this page Oct 21, 2011 · 1 revision

Deploying the app should be as easy as fab production deploy, but there are a few quirky implementation details you should be aware of.

Here's the most important thing to know right now: the master git branch on GitHub will be automatically deployed. Consider master the production release branch and only push there if you really mean it!

This is because, for now, Chef is handling the deployment -- it has a built-in deployment function borrowed from Capistrano that is a lot nicer than the hand-rolled Fabric tasks people tend to use in the Python world. This may be changed eventually because it has a few shortcomings (rollbacks are troublesome), but it's more work. It does not require you to have Chef installed on your workstation to deploy, you'll still use Fabric.

Chef normally works by running periodically to see if there's anything it needs to do, so that's what makes it a little quirky as a deployment tool -- it needs to somehow be told if it should deploy the Django app. The most straightforward way is to have it to look at a git branch and take action if there are new revisions that it hasn't seen before.

Of course you don't really want to wait around for Chef to run on its own when you're ready to deploy new code and make sure that everything is working. So, run fab production deploy after you push new code, and it will go tell Chef to run immediately and show you the output.

This system is perfectly workable, just as long as everyone is aware of the "automatic" deployment of master. Some team members have started to use git-flow and this fits into the git-flow model perfectly: it prescribes that master is production-ready at all times, and the 'develop' branch is instead the "development mainline" that active work is based from that may not be extensively tested yet. Everyone is encouraged to adopt git-flow for this project -- it doesn't make much sense for some to use it and others not. The original blog post explains the idea well, with great diagrams.

Please let me know if you have any trouble deploying! Migrations are supposed to run automatically but there's a problem with it right now -- I'll figure that out but until then there's a fab production deploy.migrate task you can run manually as a second deploy step if needed.

Clone this wiki locally