Multiple Plone sites per zope instance - using separate Data.fs files for each one.
Introduction
It is possible to run multiple Plone sites within a single Zope instance while keeping each Plone site in its own Data.fs file. Having the sites in their own Data.fs file allows you to easily backup, delete, or relocate individual Plone sites even when you are running multiple sites in the same instance. This can be accomplished using ZODB Mount Points.
To create a new ZODB Mount Point in your site, follow these steps:
1) Create a new directory for the Data.fs file that will contain the mount point.
For example, if your root Data.fs file is stored at $INSTANCE/var/filestorage, create a directory called: $INSTANCE/var/filestorage/site1. Setting up your filesystem structure this way mimics the way that the folders will be structured in Zope.
2) Edit your zope.conf file
If you are not using buildout, you can simply edit your zope.comf file to make the changes. In zope.conf, the main Data.fs storage is defined by:
<zodb_db main> # Main FileStorage database <filestorage> path $INSTANCE/var/Data.fs </filestorage> mount-point / </zodb_db>
Add another section below this like:
<zodb_db site1> # FileStorage for site1 <filestorage> path $INSTANCE/var/site1/Data.fs </filestorage> mount-point /site1 </zodb_db>
If you are using buildout, you will want to edit your buildout.cfg file so that these lines will be added to your zope.conf file when buildout is run. Add the following lines to the section of your buildout.cfg that creates the instance. (This section is typically called [instance].)
zope-conf-additional = <zodb_db site1>
<filestorage>
path ${buildout:directory}/var/filestorage/site1/Data.fs
</filestorage>
mount-point /site1
</zodb_db>
Whether you are using buildout or not, the changes being made to zope.conf are the same. You are declaring a new ZODB enclosed between the tags <zodb_db {db name}> and </zodb_db>. The place where the Data.fs file is stored is declared by the "path" directive. The "mount-point" directive tells Zope what the name of the mount point will be.
Setting this up with Zeo is a bit more complicated and is described after these steps.
3) Restart your Zope instance.
Restarting zope will establish a new the file Data.fs in the site1 directory and make the mount point "/site1" available under the zope structure.
However, the new mount point "/site1", is not yet usable.
4) Use the zope management interface to enable the mount point.
The next step is to go to the Zope management page (not Plone's ZMI), and go to the Root Folder. In the "Add" pull down menu near the bottom, find the "ZODB Mount Point" entry and choose it. The "/site1" entry added above should be there, but not yet enabled. Select the new mount point via the check box, and click on "Create Selected Mount Points" After doing this, the new mount point should appear in the Root Folder as a subfolder.
5) Create the Plone site inside the new subfolder.
Click on the new subfolder "/site" and go inside. Once there, use the pull down "Add" menu and choose the "Plone Site" entry. Create a Plone site as usual and you are on your way. The site will be contained in the distinct "Data.fs" file in the site1 folder.
Zeo Setup
This section covers the changes that must be made to your buildout.cfg if you want to create ZODB Mount Points using Zeo. The instructions below replace Step 2 above. All other steps should be followed as normal. In the examples below, the section used to build the Zeo server is called [zeoserver] and the section used to build the zope instance is called [primary].
First, add the following lines to the section that builds the Zeo server:
zeo-conf-additional =
<filestorage site1storage>
path ${buildout:directory}/var/filestorage/site1/Data.fs
</filestorage>
This looks similar to what we created above but, in this case, all we need to do is tell Zeo the location of the file. We also need to add some lines to the section of buildout.cfg that builds the instance.
zope-conf-additional=
<zodb_db site1>
cache-size 5000
<zeoclient>
server ${zeoserver:zeo-address}
storage site1storage
name zeostorage
var ${buildout:directory}/parts/primary/var
cache-size 300MB
</zeoclient>
mount-point /site1
</zodb_db>
Most of this is boilerplate. If you know what you are doing with Zeo, you can tweak the cache sizes, etc. But mostly, you will only need to modify this to change the name of the ZODB and the mount point. Make sure that this bit of code is added to each of the instances you are building.
If you are not using buildout, first edit your zeo.conf file to add the following:
<filestorage site1storage> path $INSTANCE/var/site1/Data.fs </filestorage>
Then edit your zope.conf files to add:
<zodb_db site1>
<zeoclient>
server {servername}:{port}
storage site1storage
name zeostorage
var $INSTANCE/var
</zeoclient>
mount-point site1
</zodb_db>
Remember to replace {servername} and {port} with the server name and port for your zeo server.
Issues
- If you are moving a Data.fs file to a new instance, remember that the same versions of Zope and Plone need to be used in the new instance.
- The path to the plone site is http://yoursite:8080/site1/<sitename> where <sitename> is the name given the Plone site on creation. It makes sense to choose the names of "site1" and "sitename" in some sensible fashion to avoid a redundant name (easy to get this wrong the first time).
- If you move the Data.fs file to a new instance, make sure that you use the same name for the mount point. You will not be able to see anything that you had previously saved in the folder if you mount it using a different name.

