Version information
This version is compatible with:
- , , ,
Start using this module
Add this module to your Puppetfile:
mod 'ajcrowe-supervisord', '0.6.1'
Learn more about managing modules with a PuppetfileDocumentation
Puppet Supervisord
Puppet module to manage the supervisord process control system.
Functions available to configure
Deprecation warning
To avoid conflict with puppet master's $environment variable, the environment parameter of supervisord::program resource is being renamed program_environment and old name will be removed in future version.
Examples
Examples
Configuring supervisord with defaults
Install supervisord with pip and install an init script if available
include ::supervisord
Install supervisord and pip
Install supervisord and install pip if not available.
class { 'supervisord':
install_pip => true,
}
This will download setuptool and install pip with easy_install.
You can pass a specific url with $setuptools_url = 'url'
Install without pip
If you want to use your system package manager you can specify that with supervisord::package_provider
.
You'll also likely need to adjust the supervisord::service_name
to match that installed by the system package. If you're using Debian, Redhat or Suse OS families you'll also want to disable the init scripts with supervisord::install_init = false
.
Custom Init Script
Only Debian, RedHat and Suse families have an init script included currently. But you can provide custom scripts like this:
class { 'supervisord':
install_init => true,
init_script => '/path/to/init_file',
init_script_template => 'mymodule/template/init.erb',
init_defaults => false
}
HTTP servers
As of version 3.0a3, Supervisor provides an HTTP server that can listen on a Unix socket, an inet socket, or both. By default, this module enables the Unix socket HTTP server. supervisorctl
issues commands to the HTTP server, and it must be configured to talk to either the Unix socket or the inet socket. If only one HTTP server is enabled, this module will configure supervisorctl
to use that HTTP server. If both HTTP servers are enabled, the Unix socket HTTP server will be used by default. To use the inet socket instead, set ctl_socket
to inet
(its default is unix
).
modified
Configure the Unix HTTP server
The Unix HTTP server is enabled by default. Its parameters are:
class { 'supervisord':
unix_socket => true,
run_path => '/var/run',
unix_socket_mode => '0700',
unix_socket_owner => 'nobody',
unix_socket_group => 'nobody',
unix_auth => false,
unix_username => undef,
unix_password => undef,
}
This results in the following config sections:
[unix_http_server]
file=/var/run/supervisor.sock
chmod=0700
chown=nobody:nobody
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock
Configure the Inet HTTP server
The Inet HTTP server is disabled by default. Its parameters are:
class { 'supervisord':
unix_socket => false,
inet_server => true,
inet_server_hostname => '127.0.0.1',
inet_server_port => '9001',
inet_auth => false,
inet_username => undef,
inet_password => undef,
}
This results in the following config sections:
[inet_http_server]
port=127.0.0.1:9001
[supervisorctl]
serverurl=http://127.0.0.1:9001
Override sysconfig template
If supervisord::install_init
is true (the default), then an init script will be installed, and that script will source the contents of the templates/init/${::osfamily}/defaults.erb
file. If you want to override that template, you can set supervisord::init_template
to the path of an alternative template:
class { 'supervisord':
install_pip => true,
init_template => 'my/supervisord/${::osfamily}/defaults.erb'
}
You almost certainly want to copy and add to the original templates, as they contain important settings.
Configure a program
supervisord::program { 'myprogram':
command => 'command --args',
priority => '100',
program_environment => {
'HOME' => '/home/myuser',
'PATH' => '/bin:/sbin:/usr/bin:/usr/sbin',
'SECRET' => 'mysecret'
}
}
You may also specify a variable for a hiera lookup to retreive your environment hash. This allows you to reuse existing environment variable hashes.
supervisord::program { 'myprogram':
command => 'command --args',
priority => '100',
env_var => 'my_common_envs'
}
Or you can fully define your programs in hiera:
supervisord::programs:
'myprogram':
command: 'command --args'
autostart: yes
autorestart: 'true'
program_environment:
HOME: '/home/myuser'
PATH: '/bin:/sbin:/usr/bin:/usr/sbin'
SECRET: 'mysecret'
Configure a group
supervisord::group { 'mygroup':
priority => 100,
programs => ['program1', 'program2', 'program3']
}
Configure a ctlplugin
supervisord::ctlplugin { 'laforge':
ctl_factory => 'mr.laforge.controllerplugin:make_laforge_controllerplugin'
}
Configure an eventlistener
supervisord::eventlistener { 'mylistener':
command => 'command --args',
events => ['PROCESS_STATE', 'PROCESS_STATE_START']
priority => '100',
env_var => 'my_common_envs'
}
Configure an rpcinterface
supervisord::rpcinterface { 'laforge':
rpcinterface_factory => 'mr.laforge.rpcinterface:make_laforge_rpcinterface'
}
Run supervisorctl Commands
Should you need to run a sequence of command with supervisorctl
you can use the define type supervisord::supervisorctl
supervisord::supervisorctl { 'restart_myapp':
command => 'restart',
process => 'myapp'
}
You can also issue a command without specifying a process.
Development
If you have suggestions or improvements please file an issue or pull request, i'll try and sort them as quickly as possble.
If you submit a pull please try and include tests for the new functionality/fix. The module is tested with Travis-CI.
Credits
- Debian init script sourced from the system package.
- RedHat/Centos init script sourced from https://github.com/Supervisor/initscripts
- Suse init script modified from RedHat/Centos script
2016-04-10 - v0.6.1
Enhancements:
- Can now set file mode for configuration files
- Added support for concat versions >2
- 'autostart' param can now be a 'string' or 'bool'
- 'ensure_process' can now be set to unmanaged to disable any 'supervisorctl' command being executed
Fixes:
- Fixed dependency loop issue
Many thanks to @Vincent-- , @rsood-trulia, @walterheck, @davidgubler for all the contributions!
2015-11-22 - v0.6.0
Enhancements:
- Puppet 4 support
- SuSE and Amazon OSs are now supported.
- Added support for systemd in Debian 8 & RedHat/Centos 7.
- Added suppor for enabling or disabling configuration management with '$supervisord::manage_config'.
- Added 'running' to '$ensure_process' for define types to make sure they are started by supervisorctl.
- Added '$package_install_options' for package installation.
- Added '$ctl_socket' param for selecting between 'inet' and 'unix' sockets.
- Added '$init_script', '$init_script_template', '$init_defaults' and 'init_defaults_template' to allow completely custom init scripts.
- 'supervisord::supervisorctl' define now accepts an '$unless' param to add a condition to the exec resource for 'supervisorctl'.
Fixes:
- Fixed '$buffer_size' and '$retries' variable validation.
- Fixed 'inet' and 'unix' server inconsistencies.
- Fixed issue where curl might not have been installed.
Changes:
- Removed unneeded '$executable_path' variable
- Use of '$environment' variable changed to define/class appropriate name such as '$program_environment'.
Thanks to @buzzdeee, @mikeraynham, @md14454, @willaerk, @renepavlik, @maxenced, @nvtkaszpir, @MatthiasWiesner, Kendrick Martin
2015-02-11 - v0.5.2
Enhancements:
- Added RHEL to enable SCL Py27 support, thanks to @dmglab
- Enchanged logfile options to allow 'syslog', 'NONE', 'AUTO' and custom full qualified locations, thanks to @honzik666 and @SteveMaddison for these enhancements
- Added 'FUTURE_PARSER' testing for forward compatibility testing
Fixes:
- Missing slash on 'pid_file' in redhat init script, thanks to @coreone
- Fixed ordering where define type configuration was being written before configuration directories were created, thanks to @mcrumm for the bug report
- Minor lint fixes
2014-12-08 - v0.5.1
Enhancements:
- Added correct process naming when 'numprocs' is greater than '1' thanks to @dol for this
2014-12-03 - v0.5.0
Fixes:
- Fixed template boolean checks, now checks against 'nil' to allow for 'false' to be used.
- Logs files now correctly use 'NONE' and 'AUTO' values.
- Fixed 'supervisord::supervisorctl' define type to have correct spacing.
- Corrected permissions for created conf files.
- Fixed 'unix_username' and 'unix_password' use in 'unix_http_server' config
- Corrected README example class.
Enchancements:
- The 'config_include' location can now be purged with the 'config_include_purge' boolean.
- 'supervisord::rpcinterface' and 'supervisord::ctlplugin' are now available define types.
- boolean define type params can now be both strings and booleans
- supervisord changes will now use 'supervisord::supervisorctl' to reread and update all resources
Notes:
- Bumped 'stdlib' to version '4.4'
Many thanks for the PRs from @kitchen, @jsok, @kamholz, @rayl, @fridim, @pavelsmolka and @dol
2014-08-04 - v0.4.2
Fixes:
- Added Anchors to provide consistence resource ordering, thanks to @jbarbuto
Enhancements:
- Added package_name param, thanks to @jsok
- Added executable_path param and removed hard coding in RedHat init scipt, thanks to @jtreminio
2014-07-02 - v0.4.1
Fixes:
- Fixed status code error on supervisord::supervisorctl commands, thanks to @jtreminio for the PR.
2014-06-20 - v0.4.0
Fixes:
- Removed root as group and replaced with uid 0 to enhance system compatibility
Enhancements:
- Made package provider a user definable param see supervisord::package_provider and README for details of how to change this.
- All define types can now be automatically pulled in from hiera see example https://github.com/ajcrowe/puppet-supervisord#configure-a-program
- You can now override the default include path of $config_include/.conf with your own array using $config_dirs. Bear in mind this would need to include whatever you set $config_include to be, with .conf on the end.
Many thanks for the PRs from @jasperla, @mvantellingen for the bug report on the service name and @hasc for the enhancement ideas.
2014-06-06 - v0.3.3
Fixes:
- Fixed typo in stopwaitsec param, should have been stopwaitsecs, thanks to @rchrd2
2014-05-03 - v0.3.2
Changes:
- Added supervisord::executable_ctl variable for supervisorctl binary path, thanks to @bpgoldsb
2014-04-22 - v0.3.1
Fixes:
- Fixed typo in unix_socket_group param, thanks to @dig412
2014-03-11 - v0.3.0
Fixes:
- Fixed typo in fcgi config
- Fixed typo in supervisord config with minfds and minprocs, thanks to @peefourtee
- Typo in README fixed thanks to @hopkinsth
- Removed refreshonly from pip_install exec resource
- Number of syntax fixes thanks to 'puppet lint'
Important Changes:
- Lots of input validation has been added PLEASE check your config works before upgrading!
- Changed init_extras naming to defaults and cleaned things up.
- Starting and stopping apps is now done with supervisorctl commands to avoid service restarts
Other Changes:
- CSV functions now order things consistently
- Included description for classes and functions
- Expanded spec testing built with Travis CI
- Added beaker acceptance tests
- Added greater validation of various parameters
- Added coverage reporting for resources
To-Do:
- Add support for additional OS families such as Solaris.
2013-10-31 - v0.2.3
Fixes:
- Fixed large bug on debian wheezy where /var/run is changed from a symlink to a directory causing all pids to be inaccessible breaking lots of services
2013-10-30 - v0.2.2
Fixes:
- Fixed syntax error in README examples and tests
2013-10-16 - v0.2.1
Fixes:
- Fixed user params in templates
- Added missing environment support in main supervisord.conf
2013-10-15 - v0.2.0
Feature complete release
- Added Eventlistener template and function
- Added FGCI-Program template and function
- More consistent log naming and fixed missing new lines
2013-10-15 - v0.1.1
Fixes:
- Missing '=' in template tags when using certain parameters
- Added log file default to program define to avoid /tmp being used when not specified
- Fixed logic when not using environment variables in program
2013-10-15 - v0.1.0
Summary:
Completed basic module functionality for
- Install with pip
- Configure programs
- Configure groups
- Install init scripts for RedHat and Debian families
Dependencies
- puppetlabs/stdlib (>= 4.4.0 <5.0.0)
- puppetlabs/concat (>= 1.0.0 <3.0.0)
The MIT License (MIT) Copyright (c) 2014 Alex Crowe Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.