Currently I’m using a lot of different bash-scripts for managing zope
instances.
I was planning to try out InstanceManager (IM) since Reinout’s first post in may 2006,
but it took me until today to have a look at it.
Warm up
I read the documentation on the product page,
Reinout’s first post and another post describing some new features
that really made me excited about trying out IM.
So i immediately checked out svn trunk skimmed through README.txt and INSTALL.txt
and created my first IM-managed instance.
Expectations
There are some expectations i have and certain scenarios IM
has to support to make me forget my old setup and make me use
IM daily instead.
IM has the backup and restore options. Probably they
do very much the same as my bash wrapper scripts for repozo
i’m currently using.
Since some of our projects are running on the same instance
using differnt databases and IM seems to assume one instance per project
i’m interested if i can find a way to backup them properly.
Collaboration IM could potentially support collaborative work of different
developers on a certain product.
One can define the Product versions used for this project in the
project configuration file.
Other developers simply check out this config file
and create an identical instance for developing and testing on their
machine. Development looks like IM can speed up development a little.
it can update products, [replace the modified database if a default one],
restart zope and optionally quickinstall some products you defined
the configuration Zeo and Multi-Database support
Our current instances are using zeos and have differnt databases mounted
into main database.
Additionally one ZEO might be used by multiple zope instances.
Let’s see if I can get IM working for out setup.
Evaluation
Talked enough, let’s get our hands dirty on InstanceManager.
Create a Instance
Installing IM is well documented in INSTALL.txt and works like a charm.
It takes some time to find your way in the master configuration file
~/.instancemanager/userdefaults.py and the derived project configuration
file (~/.instancemanager/plone25.py in this example)
However, all settings are well documented – you just need to read a lot at
the beginning.
Backups
instancemanager –backup plone25 creates an incremental
backup of the database to the backup_basedir_template set in
your configuration. if the database has been packed (instancemanager –pack)
in the meantime, a full backup will be created.
(you can create full backups by invoking instancemanager –repozo=full plone25)
As assumed in the beginning, IM acts as a handy wrapper around repozo
similar to the bash wrapper scripts for repozo i use by now.
You can use these actions for your backups by invoking them in a
cronjob (a pack every weekend, and a daily incremental backup).
Restoring backups is damn easy, too: just use the restore action
to get back to the state of the last backup.
you can even choose to restore the database state of a certain
date and time.
restoring a database will stop the zope and zeo server and restore the database
(you have to start zeo and zope again after that):
frisi@frisi:~/instances> instancemanager --restore-date=2007-01-01-21-10-43 plone25 INFO zope: stop on port 8102. daemon process stopped INFO zeo: stop on port 8100. daemon process stopped INFO Restoring database file /home/frisi/instances/zeo/plone25/var/Data.fs from /home/frisi/instances/zeo/plone25-backup.
I don’t know yet if the transactions within the database are taken into account, or if repozo
is just taking the backup file that fits best, the only thing i tried was to provide the date
and time of the backup file in the format above and the backup file with the given filename
was chosen: 2007-01-01-21-10-43.deltafs was used although 2007-01-01-21-44-27.deltafs existed
in the backup directory.
Support for multiple databases
Neither the –backup nor the –repozo option help me to manage multiple projects (with
differnt databases) within one instance. IM really seems to have a “one instance per project”
policy. Creating a config file for every project that is using the same zopeconf_template and
zeoconf_template and the same sources for products etc. could be a solution, but requires to do
every change (eg when adding or removing a product) on all config files.
Probably i understood something wrong here, and there is a way to support
mutliple projects on one instances. If there is, please tell me!
Collaboration
To really exchange an instance (including products) with other developers,
it should not be necessary to have the product packages downloaded to the
same directories on the probably different machines.
the following only works if every developer has the plone2.5.1 bundle
in the directory /home/<developer>/download/plone:
archivebundle_sources = [{'source':'Plone-2.5.1-final.tar.gz',
'productname':'', # not relevant for bundles
'develop':False,
'droplist':('Five'), # drop Five from this bundle
},]
archivebundle_basedir_template = '%(user_dir)s/download/plone/'
If IM would support urls here, i could just exchange the
product configuration file and other developers could create exactly the same
instance on their machine.
I’ve had a short chat with reinout and he pointed out that there actually
is a – yet undocumented – way of doing this using
the ‘url’ key in archivebundle_sources. It should work somehow like this, but i did not get
it working in my testsetup:
archivebundle_sources = [{'source':'Plone-2.5.1-final.tar.gz',
'productname':'', # not relevant for bundles
'url':'http://surfnet.dl.sourceforge.net/sourceforge/plone/',
#download it from here, if source is not available in archivebundle_basedir_template
'develop':False,
'droplist':('Five'), # drop Five from this bundle
},]
Development
For the next Zope2 project i work on, I’ll use IM.
I’ll have to figure out a nice structure in svn to check in
configuration files in the repository.
The one button product update and quickinstall multiaction:
instancemanager fresh <projectname>
and the possibility to transfer databases from development to production instance:
instancemanager --repozo=sync <projectname>
will save a lot of time, i think.
There are handy actions for intermediate “I’m going to do something dangerous right now” backups:
instancemanager --repozo=snapshot and instancemanager --repozo=restoresnapshot
The testing facility will not completely replace the Makefiles I’m currently using
for product development. (see my TemplateProduct for more information)
svn browser does not work yet, but you should be able to check the product out:
svn co https://svn.lovelysystems.com/repos/public/lovely-products/TemplateProduct/trunk TemplateProduct
Zeo and Multi-Database support
Defining multiple mount points using instance manager is possible
in principle:
IM does support custom configuration files. I’m anxious whether
settings influencing zope.conf and zeo.conf such as port are completely
ignored when using zopeconf_template or zeoconf_template
and invoking instancemanager –upgradezope.
In the next days I’ll try to find a way to have different projects
using the same zope instance and report my findings in this blog.
Summary
I think most developers have their custom scripts (be it bash, python or whatever)
that help them to backup databases, setup instances or install certain python modules and so on…
With InstanceManager Reinout started an initiative that offers a documented and standardized
way to manage zope instances.
I’ll try to use IM in the future and try to contribute by writing feature requests, bug reports,
or also coding the functions i’m missing (if they make sense for other ppl too).
If other zope and plone developers do the same InstanceManager will even be more useful
in the future.
I’m planning to contribute for the support of multiple projects within one instance..
Lovely Systems: First look on InstanceManager
Originally from Planet Plone by