Showing posts with label buildout. Show all posts
Showing posts with label buildout. Show all posts

Thursday, July 16, 2009

light serving needs

if you ever have the need to serve a few static pages — say munin output, for example — next to your elaborate "plone/zope behind haproxy behind nginx behind varnish" setup :), here's a quick way to run lighttpd via supervisor using buildout.

with a buildout.cfg like:

[buildout]
parts =
  lighttpd
  lighttpdconf
  supervisor

[lighttpd]
recipe = zc.recipe.cmmi
url = http://www.lighttpd.net/download/lighttpd-1.4.23.tar.gz

[lighttpdconf]
recipe = collective.recipe.template
input = ${buildout:directory}/lighttpd.conf.in
output = ${buildout:directory}/etc/lighttpd.conf
directory = /var/www/munin
port = 8080

[supervisor]
recipe = collective.recipe.supervisor
programs =
  10 lighttpd ${buildout:directory}/parts/lighttpd/sbin/lighttpd [-D -f ${buildout:directory}/etc/lighttpd.conf]
and a configuration template (saved as lighttpd.conf.in) like:
server.document-root = "${lighttpdconf:directory}"
server.port = "${lighttpdconf:port}"
server.tag ="lighttpd"
index-file.names = ( "index.html" )
mimetype.assign = (
  ".html" => "text/html", 
  ".txt" => "text/plain",
  ".jpg" => "image/jpeg",
  ".png" => "image/png", 
  ".css" => "text/css",
  ".js"  => "text/javascript",
  ".xml" => "text/xml",
  ".pdf" => "application/pdf",
)
all you need to do is the following:
$ python bootstrap.py
$ bin/buildout
$ bin/supervisord
after which you can access the contents of /var/www/munin at http://localhost:8080/.

please refer to the lighttpd documentation if you need more than this rather minimal setup...

Thursday, January 22, 2009

please downgrade my buildout!

i won't go into discussing particular use cases here — that would perhaps be too weird :) — but let's just say sometimes it can be handy to be able to quickly "downgrade" an existing plone 3.x buildout to plone 2.5. here's a buildout config that does exactly this:
[buildout]
extends = buildout.cfg

[plone]
recipe = plone.recipe.distros
urls = http://launchpad.net/plone/2.5/2.5.5/+download/Plone-2.5.5.tar.gz
nested-packages = Plone-2.5.5.tar.gz
version-suffix-packages = Plone-2.5.5.tar.gz
eggs =

[zope2]
url = http://www.zope.org/Products/Zope/2.9.8/Zope-2.9.8-final.tgz
fake-zope-eggs = true

[instance]
products =
 ${buildout:directory}/products
 ${productdistros:location}
 ${plone:location}