Buildout development/production strategy
Buildout is great for development and for deployment. How to combine the two? Jean-Paul Ladage and me did some brainstorming on this and we'll show you what we came up with. I'm trying it now on a project and I'm pretty happy with it. Some prerequisites and assumptions:
- Configuration is handled by buildout.
- It shouldn't get in the way of easy development.
- Deployment should be rigorous.
Production/preview are tags
Production and preview must be tagged buildouts. If preview is signed off on, it becomes the new production. In that case an "svn switch" to the relevant tag is done in the production buildout.
Variable bits
Production, preview and development differ in the port settings, zeo settings, debug mode, etcetera.
Production and preview do not differ in products, as a tagged buildout should progress from preview to production without changing. Production/preview and development do differ in products, naturally.
The following five buildout config files are needed to handle this:
- production.cfg with production port number, zeo setup, etc.
- preview.cfg with preview port number, zeo setup, etc.
- stable.cfg with the products and eggs and zcml used by both preview.cfg and production.cfg.
- unstable.cfg with the development products
- devel.cfg with both development port number (just 8080 normally), debug mode.
unstable.cfg and devel.cfg could be combined, but experience has shown that it is harder that way to spot what you have to move from development to production. The extra hassle just isn't worth the worry about the extra file.
This way, with some care, a single buildout directory can be used for all three cases. It makes it easier to coordinate the move from development to production.
Externals
Externals in the form of downloadable tarballs and eggs are handled like a charm by buildout. No problems there. Problem cases are:
- Products you develop yourself (svn trunk, mostly).
- Products without a proper release from an external svn.
Handling svn externals in a buildout that is used for both production, preview and development is a pain. Keeping the svn checkout information inside buildout (with the infrae.subversion recipe) is the solution here. You'll need two infrae.subversion sections in case you have both products and eggs under development.
Note that we're talking "products" here. Keep the lib/python stuff as externals in src/* as they don't interfere if you don't enable them. I couldn't get those to work with infrae.subversion (chicken/egg problem as you can't reference those eggs in [buildout] if you still have to download them from the same section).


svn switch question
Just a quick question re. your svn switch comment (call me dumb :) - so do you tag the same svn location that contains the buildout files or do you have the preview/production buildout .cfgs in different svn locations?
Thanks,
Tim Knapp