Extending buildout.cfg to create a separate production.cfg for the production deployment

This is a short blog post how to use buildout configuration tool to create separate configurations for development and production runs for Plone CMS, If you want to know something about deploying ZEO cluster to the production servers then this blog post might make some sense for you.

In buildout configuration files, you can extend

  • Different buildout.cfg files
  • Different buildout sections

Here is a short example how to split your buildout to development and production configurations. We create two files:

  • buildout.cfg – singles process Zope instance for the development – base configuration
  • production.cfg – ZEO cluster installation for the production server, containing production specific bits

production.cfg extends buildout.cfg inherithing all the setup and simply declares more clients.

buildout.cfg can be any normal Plone Zope installation file e.g. one provided with Unified Installer.

The following production configuration is created by the example velow

  • ZEO database server (port 13000)
  • Four ZEO front end clients, clustered through a front end web server (13001..13004) with production grade cache sizes
  • One debug client, accesible over special SSH tunnel for debugging production bugs
  • One command line client, to be used for long-running tasks like migration runs

Note: There seems to be slight issue extending parts from other configuration files, so we cannot directly extend [instance]

Example production.cfg:

[buildout]
extends =
    buildout.cfg

# We re-declare are parts here (though parts can come from buildout.cfg)
parts =
    lxml
    pylxml
    zeoserver
    instance
    client1
    client2
    client3
    client4
    debug-client
    command-line-client
    unifiedinstaller
    zopepy

# On prod. server have a shared cached eggs folder
eggs-directory=../buildout-cache/eggs
download-cache=../buildout-cache/downloads

newest = false

[zeoserver]
recipe = plone.recipe.zeoserver
zeo-address = 127.0.0.1:13000

# We need to re-declare instance as "head", as for some reason
# extending sections from the parent configuration file directly
# does not work
[head]
recipe = plone.recipe.zope2instance
debug-mode = off
verbose-security = off
zeo-client = true
zeo-address = ${zeoserver:zeo-address}
zeo-address = 127.0.0.1:13000
zodb-cache-size = 200000
shared-blob = on
user = admin:admin
zeo-var = ${buildout:directory}/var
eggs = ${instance:eggs}
products = ${instance:products}
environment-vars = ${instance:environment-vars}

[client1]
<= head
http-address = 13001

[client2]
<= head
http-address = 13002

[debug-client]
<= head
http-address = 13010
debug-mode = on
verbose-security = on

[client3]
<= head
http-address = 13003

[client4]
<= head
recipe = plone.recipe.zope2instance
http-address = 13004

[command-line-client]
<= head
recipe = plone.recipe.zope2instance
http-address = 99999
debug-mode = on
verbose-security = on

[unifiedinstaller]
recipe = plone.recipe.unifiedinstaller
primary-port = 13001
sudo-command =
zeoserver = zeoserver
clients=client1 client2 client3 client4

Remember to run as bin/buildout -c production.cfg or symlink production.cfg as buildout.cfg on the production server. The latter is better as then you don’t forget the extra switch needed for bin/buildout command.

1. More info

\"\" Subscribe to RSS feed Follow me on Twitter Follow me on Facebook Follow me Google+

Leave a Reply

Your email address will not be published. Required fields are marked *