2008/02/14

Easy testing of new deployments against a live production database

Your client AcmeCorp has a Plone website happily running in production. Being existed by all the cool features and positive response from the site visitors, the client is thirsty for more.

So you agree to build three new features and kill a handful of bugs. After a week of hard work and testing in your development environment you feel like ready to rock'n roll.

So what do you do?
  1. Being eager to harvest the fruits of your hard work and to move on, you deploy directly to the production server. Hey, if it works in my development environment, it probably will do the same on the live server. If stuff goes wrong or the AcmeCorp is unhappy, I can just fix it and redeploy. Or...
  2. AcmeCorp is an important client and you don't want to end up with eggs on you face. So you play it safe, copy the production database to a staging environment and test your changes properly. After you and AcmeCrop have tested the new package on the staging server, you deploy.
Now, you've got a third option. You can both play it safe and be kind-of-lazy at the same time.

Zope Godfather Jim Fulton has released two new packages that let you test on a staging server against a live, running production Zope Database (ZODB) without affecting it at all. All changes you make ends up in a separate, possible temporary database. It works with ZEO, meaning you can have your staging environment on a different physical server than the production environment.

No need to copy larges Data.fs files over the wire anymore.

The packages are:
  • zc.beforestorage: Makes it possible to open a read-only connection to a ZODB database at a particular point in time. Gives you access to the production database without changing it.
  • zc.demostorage2: Makes it possible to use a read-only database as "base" and store changes in a separate database.
I have only played a bit with the packages. A few observations:
  • zc.beforestorage doesn't seem to work with the demostorage that comes with ZODB by default. You'll need zc.demostorage2.
  • You need at least ZODB 3.8 to work with zc.demostorage2. Have a look at plone.app.blob buildouts for a way to upgrade ZODB.

No comments: