I can't say it often enough: I abhor doing even the simplest tasks manually if I know, that a machine could do it better. One of these things is installing Plone instances. While the underlying Zope does come with a script called mkzopeinstance.py it still leaves you with lots of manual steps, especially if you want to create a ZEO based setup (which I always do these days.)
Well, today was the straw that broke the proverbial camel's back and I hacked together the following shell script. The main idea behind it was to use a zope.conf file that consists 100% of reusable boilerplate code, so I wouldn't have to deal with any kind of templating mess in order to insert the particular values for a given instance (i.e. port number, debug mode). This is realized by making the config file include another file which in turn simply consists of key/value pairs. This file is generated by the shell script which also takes care of creating the actual ZEO and Zope instances and copying the Plone Products into the freshly created Products folder.
And while we're at it, it also creates a convenience script control.sh that passes any parameter you throw at it on to zeoctl and zopectl (in that order), i.e. 'start' or 'stop'.
#!/bin/sh
# creates a Zope/ZEO combo-instance and installs a version of Plone for it
# written by Tom Lazar, 2005-10-15,
# see http://tomster.org/blog/archive/2005/10/16/instant-plone/ for details
# licensed under BSD licence (do what you want, but don't sue me)
BASEDIR=/opt/zope
ZOPEDIR=$BASEDIR/Zope282
PLONEDIR=$BASEDIR/setup/Plone/Plone-2.1.1
DEBUG=off
INSTANCE=$1; PORTBASE=$2; ZEOPORT=$3; PASSWD=$4;
if [$PASSWD eq ''];
then echo "usage: instaPlone.sh instancename port-base zeoport passwd";
exit ;
fi
echo 'creating Zope instance'
INSTANCEDIR=$BASEDIR/instances/$INSTANCE
mkdir -p $INSTANCEDIR/zeo
mkdir $INSTANCEDIR/zope
$ZOPEDIR/bin/mkzeoinstance.py $INSTANCEDIR/zeo $ZEOPORT
$ZOPEDIR/bin/mkzopeinstance.py -d $INSTANCEDIR/zope -u admin:$PASSWD
echo "creating zope.conf:"
cp ./zope.conf $INSTANCEDIR/zope/etc/
DEFINES=$INSTANCEDIR/zope/etc/defines.conf
echo "%define INSTANCE $INSTANCEDIR/zope" > $DEFINES
echo "%define ZOPE $ZOPEDIR" >> $DEFINES
echo "%define PORTBASE $PORTBASE " >> $DEFINES
echo "%define ZEOPORT $ZEOPORT" >> $DEFINES
echo "%define DEBUG $DEBUG" >> $DEFINES
echo "installing Plone:"
cp -Rp $PLONEDIR/* $INSTANCEDIR/zope/Products/
echo "creating control script"
CONTROL=$INSTANCEDIR/control.sh
echo "#!/bin/sh" > $CONTROL
echo "$INSTANCEDIR/zeo/bin/zeoctl \$1" >> $CONTROL
echo "$INSTANCEDIR/zope/bin/zopectl \$1" >> $CONTROL
chmod a+x $CONTROL
echo "Done. Start your new instance by calling '$CONTROL start'."
exit ;
You can download the shell script here. You will also need the boilerplate zope.conf template (just save it into the same directory you placed the shellscript).
Update: As it's a shell script, this method won't work on Windows, sorry! (Unless you're using CygWin...)
Update2: Uhm, yeah, ok... it's not entirely instant. You'll still have to log into your new Zope instance and add a Plone instance via the ZMI. But not even I am going to automate that last step ;-)