Control production buildouts with supervisor
Yesterday i tried to integrate varnish into a plone3 buildout using plone.recipe.varnish.
This works like a charm. I added /bin/instance to rc.d and tried to do the same with varnish to make it start automatically.
When asking for a solution to stop varnish on #plone, wiggy and aclark suggested to use supervisor.
Aclark recently worte a blogpost about supervisor and asked for a way to make buildout generate the supervisord.conf and a paster template that includes supervisor.
Wiggy just checked in ZopeSkel2.0 with supervisor added to the plone_hosting template.
Since it’s added using zc.recipe.egg the supervisord.conf has to be created and modified manually and is not generated with bin/buildout.
This is what collective.recipe.supervisor does for you.
The following setup worked fine for me:
[varnish-build]
;find newer versions on http://varnish.projects.linpro.no/
recipe = plone.recipe.varnish:build
url = http://switch.dl.sourceforge.net/sourceforge/varnish/varnish-1.1.2.tar.gz
[varnish]
recipe = plone.recipe.varnish:instance
bind = *:6181
backends = 127.0.0.1:8180
cache-size = 512M
# foreground is needed for supervisor to control varnish correctly
mode = foreground
[supervisor]
#recipe = zc.recipe.egg
#eggs = supervisor
recipe = collective.recipe.supervisor
port = localhost:9001
user = admin
password = admin
programs =
10 zope ${instance:location}/bin/runzope ${instance:location} true
20 varnish ${buildout:directory}/bin/varnish true
Make sure you’re starting supervisor with root privileges.
Otherwhise varnish will be started but supervisor won’t recognice it’s running.
Now you just add supervisor to your default runlevels, instead of adding every service of your instance.:
cd /etc/init.d/ ln -s INSTANCE_HOME/bin/supervisord project-supervisord ln -s INSTANCE_HOME/bin/supervisorctl project-supervisorctl update-rc.d project-supervisord defaults
control the services using /etc/init.d/project-supervisorctl
shutdown supervisor and all started services: /etc/init.d/project-supervisorctl shutdown
