• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Reaching Deployment Nirvana Using Buildout
 

Reaching Deployment Nirvana Using Buildout

on

  • 22,671 views

In the past, deploying a Zope/Plone application was a cumbersome task wrought with peril. Buildout has ushered in a new era of repeatability and ease of use. Spending hours to get your co-workers set ...

In the past, deploying a Zope/Plone application was a cumbersome task wrought with peril. Buildout has ushered in a new era of repeatability and ease of use. Spending hours to get your co-workers set up with just the right set of products and python libraries has come to an end. Six Feet Up's Lead Developer Clayton Parker will show you how to use buildout from your local development instance to the full blown production server instance with one buildout.

Statistics

Views

Total Views
22,671
Views on SlideShare
6,182
Embed Views
16,489

Actions

Likes
5
Downloads
82
Comments
0

18 Embeds 16,489

http://www.buildout.org 16421
http://plone.org 31
http://translate.googleusercontent.com 9
http://www.slideshare.net 6
http://buildout.readthedocs.org 4
https://buildout-docs.readthedocs.org 3
http://svn.zope.org 2
http://docs.zope.org 2
http://www.pilotsystems.net 2
http://coderwall.com 1
http://buildout-docs.readthedocs.org 1
http://192.168.10.10 1
http://131.253.14.66 1
http://web.archive.org 1
http://webcache.googleusercontent.com 1
http://64.233.163.132 1
http://131.253.14.250 1
http://www.slideee.com 1
More...

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Reaching Deployment Nirvana Using Buildout Reaching Deployment Nirvana Using Buildout Presentation Transcript

    • Reaching Deployment Nirvana Using Buildout Clayton Parker Plone Conference 2008 nowhere to go but open source s ix fe e tup . c om / dw 0 8
    • Here’s to Plone si xf eet up .co m /dw 0 8
    • To-do List • Buildout • Parts • Recipes • Command Line • ZopeSkel • Create Buildouts • Custom Recipes si xf eet up .co m /dw 0 8
    • Why buildout? si xf eet up .co m /dw 0 8
    • Eliminate Confusion si xf eet up .co m /dw 0 8
    • Tracking Dependencies si xf eet up .co m /dw 0 8
    • Roll Your Own • Installer • ZopeSkel si xf eet up .co m /dw 0 8
    • ZopeSkel $ easy_install ZopeSkel $ paster create --list-templates plone3_buildout: A buildout for Plone 3 projects $ paster create -t plone3_buildout mybuildout si xf eet up .co m /dw 0 8
    • Lingo si xf eet up .co m /dw 0 8
    • Syntax [buildout] parts = zope2 plone instance [plone] recipe = plone.recipe.plone [zope2] recipe = plone.recipe.zope2install [instance] recipe = plone.recipe.zope2instance user = admin:admin eggs = ${plone:eggs} products = ${plone:products} si xf eet up .co m /dw 0 8
    • Advanced Syntax Variable Substitution ${part:option} ${plone:eggs} ${buildout:directory} option = ${buildout:directory}/somefolder Option Addition and Removal options = foo bar options += baz options -= foo si xf eet up .co m /dw 0 8
    • Reserved Characters :$ % { } si xf eet up .co m /dw 0 8
    • Parts si xf eet up .co m /dw 0 8
    • [buildout] parts = instance [instance] recipe = plone.recipe.zope2instance user = admin:admin eggs = ${plone:eggs} archetypes.schemaextender zcml = archetypes.schemaextender products = ${plone:products} environment-vars = TZ America/Chicago http-address = 51060 zeo-address = 53060 debug-mode = on verbose-security = on event-log-level = debug si xf eet up .co m /dw 0 8
    • Recipes si xf eet up .co m /dw 0 8
    • [buildout] parts = zope2 plone instance [plone] recipe = plone.recipe.plone [zope2] recipe = plone.recipe.zope2install [instance] recipe = plone.recipe.zope2instance user = admin:admin eggs = ${plone:eggs} products = ${plone:products} si xf eet up .co m /dw 0 8
    • Buildout Directory • bin/ • bootstrap.py • buildout.cfg • develop-eggs/ • downloads/ • eggs/ • parts/ • products/ • src/ si xf eet up .co m /dw 0 8
    • Buildout options • bin-directory • develop-eggs-directory • eggs-directory • parts • parts-directory • log-level si xf eet up .co m /dw 0 8
    • Defaults [buildout] eggs-directory = /home/clayton/.buildout/eggs download-cache = /home/clayton/.buildout/downloads zope-directory = /home/clayton/.buildout/zope index = http://download.zope.org/ppix [instance] event-log-level = debug si xf eet up .co m /dw 0 8
    • Recipes si xf eet up .co m /dw 0 8
    • Plone Recipes • plone.recipe.plone • plone.recipe.zope2install • plone.recipe.zope2instance • plone.recipe.squid si xf eet up .co m /dw 0 8
    • plone.recipe.zope2install [zope2] recipe = plone.recipe.zope2install url = ${plone:zope2-url} fake-zope-eggs = true additional-fake-eggs = ZODB3 skip-fake-eggs = zope.testing zope.component zope.i18n si xf eet up .co m /dw 0 8
    • In The Wild si xf eet up .co m /dw 0 8
    • Extending Configuration • buildout.cfg • profiles/ • base.cfg • development.cfg • debug.cfg • qa.cfg • prod.cfg • versions.cfg si xf eet up .co m /dw 0 8
    • buildout.cfg [buildout] # the profile we want to use extends = profiles/development.cfg find-links = http://dist.plone.org http://download.zope.org/distribution/ http://effbot.org/downloads si xf eet up .co m /dw 0 8
    • base.cfg [buildout] parts = PILwoTK plone zope2 instance zeoserver develop = src/my.package [PILwoTK] recipe = zc.recipe.egg find-links = http://download.zope.org/distribution/ [zope2] recipe = plone.recipe.zope2install url = ${plone:zope2-url} fake-zope-eggs = true additional-fake-eggs = ZODB3 skip-fake-eggs = zope.testing zope.component zope.i18n si xf eet up .co m /dw 0 8
    • [plone] recipe = plone.recipe.plone [instance] recipe = plone.recipe.zope2instance zeo-client = True zope2-location = ${zope2:location} eggs = PILwoTK elementtree ${plone:eggs} my.package zcml = my.package products = ${plone:products} environment-vars = TZ America/New_York [zeoserver] recipe = plone.recipe.zope2zeoserver zope2-location = ${instance:zope2-location} zeo-address = ${instance:zeo-address} si xf eet up .co m /dw 0 8
    • development.cfg [buildout] extends = base.cfg debug.cfg parts += ${debugging:parts} omelette [instance] user = admin:admin http-address = 8080 zeo-address = 8100 debug-mode = on verbose-security = on event-log-level = debug products += ${buildout:directory}/products ${debugging:debug-products} eggs += ${debugging:eggs} zcml += ${debugging:zcml} [omelette] recipe = collective.recipe.omelette eggs = ${instance:eggs} ignore-develop = True si xf eet up .co m /dw 0 8 ignores = setuptools
    • debug.cfg [debugging] parts = debug-products debug-products-svn ipzope zopepy debug-products = ${debug-products:location} eggs = plone.reload Products.PDBDebugMode Products.DocFinderTab Products.Clouseau Products.PrintingMailHost zcml = plone.reload si xf eet up .co m /dw 0 8
    • [debug-products] recipe = plone.recipe.distros urls = ...dcworkflowgraph-0_3.tgz ...PTProfiler-1.2.tgz [ipzope] recipe = zc.recipe.egg eggs = ipython ${instance:eggs} initialization = import sys, os os.environ[quot;SOFTWARE_HOMEquot;] = quot;${instance:zope2-location}/lib/ pythonquot; os.environ[quot;INSTANCE_HOMEquot;] = quot;${instance:location}quot; sys.argv[1:1] = quot;-p zopequot;.split() extra-paths = ${instance:zope2-location}/lib/python scripts = ipython=ipzope [zopepy] recipe = zc.recipe.egg eggs = ${instance:eggs} interpreter = zopepy extra-paths = ${instance:zope2-location}/lib/python si xf eet up .co m /dw 0 8 scripts = zopepy
    • versions.cfg [versions] # Use the following from the command line to get the latest versions: # bin/buildout -vvvvv |sed -ne 's/^Picked: //p' | sort | uniq PILwoTk = 1.1.6.4 elementtree = 1.2.7-20070827-preview infrae.subversion = 1.1 plone.recipe.distros = 1.3 plone.recipe.plone = 3.1.6 plone.recipe.zope2install = 2.3 plone.recipe.zope2instance = 2.5 plone.recipe.zope2zeoserver = 0.13 python-openid = 2.2.1 my.package = 1.0 si xf eet up .co m /dw 0 8
    • prod.cfg [buildout] extends = base.cfg versions.cfg parts += instance2 versions = versions [instance] zope2-location = ${zope2:location} http-address = 9080 zeo-address = 9100 eggs += Products.CacheSetup z2-log-level = CRITICAL zodb-cache-size = 15000 [instance2] recipe = collective.recipe.zope2cluster instance-clone = instance http-address = 10080 si xf eet up .co m /dw 0 8
    • Command Line si xf eet up .co m /dw 0 8
    • Baby Steps $ cd path/to/mybuildout $ python2.4 bootstrap.py Creating directory 'mybuildout/bin'. Creating directory 'mybuildout/parts'. Creating directory 'mybuildout/develop-eggs'. Generated script 'mybuildout/bin/buildout'. $ bin/buildout $ bin/instance start si xf eet up .co m /dw 0 8
    • Options • -v and -q • increase and decrease verbosity • -n and -N • Newest and non-newest modes • -O and -o • online and offline mode • -t • socket timeout si xf eet up .co m /dw 0 8
    • Update your buildout $ bin/buildout -v $ bin/buildout -Nvvv $ bin/buildout -No $ bin/buildout -t 60 si xf eet up .co m /dw 0 8
    • Assignments $ bin/buildout instance:debug-mode=on $ bin/buildout buildout:log-level=70 $ bin/buildout -N instance:debug-mode=on -v si xf eet up .co m /dw 0 8
    • Commands $ bin/buildout install $ bin/buildout -Nv install zope2 instance $ bin/buildout -nv install instance si xf eet up .co m /dw 0 8
    • Create Recipes $ paster create -t recipe my.recipe.example si xf eet up .co m /dw 0 8
    • Recipe • Recipe class • constructor • install • update • uninstall (optional) si xf eet up .co m /dw 0 8
    • class Recipe: quot;quot;quot;quot;A recipe quot;quot;quot;quot; def __init__(self, buildout, name, options): self.buildout = buildout self.name = name self.options = options # gather options from other parts here options['notmine'] = buildout['someotherpart']['foobar'] def install(self): quot;quot;quot;quot;Install method quot;quot;quot; options = self.options location = options['location'] # must return a string, or an iterable of strings return location def update(self): quot;quot;quot;Update method quot;quot;quot; pass si xf eet up .co m /dw 0 8
    • class Recipe: Real World quot;quot;quot;infrae.subversion recipe. quot;quot;quot; def __init__(self, buildout, name, options): self.buildout = buildout self.name = name self.options = options options['location'] = self.location = os.path.join( buildout['buildout']['parts-directory'], self.name) self.urls = [l.split() for l in options['urls'].splitlines() if l.strip()] self.export = options.get('export') self.newest = ( buildout['buildout'].get('offline', 'false') == 'false' and buildout['buildout'].get('newest', 'true') == 'true' ) self.verbose = buildout['buildout'].get('verbosity', 0) si xf eet up .co m /dw 0 8
    • Install Method def install(self): quot;quot;quot;Checkout the checkouts. quot;quot;quot; for (url, name) in self.urls: wc = py.path.svnwc(self.location).join(name) if self.export: raise Exception('Unimplemented feature') if self.verbose: print quot;Fetch %squot; % url wc.checkout(url) return self.location si xf eet up .co m /dw 0 8
    • def update(self): quot;quot;quot;Update the checkoutsquot;quot;quot; if not self.newest: return self.location if self.export: return self.location if self.options.get('ignore_updates', False): return self.location num_release = re.compile('.*@[0-9]+$') part = py.path.local(self.location) for link, sub_path in self.urls: if num_release.match(link): if self.verbose: print quot;Given num release for %s, skipping.quot; % link continue wc = py.path.svnwc(self.location).join(sub_path) if self.verbose: print quot;Updating %squot; % link wc.update() return self.location si xf eet up .co m /dw 0 8
    • Wrapping Up • Buildout • Parts • Recipes • Command Line • ZopeSkel • Create Buildouts • Custom Recipes si xf eet up .co m /dw 0 8
    • Plone Deployment Workshop sixfeetup.com/dw08 Register by October 17 and save $100!
    • Links • http://buildout.zope.org • http://pypi.python.org/pypi/zc.buildout • https://svn.sixfeetup.com/svn/public/buildout/debug.cfg • http://www.sixfeetup.com/swag/buildout-quick-reference-card • http://plone.org/documentation/tutorial/buildout • http://pypi.python.org si xf eet up .co m /dw 0 8
    • Photo Credits • http://flickr.com/photos/monsieurlam/2645956083/ • http://flickr.com/photos/_boris/2796908072/ • http://flickr.com/photos/b-tal/163450213/ • http://flickr.com/photos/bullish1974/2648544508/ • http://flickr.com/photos/haydnseek/87432002/ • http://flickr.com/photos/disowned/1158260369/ • http://flickr.com/photos/7603557@N08/2662531345/ • http://flickr.com/photos/julishannon/2151986631/ • http://flickr.com/photos/julishannon/2152778524/ • http://flickr.com/photos/lollyknit/1155225799/ • http://flickr.com/photos/binary_koala/86227485/ si xf eet up .co m /dw 0 8