How do I put Plone into read-only mode?
When performing certain tasks (upgrades, for instance), it might make sense to put the production site into read-only mode to make sure no content is added while upgrade/migration is performed on a parallel instance, and then overwrite the old database file with the new version.
To set Zope into read-only mode, do the following:
- find all
zope.conffiles — maybe more than one, could be in the
parts/instancedirectory, probably at
parts/instancename/etc/zope.conf— one per zope client
- within each
zope.conffile, add the following line:
- within each
zope.conffile, find first the <zodb_db main> section, then find either the zeoclient node (if using ZEO) or the filestorage node (if not using ZEO). There should only be one per zope.conf file. Add the "read-only true" option, the resut should look something like this:
<filestorage> path /path/to/your/buildout/var/filestorage/Data.fs read-only true </filestorage>
- restart the Zope instance — if you have a ZEO setup, remember to restart both the clients and the server (run the
restartcluster.shscript, if you have it).
Your Plone setup should now be fully functional, but whilst read-only it will be impossible to add content or change settings.
You may wish to customize your ReadOnlyError error message to indicate the reason for the restriction.
If you use buildout to control your Plone configuration (very likely for Plone 3.2+): the zope.conf file is generated by buildout, and may be overwritten when you run buildout.
For now: following any buildout, be prepared to re-apply the changes outlined above.
(For the future: https://bugs.launchpad.net/collective.buildout/+bug/712204 proposes an improvement to plone.recipe.zope2instance.)