Package: collective.recipe.supervisor
ContentsDetailed DocumentationSupported optionsExampleUpgradingSource CodeChange history1.0.0 (2019-04-15)0.20 (2015-10-06)0.19 (2013-01-09)0.18 (2012-11-16)0.17 (2011-07-28)0.16 (2011-03-07)0.15 (2011-03-05)0.14 (2010-12-10)0.13 (2010-12-07)0.12 (2010-08-04)0.11 (2010-08-02)0.10.1 (2010-07-27)0.10 (2010-06-03)0.9 (2009-11-04)0.8 (2009-04-27)0.7 (2009-01-27)0.6 (2008-11-10)0.5 (2008-08-23)0.4 (2008-06-12)0.3 (2008-06-01)0.2 (2008-04-23)0.1 (2008-04-21)ContributorsDetailed DocumentationThis recipe when used will do the following:installsupervisorand all its dependecies.generates thesupervisord,supervisorctl, andmemmonscripts in thebindirectorygenerates a configuration file to be used bysupervisordandsupervisorctlscriptsSupported optionsThe recipe supports the following options:sectionsList of enabled supervisor sections.
Defaults to enable all:global http ctl rpc services.pluginsExtra eggs you want the recipe to install, e.g.superlancehttp-socketinetorunixsocket to use for HTTP administration. Defaults toinet.fileA path to a UNIX domain socket (e.g./tmp/supervisord.sock) on which
supervisor will listen for HTTP/XML-RPC requests.chmodChange the UNIX permission mode bits of the UNIX domain socket to this value at startup.chownChange the ownership of the UNIX domain socket to this value at startup.
Eitheruseroruser:group.portThe port numbersupervisordlistens to, e.g.9001. Can be given ashost:port, e.g.127.0.0.1:9001. Defaults to127.0.0.1:9001userThe username required for authentication to supervisordpasswordThe password required for authentication to supervisordsupervisord-confFull path to where the recipe puts the supervisord configuration file.
Defaults to${buildout:directory}/parts/${name}/supervisord.confsupervisord-userIf supervisord is run as the root user, switch users to this UNIX user
account before doing any meaningful processing. This value has no effect
if supervisord is not run as root.supervisord-directoryWhen supervisord daemonizes, switch to this directory. This option can
include the value%(here)s, which expands to the directory in which the
supervisord configuration file was found.supervisord-environmentA list of key/value pairs in the formKEY=val,KEY2=val2that will be placed
in the supervisord process’s environment (and as a result in all of its
child processes’ environments). This option can include the value%(here)s,
which expands to the directory in which the supervisord configuration file
was found. Note that subprocesses will inherit the environment variables of
the shell used to start supervisord except for the ones overridden here and
within the program’s environment configuration stanza.childlogdirThe full path of the directory where log files of processes managed by
Supervisor while be stored. Defaults to${buildout:directory}/var/loglogfileThe full path to the supervisord log file. Defaults to${buildout:directory}/var/log/supervisord.logpidfileThe pid file of supervisord. Defaults to${buildout:directory}/var/supervisord.pidlogfile-maxbytesThe maximum number of bytes that may be consumed by the activity log file
before it is rotated. Defaults to 50MB.logfile-backupsThe number of backups to keep around resulting from activity log file
rotation. Defaults to 10.loglevelThe logging level. Can be one ofcritical,error,warn,info,debug,trace,
orblather. Defaults toinfo.umaskThe umask of the supervisord process. Defaults to022.nodaemonIf true, supervisord will start in the foreground instead of daemonizing.
Defaults to false.nocleanupPrevent supervisord from clearing any existing AUTO child log files at
startup time. Useful for debugging. Defaults to false.serverurlThe URL that should be used to access the supervisord server. Defaults tohttp://127.0.0.1:9001programsA list of programs you want the supervisord to control. One per line.
The format of a line is as follows:priority process_name [(process_opts)] command [[args] [directory] [[redirect_stderr]] [user]]The[args]are any number of arguments you want to pass to thecommand.
It has to be given between[](e.g.[-vfg]). See examples below.
If not given,redirect_stderrdefaults to false.
If not given, thedirectoryoption defaults to the directory containing the
the command.
The optionalprocess_optsargument sets additional options on the proccess
in the supervisord configuration.
It has to be given between()and must contain options inkey=valueformat
with spaces only for separating options – e.g.(autostart=false startsecs=10).
The optionaluserargument gives the userid that the process should be run
as (if supervisord is run as root).In most cases you will only need to give the 4 first parts:priority process_name command [[args]]eventlistenersA list of eventlisteners you’d like supervisord to run as subprocesses to
subscribe to event notifications. One per line. Relevant supervisor
documentation about events is athttp://supervisord.org/events.htmlprocessname [(process_opts)] events command [[args]]eventsis a comma-separated list (without spaces) of event type names
that the listener is interested in receiving notifications for.Supervisor provides one event listener calledmemmonwhich can be used to
restart supervisord child process once they reach a certain memory limit.
Note that you need to define the variablesuser,passwordandserverurl(described in the supported options above) to be able to use the memmon listener.
An example of defining a memmon event listener, which analyzes memory usage
every 60 seconds and restarts as needed could look like:MemoryMonitor TICK_60 ${buildout:bin-directory}/memmon [-p process_name=200MB]As eventlisteners are a special case of processes, the also accept process
options. One useful option is to start an eventlistener like the HttpOk
checker only after your webserver has had time to start and load, say
after 20 seconds:HttpOk (startsecs=20) TICK_60 ${buildout:bin-directory}/httpok [-p web -t 20 http://localhost:8080/]groupsA list of programs that become part of a group. One per line.
The format of a line is as follow:priority group_name program_namesprograms_nameis a comma-separated list of program names.env-pathThe environment variable PATH, e.g./bin:/sbin:/usr/bin:/usr/sbin:/usr/local/binExample[buildout]
parts = supervisor

# ...configure zope/zeo here...

[supervisor]
recipe = collective.recipe.supervisor

port = 9001
user = johndoe
password = secret
serverurl = http://supervisor.johndoe.com

plugins =
      superlance

programs =
      10 zeo ${zeo:location}/bin/runzeo ${zeo:location}
      20 instance1 ${instance1:location}/bin/runzope ${instance1:location} true
      30 instance2 (autostart=false) ${instance2:location}/bin/runzope true
      40 maildrophost ${buildout:bin-directory}/maildropctl true
      50 other ${buildout:bin-directory}/other [-n 100] /tmp
      60 other2 ${buildout:bin-directory}/other2 [-n 100] true
      70 other3 (startsecs=10) ${buildout:bin-directory}/other3 [-n -h -v --no-detach] /tmp3 true www-data

eventlisteners =
      Memmon TICK_60 ${buildout:bin-directory}/memmon [-p instance1=200MB]
      HttpOk (startsecs=20) TICK_60 ${buildout:bin-directory}/httpok [-p instance1 -t 20 http://localhost:8080/]

groups =
      10 services zeo,instance1
      20 others other,other2,other3UpgradingIf upgrading from v0.19 to 0.20 thesectionsparameter got two new sectionsglobalandservices.
Ifsectionsparameter was set in old buildout config: in order to get the same behavior as before append the two new section names to value ofsections.Source CodeThe sources are in a GIT DVCS with its main branches atgithub collective.We’d be happy to see many contributions to make it even better.Change history1.0.0 (2019-04-15)Improved code quality, fixing flake8 warning ‘W605 invalid escape sequence’ for regular expressions.  [maurits]Support thechownoption in theunix_http_serversection.  [guewen]Tested with Python 2.7, 3.6, 3.7.  [davidweterings, maurits]0.20 (2015-10-06)Fix tests to be able to run.
Fixeshttps://github.com/collective/collective.recipe.supervisor/issues/10[gforcada]fix: memscript install script did not get conf file because of a typo.
[moriyoshi]Feature: exclude global configuration so the generated file can be used
to be included by a system wide supervisord.
[jensens]Cleanup/overhaul/pep8 of code base, include self contained buildout with
testrunner
[jensens]0.19 (2013-01-09)Fix the dissapearance of dependencies from the picked eggs after the
first run of buildout.
[afrepues]Fix e-mail address in project history file, somehow it was wrong, oh
well.
[afrepues]0.18 (2012-11-16)Add travis-ci support
[fredvd]Add process options to eventlisteners so you can for example delay them.
[fredvd]Fix doctests, pin supervisor and superlance in the doctests
[fredvd]Add support for setting user, directory and environment options of
supervisord
[anthonygerrard]0.17 (2011-07-28)Added support for process groups
[nueces]0.16 (2011-03-07)Fix supervisorctl to use unix_http_server if used
[Domen Kožar, NiteoWeb. Work sponsored by Hexagon IT]0.15 (2011-03-05)Added support for unix_http_server additionally to inet_http_server
[Domen Kožar, NiteoWeb. Work sponsored by Hexagon IT]0.14 (2010-12-10)Added support for the umask option of supervisord
[afrepues@mcmaster.ca]Move the credentials needed for authenticating with the supervisord
process from the supervisorctl script to the configuration
file. Because of bug 180705 of zc.buildout, scripts are made
world-readable. [afrepues@mcmaster.ca]0.13 (2010-12-07)‘nocleanup’ option of Supervisor is now configurable from Buildout
Patch from Damien Letournel0.12 (2010-08-04)Quote the environment variables that are written in the supervisor
configuration file for eventlisteners, otherwise supervisor will not pass
them on correctly to for example memmon [Fred van Dijk]0.11 (2010-08-02)‘childlogdir’ option of Supervisor is now configurable from Buildout
[Jonathan Ballet][include] functionnality in the supervisor configuration file.
Seehttp://supervisord.org/configuration.html#include[ycadour]0.10.1 (2010-07-27)Updated documentation about how to use the memmon event listener [lucielejard]0.10 (2010-06-03)Added an option for the environment variable PATH
[lucielejard]Added support for disabling supervisor sections (such as http, rpc and ctl) [Domen Kozar]0.9 (2009-11-04)Applied Jonathan Ballet’s patch: The generated control script doesn’t
automatically connect on the created supervisord when running on a custom port.0.8 (2009-04-27)Make it possible to set additional options per process in the control script.
[nkryptic]0.7 (2009-01-27)Added ‘plugins’ option so we can install extra eggs (supervisor plugins)
[mustapha]Some fixes for eventlistner part [mustapha]Updated tests0.6 (2008-11-10)One can now specify the user account that will be used as the account
which runs the program.
[amos]0.5 (2008-08-23)Adding eventlistners option for use as event notification framework.
Targetting use with supervisor’s memmon event listener
[aburkhalter]0.4 (2008-06-12)Use dynamic script names to allow multiple cluster
[gawel]Ensure that the log dir is created when used without zope’s recipes
[gawel]0.3 (2008-06-01)Updated docs and tests
[mustapha]pep8 cosmetics
[mustapha]Make it possible to pass in arguments to the control script.
[hannosch]Put all specified options, like server url and username into the generated
control script. This allows to run it as is.
[hannosch]0.2 (2008-04-23)Make possible to pass arguments to the command so one can use ctl scripts
with supervisor with arguments like ‘fg’ for zope instances or –no-detach
or something similar for other programs
[mustapha]updated tests
[mustapha]0.1 (2008-04-21)Created recipe with ZopeSkel [Mustapha Benali].ContributorsMustapha Benali, AuthorHanno Schlichting, Contributorgawel, Contributoraburkhalter, ContributorAmos Latteier, ContributorJacob Radford, ContributorJonathan Ballet, ContributorDomen Kozar, ContributorLucie Lejard, ContributorServilio Afre Puentes, ContributorJuan A. Diaz (nueces), ContributorFred van Dijk (fredvd), ContributorJens W. Klein (jensens), Contributor