I’ve got a buildout with django + wsgi that’s working nicely on dev and production. The only issue is that when I make a change or addition to the buildout.cfg and have to run bin/buildout, the website goes offline from the time buildout starts till the time it finishes. This can take upwards of 5 minutes.
Is there a way to run buildout gracefully in production? Maybe a parameter I’m unaware of that will run the buildout without uninstalling everything first? This site is running on one web server. A load balancer and extra web server would be a nice fix, but not feasible at this point.
Any other comments/suggestions/criticism on my buildout script are welcome.
Thanks!
Here’s my buildout.cfg:
[buildout]
download-cache = downloads
unzip = true
parts =
scripts
django
djangoprod
eggs =
${scripts:eggs}
${pipscripts:eggs}
[scripts]
recipe = zc.recipe.egg
unzip = true
download-cache = ${buildout:download-cache}
eggs =
ipython
docutils
feedparser
pygments
South
django-grappelli
django-extensions
django-mobile
django-photologue
django-filebrowser
django-indexer
django-paging
django-templatetag-sugar
django-sentry
MySQL-python
find-links =
http://dist.repoze.org/
http://github.com/
http://bitbucket.org/
http://googlecode.com/
http://surfnet.dl.sourceforge.net/
[pipscripts]
recipe = gp.recipe.pip
unzip = true
download-cache = ${buildout:download-cache}
editables =
hg+https://bitbucket.org/ubernostrum/django-registration#egg=django_registration
git://github.com/jtauber/django-mailer.git#egg=django_mailer
eggs =
django-registration
django-mailer
PIL
install =
http://effbot.org/downloads/Imaging-1.1.7.tar.gz
[django]
recipe = djangorecipe
download-cache = ${buildout:download-cache}
eggs = ${buildout:eggs}
version = 1.3
project = project
[djangoprod]
recipe = djangorecipe
download-cache = ${django:download-cache}
version = ${django:version}
settings = production
wsgi = true
eggs = ${django:eggs}
project = ${django:project}
Buildout will only update parts where the configuration has changed (or in case of a stupid recipe implementation). One option is to copy/checkout the buildout configuration into a new location re-run buildout and then stop the old instance and then restart the instance on the new installation. In some case we maintain installations like
where ‘current’ is a symlink to the current ‘buildout_’ installation.
And of course: running multiple instances behind a load-balancer where you take down an instance out of the balancer during the buildout phase is an option.