A buildout recipe to install supervisor
Project description
Code repository: https://svn.plone.org/svn/collective/collective.recipe.supervisor
Change history
0.1.0 (2008-04-21)
Created recipe with ZopeSkel [Mustapha Benali].
Detailed Documentation
This recipe when used will do the following:
install supervisor and all its dependecies.
generates the supervisord and supervisorctl scripts in the bin directory
generates a configuration file to be used by supervisord and supervisorctl scripts
Supported options
The recipe supports the following options:
- port
The port nummber supervisord listen to. ie: 9001. Can be given as host:port like 127.0.0.1:9001. Defaults to 127.0.0.1:9001
- user
The username required for authentication to supervisord
- password
The password required for authentication to supervisord
- supervisord-conf
Full path to where the recipe puts the supervisord configuration file. Defaults to ${buildout:directory}/bin/supervisord.conf
- logfile
The full path to the supervisord log file. Defaults to ${buildout:directory}/var/log/supervisord.log
- pidfile
The pid file of supervisord. Defaults to ${buildout:directory}/var/supervisord.pid
- logfile-maxbytes
The maximum number of bytes that may be consumed by the activity log file before it is rotated. Defaults to 50MB
- logfile-backups
The number of backups to keep around resulting from activity log file rotation. Defaults to 10
- loglevel
The logging level. Can be one of critical, error, warn, info, debug, trace, or blather. Defaults to info
- nodaemon
If true, supervisord will start in the foreground instead of daemonizing. Defaults to false
- serverurl
The URL that should be used to access the supervisord server. Defaults to http://127.0.0.1:9001
- programs
A list of programs you want the supervisord to control. One per line. The format of a line is as follow:
priority process_name executable [[directory] [[redirect_stderr]]]
If not given the redirect_stderr defaults to false. If not given the directory option defaults to the directory containing the executable. See below for an example.
Example usage
We’ll start by creating a buildout that uses the recipe:
>>> write('buildout.cfg',
... """
... [buildout]
... parts = supervisor
...
... [zeo]
... location =
... [instance1]
... location =
... [instance2]
... location=
...
... [supervisor]
... recipe = collective.recipe.supervisor
... port = 9001
... user = mustapha
... password = secret
... serverurl = http://supervisor.mustap.com
... programs =
... 10 zeo ${buildout:bin-directory}/zeo ${zeo:location}
... 20 instance1 ${buildout:bin-directory}/instance1 ${instance1:location} true
... 30 instance2 ${buildout:bin-directory}/instance2
... 40 maildrophost ${buildout:bin-directory}/maildropctl
... """)
Running the buildout gives us:
>>> print system(buildout) Installing supervisor. Getting distribution for 'supervisor'. ... Generated script '/sample-buildout/bin/supervisorctl'. Generated script '/sample-buildout/bin/supervisord'. <BLANKLINE>
You can now just run the supervisord like this:
$ bin/supervisord
and control it with supervisorctl:
$ bin/supervisorctl
now, get a look to the generated supervisord.conf file:
>>> cat('bin', 'supervisord.conf')
<BLANKLINE>
[inet_http_server]
port = 9001
username = mustapha
password = secret
<BLANKLINE>
[supervisord]
logfile = /sample-buildout/var/log/supervisord.log
logfile_maxbytes = 50MB
logfile_backups = 10
loglevel = info
pidfile = /sample-buildout/var/supervisord.pid
nodaemon = false
<BLANKLINE>
[supervisorctl]
serverurl = http://supervisor.mustap.com
<BLANKLINE>
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
<BLANKLINE>
<BLANKLINE>
[program:zeo]
command = /sample-buildout/bin/zeo
process_name = zeo
directory = /sample-buildout/bin
priority = 10
redirect_stderr = false
<BLANKLINE>
<BLANKLINE>
[program:instance1]
command = /sample-buildout/bin/instance1
process_name = instance1
directory = true
priority = 20
redirect_stderr = false
<BLANKLINE>
<BLANKLINE>
[program:instance2]
command = /sample-buildout/bin/instance2
process_name = instance2
directory = /sample-buildout/bin
priority = 30
redirect_stderr = false
<BLANKLINE>
<BLANKLINE>
[program:maildrophost]
command = /sample-buildout/bin/maildropctl
process_name = maildrophost
directory = /sample-buildout/bin
priority = 40
redirect_stderr = false
<BLANKLINE>
and if we look to generated supervisord script we will see that the configuration file is given as argument with the ‘-c’ option:
>>> cat('bin', 'supervisord')
...
<BLANKLINE>
...
<BLANKLINE>
import sys; sys.argv.extend(["-c","/sample-buildout/bin/supervisord.conf"])
<BLANKLINE>
import supervisor.supervisord
<BLANKLINE>
if __name__ == '__main__':
supervisor.supervisord.main()
Contributors
Mustapha Benali, Author
Download
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file collective.recipe.supervisor-0.1.tar.gz.
File metadata
- Download URL: collective.recipe.supervisor-0.1.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99831c0b48880b70bd7852cbf1b72e7133abaaa3d849e240ed419786f6a749ea
|
|
| MD5 |
2ff237560f2764424b4897aef89b4e45
|
|
| BLAKE2b-256 |
1127b16d74edcb7820b2d3c95291abc005287a7603c275b36b2fa80ca9a35b6c
|
File details
Details for the file collective.recipe.supervisor-0.1-py2.4.egg.
File metadata
- Download URL: collective.recipe.supervisor-0.1-py2.4.egg
- Upload date:
- Size: 12.3 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b5533dca609d33a637e2c7cdc09f140082a1e2ae1decbd60d4b012485baf3ba
|
|
| MD5 |
211aa2deb5aef085755271486b050c65
|
|
| BLAKE2b-256 |
3d74b9f31c0020f56aff9f6004ccebf3029fb777a60d29d7760328b25e4d3893
|