Plone 4.3.3 - Relstorage
Background
These are my notes for using Relstorage with Plone 4.3.3. My reason for doing this is I wanted to have a live copy of my plone site on a separate server. I wanted things put into one plone site to show up on the other (and vice-versa). This is hard to do with the default plone setup because 'data.fs' is large and plone needs to be restarted when copied it over.
In my searches for a solution I found RelStorage. Relstorage allows you to store you blob data in a mysql database instead of 'data.fs'. Once that data is in mysql, it is easy to replicate between servers with Multi-Master replication (like mariadb galera).
Reference Documents
http://shane.willowrise.com/archives/how-to-install-plone-with-relstorage-and-mysql/
http://docs.silvacms.org/2.3/cluster/relstorage.html
http://plone.org/documentation/faq/plone-backup-move
https://mail.zope.org/pipermail/zodb-dev/2012-April/014630.html
https://pypi.python.org/pypi/RelStorage
Issues I had setting up RelStorage
1.) Based on previous directions I thought I needed to patch ZODB files for RelStorage. I have since found out that starting in ZODB 3.9 a patch is no longer needed.
2.) On my first attempt I kept getting a Temporary Directory error. The error I was getting was "Error Value: 'NoneType' object has no attribute 'temporaryDirectory'". Eventually I found it was because I was not specifying 'blob-dir' in 'zinstance\buildout.cfg' (see below).
Instructions
*note* my plone directory is '/opt/PloneRep-4-3-3/'. Replace this with your plone path in in the instuctions below.
1.) edit 'zinstance/buildout.cfg'.
--Under [buildout], add the following eggs--
eggs =
Plone
Pillow
RelStorage
MySQL-python
--Under [instance], add the following--
[instance]
rel-storage =
type mysql
host 127.0.0.1
db plone
user ploneuser
passwd supersecretpw
shared-blob-dir false
blob-dir /opt/PloneRep-4-3-3/zinstance/var/blobstorage
blob-cache-size 10mb
-- Add to the end of buildout.cfg to get zodbconvert tool --
[zopepy]
scripts = zopepy zodbconvert
[zodbconvert]
recipe = zc.recipe.egg
eggs = ${buildout:eggs}
scripts = zodbconvert
2.) Run the plone buildout
*note* buildout may fail if libmysqlclient-dev or libmariadbclient-dev are not installed
cd /opt/PloneRep-4-3-3/zinstance
sudo -u plone_buildout bin/buildout
3.) If you just want a blank plone site you are done at this point. Start plone with 'bin/plonectl fg' to verify there are no errors. If you want to convert an existing plone site...continue to the next step.
4.) Create a settings xml file for zodbconvert
*note* my data source is my old plone directory, /opt/Plone-4-3-3/ . This is converting data.fs and FileStorage in the 'bushy' format.
/opt/PloneRep-4-3-3/zinstance/conv.xml
<filestorage source>
path /opt/Plone-4-3-3/zinstance/var/filestorage/Data.fs
blob-dir /opt/Plone-4-3-3/zinstance/var/blobstorage
</filestorage>
<relstorage destination>
shared-blob-dir false
# ZODB Cache Dir
blob-dir ./var/blobstorage
blob-cache-size 10mb
<mysql>
host 127.0.0.1
db plone
user ploneuser
passwd supersecretpw
</mysql>
</relstorage>
5.) Run zodbconvert
cd /opt/PloneRep-4-3-3/zinstance
bin/zodbconvert --clear /opt/PloneRep-4-3-3/zinstance/conv.xml
6.) If the conversion goes successfully, this is a good time to make a backup of your new plone mysql database (I know I used my backup a few times in getting this all working)
7.) you should now be ready to start plone. start it with 'plonectl fg' to make sure there are no errors.
Document Actions