Buildout Examples
Examples from Fulvio Casali
Sample config/buildout.cfg.tmpl
This file is checked in to the config folder inside the buildout root. First thing after checking out the buildout, one would copy it up one level, rename it to buildout.cfg, and uncomment the desired parts. In particular, one would uncomment the line config/devel.cfg for a local development instance, or config/staging.cfg or config/prod.cfg for a staging or a production site, respectively.
[buildout]
extends =
# config/prod.cfg
# config/staging.cfg
config/devel.cfg
#allow-hosts =
# pypi.python.org
# dist.plone.org
## Optional devel.cfg support. If you're using devel.cfg from above,
## you can uncomment lines below to enable
parts +=
# roadrunner
# ptprofiler
# zopeprofiler
# zptdebugger
# deadlockdebugger
# ipzope
[instance1]
zcml-eggs +=
# plone.reload
eggs +=
# Uncomment if using deadlockdebugger
# threadframe
products +=
# ${ptprofiler:location}
# ${zopeprofiler:location}
# ${zptdebugger:location}
# Also Uncomment threadframe in eggs above if using deadlockdebugger
# ${deadlockdebugger:location}
SVN ignored files
Please note that the file buildout.cfg in our buildout root is never checked in, to avoid breaking production installations:
>svn propget svn:ignore # # applied by: svn propset svn:ignore -F ./IGNORE.txt . # .installed.cfg .mr.developer.cfg bin buildout.cfg develop-eggs fake-eggs parts var eggs downloads
Sample config/prod.cfg
[buildout] extends = varnish.cfg
Sample config/varnish.cfg
[buildout]
extends = zeo.cfg
parts +=
varnish-build
varnish
[varnish-build]
recipe = plone.recipe.varnish:build
[varnish]
recipe = plone.recipe.varnish:instance
backends = ${instance1:http-address}
bind = 127.0.0.1:8000
cache-size = 512M
Sample config/zeo.cfg
Please note that this config file does a bunch of stuff:
- It configures ZEO
- It configures two different backup cron jobs, a daily and a weekly one
- It configures logrotation
- It configures a cron job to restart supervisor, whenever the host is rebooted
- And it also configures the Zope production instance parameters
The z3c.recipe.usercrontab recipe is a handy way to set up cron jobs. Just note that the cron jobs will be installed for the user who runs buildout, so be careful to check what user you are currently logged in as.
Also, see below for the logrotate.conf.tmpl file.
[buildout]
extends = base.cfg
parts +=
zeo
backup
backup-daily
backup-weekly
logrotate
logrotate-daily
supervisor
supervisor-reboot
[zeo]
recipe = plone.recipe.zope2zeoserver
zope2-location = ${zope2:location}
zeo-address = 127.0.0.1:8100
[backup]
recipe = collective.recipe.backup
[backup-daily]
recipe = z3c.recipe.usercrontab
times = 0 3 * * 0-6
command = ${buildout:directory}/bin/backup
[backup-weekly]
recipe = z3c.recipe.usercrontab
times = 0 3 * * 7
command = ${buildout:directory}/bin/zeopack -p 8000 -d 1 && ${buildout:directory}/bin/backup
[instance1]
zeo-client = True
zeo-address = ${zeo:zeo-address}
zserver-threads = 2
zodb-cache-size = 250000
[logrotate]
recipe = collective.recipe.template
input = etc/logrotate.conf.tmpl
output = etc/logrotate.conf
[logrotate-daily]
recipe = z3c.recipe.usercrontab
times = 0 6 * * *
command = /usr/sbin/logrotate --state ${buildout:directory}/var/logrotate.status ${buildout:directory}/${logrotate:output}
[supervisor]
recipe = zc.recipe.egg
eggs = supervisor
[supervisor-reboot]
recipe = z3c.recipe.usercrontab
times = @reboot
command = ${buildout:directory}/bin/supervisord -c ${buildout:directory}/etc/supervisord.conf
Sample config/base.cfg
[buildout]
extensions +=
mr.developer
extends =
versions.cfg
parts =
productdistros
zope2
instance1
z3c.offlinepack
find-links =
http://dist.plone.org
http://dist.plone.org/thirdparty
http://download.zope.org/ppix/
http://download.zope.org/distribution/
http://effbot.org/downloads
versions = versions
eggs =
<< your product eggs here >>
develop =
sources = sources
auto-checkout =
<< your development product eggs here >>
[sources]
<< my.product = svn https://svn.acme.com/myProduct/... >>
[zope2]
recipe = plone.recipe.zope2install
fake-zope-eggs = true
additional-fake-eggs =
ZConfig
ZODB3
zdaemon
pytz
Acquisition
skip-fake-eggs =
[productdistros]
recipe = plone.recipe.distros
[instance1]
recipe = plone.recipe.zope2instance
zope2-location = ${zope2:location}
user = admin:secret
http-address = 127.0.0.1:8080
zcml-eggs =
Products.CacheSetup
<< ... >>
eggs =
<< ... >>
${buildout:eggs}
elementtree
PILwoTk
Plone
${instance1:zcml-eggs}
zcml =
${instance1:zcml-eggs}
products =
${buildout:directory}/products
${productdistros:location}
[z3c.offlinepack]
recipe = zc.recipe.egg:scripts
extra-paths = ${zope2:location}/lib/python
Sample config/versions.cfg
[buildout]
extensions = buildout.dumppickedversions
[versions]
# Buildout infrastructure
buildout.eggtractor = 0.6
plone.recipe.zope2install = 3.2
plone.recipe.zope2instance = 3.4
tl.eggdeps = 0.3.2
setuptools = 0.6c9
zc.buildout = 1.3.1
zc.recipe.egg = 1.2.2
zc.recipe.cmmi = 1.2.1
# Zope
zope2-url = http://www.zope.org/Products/Zope/2.10.9/Zope-2.10.9-final.tgz
# External dependencies
Markdown = 1.7
# Changed from PIL
PILwoTk = 1.1.6.4
elementtree = 1.2.6-20050316
feedparser = 4.1
python-openid = 2.2.4
simplejson = 2.0.9
# Plone release
Plone = 3.3.1
Products.ATContentTypes = 1.3.4
Products.ATReferenceBrowserWidget = 2.0.4
Products.AdvancedQuery = 3.0
Products.Archetypes = 1.5.12
Products.CMFActionIcons = 2.1.2
Products.CMFCalendar = 2.1.2
Products.CMFCore = 2.1.2
Products.CMFDefault = 2.1.2
Products.CMFDiffTool = 0.5.2
<< ... >>
[zope2]
url = ${versions:zope2-url}
[productdistros]
urls =
[varnish-build]
url = http://superb-east.dl.sourceforge.net/sourceforge/varnish/varnish-2.0.4.tar.gz
[pound-build]
url = http://www.apsis.ch/pound/Pound-2.4.4.tgz
Sample config/staging.cfg
[buildout] extends = devel.cfg [instance1] user = admin:OMG_CHANGE_THIS_IN_ZODB_IMMEDIATELY http-address = 8098 debug-mode = off verbose-security = off
Sample config/devel.cfg
[buildout]
extends = base.cfg
parts +=
packages
zopepy
[packages]
recipe = collective.recipe.omelette
eggs = ${instance1:eggs}
products = ${instance1:products}
packages = ${zope2:location}/lib/python ./
[ptprofiler]
recipe = plone.recipe.bundlecheckout
url = https://svn.infrae.com/PTProfiler/trunk
subfolder = PTProfiler
[zopeprofiler]
recipe = plone.recipe.distros
urls = http://www.dieter.handshake.de/pyprojects/zope/ZopeProfiler.tgz
[zptdebugger]
recipe = plone.recipe.bundlecheckout
url = https://svn.plone.org/svn/collective/ZPTDebugger/trunk
subfolder = ZPTDebugger
[deadlockdebugger]
recipe = plone.recipe.bundlecheckout
url = http://svn.nuxeo.org/pub/Zope2/DeadlockDebugger/trunk
subfolder = DeadlockDebugger
[instance1]
zeo-client = False
eggs +=
Products.PDBDebugMode
Products.Clouseau
Products.DocFinderTab
Products.Gloworm
http-address = 8080
verbose-security = on
zope-conf-additional =
zserver-threads 1
debug-mode = on
[ipzope]
# a IPython Shell for interactive use with zope running.
# you also need to put
# https://svn.plone.org/svn/collective/dotipython/trunk/ipy_profile_zope.py
# to your $HOME/.ipython directory for the following to work.
recipe = zc.recipe.egg
eggs =
ipython
${instance1:eggs}
initialization =
import sys, os
os.environ["SOFTWARE_HOME"] = "${zope2:location}/lib/python"
os.environ["INSTANCE_HOME"] = "${instance1:location}"
sys.argv[1:1] = "-p zope".split()
extra-paths = ${zope2:location}/lib/python
scripts = ipython=ipzope
[zopepy]
recipe = zc.recipe.egg
eggs = ${instance1:eggs}
interpreter = zopepy
extra-paths = ${zope2:location}/lib/python
scripts = zopepy
[roadrunner]
recipe = roadrunner:plone
zope2-instance = instance1
packages-under-test =
# for instance my.*
Sample etc/logrotate.conf.tmpl
You will want to check this file in to SVN. The file logrotate.conf is generated automatically by buildout expanding the variables in the ...tmpl file, and should not be checked in.
rotate 4
weekly
create
compress
delaycompress
${buildout:directory}/var/log/zeo.log {
postrotate
${buildout:bin-directory}/zeo logreopen
endscript
}
${buildout:directory}/var/log/instance1.log ${buildout:directory}/var/log/instance1-Z2.log {
sharedscripts
postrotate
/bin/kill -USR2 $(cat ${buildout:directory}/var/instance1.pid)
endscript
}
