How to build a simple shared zeoclient-only setup for Plone 3

Note: The following is probably very adaptable to Plone 4. In fact, I suspect it’s even easier in Plone 4. But I’m working on Plone 3 right now, so there you go.

This is the second in a two-part guide on how to separate the Plone database server from the client instances. Even with load-balancing proxies, convenient high-availability in Plone always remains just out of reach. As long as the zeoserver and its clients are on the same machine, you have to consider both server and clients in your change control processes. Separation is simplification. I’ve given other reasons to care in my previous post, but as an update, here is the approximate storage size of a single client-only site with a lot of eggs:

$ du -hs *
53M	Python-2.4
73M	Zope-2.10.11-final-py2.4
149M	testcase

Getting started with the clients

  1. Decide how you will structure your filesystem:
    • Shared Python 2.4: /opt/plone/Python-2.4
    • Shared Zope 2.10: /opt/plone/Zope-2.10.11-final-py2.4
    • Buildout for zeo: /opt/plone/testcase
  2. Create the user that the clients will run as. Create the parents of the above paths and give that user ownership. Become that user for the rest of these instructions.
    useradd plone
    mkdir /opt/plone && chown plone /opt/plone
    su - plone || sudo -u plone bash
  3. Download and unpack the Universal Installer (UI) from Plone.org. Use the UI to install a shared Zope and Python, but nuke the rest of what it installs for now.
    ./install.sh --target=/opt/plone zeo && rm -rf /opt/plone/{buildout-cache,zeocluster}
  4. Use the UI to install an actual zeoserver using that shared Python and Zope:
    ./install.sh --target=/opt/plone/testcase --with-python=/opt/plone/Python-2.4/bin/python --with-zope=/opt/plone/Zope-2.10.11-final-py2.4 zeo
  5. Go to the zeocluster directory and clean out the buildout stuff that is only needed for Plone clients. You really only need bin/buildout, buildout.cfg. If you’re using bash you can do this quickly with extglob:
    cd /opt/plone/testcase/zeocluster && shopt -s extglob
    rm -rf ../buildout-cache/ bin/!(buildout) !(bin|buildout.cfg|versions.cfg) .installed.cfg
  6. Create a backup of the buildout file and begin working on it. You can delete almost everything in there, just keep the zope2, zopepy and client parts and fix any broken references. Here’s what mine looks like:
    [buildout]
    extends = versions.cfg
    versions = versions
    extensions = buildout.dumppickedversions
    zeo-address = 10.0.0.87:8100
    client1-address = 8080
    client2-address = 8081
    eggs = Plone
    zcml =
    develop =
    debug-mode = off
    parts =
            zope2
            client1
            client2
            zopepy
    
    [zope2]
    recipe = plone.recipe.zope2install
    fake-zope-eggs = true
    additional-fake-eggs =
            ZConfig
            pytz
    location = /opt/plone/Zope-2.10.11-final-py2.4
    
    [client1]
    recipe = plone.recipe.zope2instance
    zeo-client = true
    zeo-address = ${buildout:zeo-address}
    effective-user = plone
    user = admin:abc
    http-address = ${buildout:client1-address}
    debug-mode = ${buildout:debug-mode}
    verbose-security = ${buildout:debug-mode}
    deprecation-warnings = ${buildout:debug-mode}
    eggs = ${buildout:eggs}
    zcml = ${buildout:zcml}
    environment-vars = PYTHON_EGG_CACHE ${buildout:directory}/var/.python-eggs
    zope2-location = ${zope2:location}
    
    [client2]
    < = client1
    http-address = ${buildout:client2-address}
    
    [zopepy]
    recipe = zc.recipe.egg
    eggs = ${buildout:eggs}
    interpreter = zopepy
    extra-paths = ${zope2:location}/lib/python
    scripts = zopepy
    
    [versions]
    Cheetah = 2.0.1
    Paste = 1.7.2
    PasteScript = 1.7.3
    ZopeSkel = 2.11.1
    collective.recipe.backup = 1.1
    plone.recipe.command = 1.0
    plone.recipe.distros = 1.5
    plone.recipe.osxcontroller = 0.3
    plone.recipe.precompiler = 0.3
    plone.recipe.unifiedinstaller = 0.9
    collective.recipe.zope2cluster = 1.0
    PasteDeploy = 1.3.3
    zc.recipe.egg = 1.2.2
  7. Once you’re satisfied with your buildout configuration, run buildout, fix permissions and try to start the instance. (Note: buildout always crashes the first time I do this because of a setuptools incompatibility. Just run it again if it fails.):
    bin/buildout || bin/buildout && bin/client1 start && bin/client2 start
  8. That’s it! Now to create a new client setup, just repeat steps 5-8, updating the paths and port numbers (zeo-address, clientN-address) to suit.

That’s really all there is to it.

One thought on “How to build a simple shared zeoclient-only setup for Plone 3”

Comments are closed.