Git Product home page Git Product logo

puppet-supervisord's Introduction

Puppet Supervisord

Puppet Forge Build Status

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

puppet-supervisord's People

Contributors

ajcrowe avatar brutus333 avatar buzzdeee avatar c4m4 avatar caylorme avatar dig412 avatar dmglab avatar dol avatar fridim avatar h0tw1r3 avatar janbraiins avatar jasperla avatar jsok avatar jtreminio avatar kam1kaze avatar kitchen avatar mathiasaerts avatar matthiaswiesner avatar maxenced avatar md14454 avatar mikeraynham avatar mookie- avatar nvtkaszpir avatar peefourtee avatar rayl avatar renepavlik avatar rsood-trulia avatar stevemaddison avatar vincent-- avatar wardhus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

puppet-supervisord's Issues

Error: curl https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | python returned 1 instead of one of [0]

Hi,

I just tried to install supervisord with the default config on a fresh debian jessie as well as ubuntu 14.04 and with both OS get the same error message:

curl https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | python returned 1 instead of one of [0]

Looks like when I execute the command with sudo privileges directly in the console everything works fine. Anyone knows if this is a bug or am I doing something wrong?

Kind regards
hasc

Pip meld error on supervisor start

Error from agent run (relevant part seems to be python meld3 error)

09/12/15 14:52:46 [email protected] ~: sudo puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: You need the `newrelic_rpm` gem. sudo /opt/puppet/bin/gem install newrelic_rpm
Info: Caching catalog for honshuu-api-lb2.wdc.sl
Warning: /Apt_key[Add key: C43C79AD from Apt::Source logentries]: The id should be a full fingerprint (40 characters), see README.
Info: Applying configuration version '1449672774'
Error: Could not start Service[supervisord]: Execution of '/etc/init.d/supervisord start' returned 1: Starting supervisor: Traceback (most recent call last):
  File "/usr/local/bin/supervisord", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2707, in <module>
    working_set.require(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 686, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 584, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: meld3>=0.6.5
Error: /Stage[main]/Supervisord::Service/Service[supervisord]/ensure: change from stopped to running failed: Could not start Service[supervisord]: Execution of '/etc/init.d/supervisord start' returned 1: Starting supervisor: Traceback (most recent call last):
  File "/usr/local/bin/supervisord", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2707, in <module>
    working_set.require(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 686, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 584, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: meld3>=0.6.5
Notice: /Stage[main]/Supervisord/Anchor[supervisord::end]: Dependency Service[supervisord] has failures: true
Warning: /Stage[main]/Supervisord/Anchor[supervisord::end]: Skipping because of failed dependencies
Notice: /Stage[main]/Supervisord::Reload/Exec[supervisorctl_reread]: Dependency Service[supervisord] has failures: true
Warning: /Stage[main]/Supervisord::Reload/Exec[supervisorctl_reread]: Skipping because of failed dependencies
Notice: /Stage[main]/Supervisord::Reload/Exec[supervisorctl_update]: Dependency Service[supervisord] has failures: true
Warning: /Stage[main]/Supervisord::Reload/Exec[supervisorctl_update]: Skipping because of failed dependencies
Notice: /Stage[main]/Site::Api/Supervisord::Supervisorctl[restart_api]/Exec[supervisorctl_command_restart_api]: Dependency Service[supervisord] has failures: true
Warning: /Stage[main]/Site::Api/Supervisord::Supervisorctl[restart_api]/Exec[supervisorctl_command_restart_api]: Skipping because of failed dependencies
Notice: Finished catalog run in 9.87 seconds

Supervisor start error

 ~: sudo service supervisord start 
Starting supervisor: Traceback (most recent call last):
  File "/usr/local/bin/supervisord", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2707, in <module>
    working_set.require(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 686, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 584, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: meld3>=0.6.5

list of pip modules

 ~: pip freeze
apt-xapian-index==0.44
chardet==2.0.1
command-not-found==0.2.44
GnuPGInterface==0.3.2
language-selector==0.1
meld3==1.0.2
psutil==0.4.1
pycurl==7.19.0
python-apt===0.8.3ubuntu7.3
python-debian===0.1.21ubuntu1
setproctitle==1.0.1
simplejson==2.3.2
supervisor==3.2.0
ufw==0.31.1.post1
unattended-upgrades==0.1
/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning

puppet modules

/etc/puppetlabs/puppet/modules
├── ajcrowe-supervisord (v0.5.2)
├── deric-storm (v0.3.0)
├── deric-zookeeper (v0.3.9)
├── dwerder-graphite (v5.14.0)
├── jfryman-nginx (v0.2.7)
├── joshcooper-powershell (v0.0.6)
├── kafka (???)
├── maestrodev-statsd (v1.0.4)
├── puppetlabs-apt (v1.8.0)
├── puppetlabs-concat (v1.2.2)
├── puppetlabs-inifile (v1.2.0)
├── puppetlabs-java (v1.4.0)
├── puppetlabs-logentries (v0.1.0)
├── puppetlabs-nodejs (v0.8.0)
├── puppetlabs-registry (v1.1.0)
├── puppetlabs-stdlib (v4.6.0)
├── richardc-datacat (v0.6.1)
├── saz-ssh (v2.8.1)
└── serverdensity-serverdensity_agent (v0.9.5)

Fixed this by pip uninstall and installing
pip install meld3==1.0.0

Invalid exit status

Seeing the following at the end of my Vagrant provision

Error: /Stage[main]/Supervisord::Reload/Exec[supervisorctl_reread]: Failed to call refresh: /usr/local/bin/supervisorctl reread returned 2 instead of one of [0]
Error: /Stage[main]/Supervisord::Reload/Exec[supervisorctl_reread]: /usr/local/bin/supervisorctl reread returned 2 instead of one of [0]
Error: /Stage[main]/Supervisord::Reload/Exec[supervisorctl_update]: Failed to call refresh: /usr/local/bin/supervisorctl update returned 2 instead of one of [0]
Error: /Stage[main]/Supervisord::Reload/Exec[supervisorctl_update]: /usr/local/bin/supervisorctl update returned 2 instead of one of [0]

not working on debian 8

Error: Could not start Service[supervisord]: Execution of '/usr/sbin/service supervisord start' returned 6: Failed to start supervisord.service: Unit supervisord.service failed to load: No such file or directory.

Puppet always execute start for program with numprocs != 1

Status check for single process works okay. But for homogeneous group systemctl status program returns "No such process" because correct syntax is systemctl status program:XX. So, the check always fails and puppet always reapplying start command.

puppetforge latest release

Hello, Would it be possible to submit an updated version of this module to the PuppetForge? I'm looking for the new $program_environment param in supervisord::program and it's not in 0.5.2 (latest on forge). Thank you

No option to configure multiple drectories in the [include] section.

Hi,

first thanks for sharing this module.

I am have the problem that it is not possible to configure multiple directories in the [include] section of the supervisord.conf file. According to the configuration reference of supervisord this would be possible.

I wrote an augeas script to place whatever value i want but the module realizes this and overwrites it again. Which is somehow good and sad.

Making the configuration more flexible here, would be a great thing.

Thanks
Hannes

Supervisor Service fails to restart on supervisord crash

While testing the plugin, puppet starts the supervisord service and the processes managed by supervisord, but if for some reason supervisord crashes, puppet does not restart the service.
I get the following message:

Notice: /Stage[main]/Main/Node[default]/Service[supervisord]/ensure: ensure changed 'stopped' to 'running'
Info: /Stage[main]/Main/Node[default]/Service[supervisord]: Unscheduling refresh on Service[supervisord]

and the service does not come up. I am not sure if this is caused by supervisor plugin or by puppet.
Please suggest

Pip is not installing

I set install_pip to true but the pip command is missing.

Using a clean debian 7.8 image.

Concat fails - Could not retrieve information from environment production source

Hi,

I'm using puppet version 3.8.7 and version 0.6.1 of this module, when I use:

include ::supervisord

To include the module, I see the following errors on a client:

Error: /Stage[main]/Supervisord::Config/Concat[/etc/supervisord.conf]/File[/etc/supervisord.conf]: Could not evaluate: Could not retrieve information from environment production source(s) file:/var/lib/puppet/concat/_etc_supervisord.conf/fragments.concat.out

I've not specified any other options, initially I just want to install the module. Is there some dependancy I don't yet have installed? Any help would be greatly appreciated!

r

Issue with 'ensure_process = running' and group

I'm not sure the approach in this PR is working when using group...
#72

In my case, the program name is "ecard-generate-pdf_01" and the group name is "ecard".

root:/etc/supervisor/conf.d$ supervisorctl status
ecard:ecard-generate-pdf_01      STOPPED    Not started

If I try to start the program using only its name (as it's done by the puppet module), that doesn't work:

root:/etc/supervisor/conf.d$ supervisorctl start ecard-generate-pdf_01
ecard-generate-pdf_01: ERROR (no such process)

I need to use the full name of the program (ie, group:program):

root:/etc/supervisor/conf.d$ supervisorctl start ecard:ecard-generate-pdf_01
ecard:ecard-generate-pdf_01: started

Due to that, every time I run puppet, the module try to start the programs unsuccessfully....

Wrong variable in templates/supervisord_unix.erb

Both unix auth should look like this:

<% if @unix_auth -%>
username=<%= @unix_username %>
password=<%= @unix_password %>
<% end -%>

Right now one of them has unix_socket_username and unix_socket_password vars instead.

Dependency cycle when using supervisord::group

The latest release 0.6.0 (workes with 0.5.1) has a problem with a dependency cycle when using the following example:

include ::supervisord

supervisord::program { 'program1':
  command             => 'command --args',
}

supervisord::program { 'program2':
  command             => 'command --args',
}

supervisord::group { 'mygroup':
  programs => ['program1', 'program2']
}

Error message:

==> default: Error: Failed to apply catalog: Found 1 dependency cycle:
==> default: (Exec[supervisorctl_command_start_program1] => Supervisord::Supervisorctl[start_program1] => Supervisord::Program[program1] => Supervisord::Group[mygroup] => File[/etc/supervisor.d/group_mygroup.conf] => Class[Supervisord::Reload] => Exec[supervisorctl_update] => Class[Supervisord::Reload] => Supervisord::Supervisorctl[start_program1] => Exec[supervisorctl_command_start_program1])

To visualize the problem I created a dependency graph.

image.

Could not locate the pip command. at 5:/etc/puppet/modules/supervisord/manifests/install.pp

Hey, maybe this is stupid problem. But I'm new here to puppet and ruby, I cannot find any other help...

What I did:

  1. Install: puppet module install ajcrowe-supervisord
  2. [root@localhost puppet]# cp modules/supervisord/tests/init.pp manifests/
  3. [root@localhost puppet]# puppet apply manifests/init.pp

Here is the output:
Warning: Config file /etc/puppet/hiera.yaml not found, using Hiera defaults
Notice: Compiled catalog for puppettest.asia.polycom.com in environment production in 1.42 seconds
Notice: /Stage[main]/Supervisord::Pip/Exec[pip_provider_name_fix]/returns: executed successfully
Error: Could not set 'present' on ensure: Could not locate the pip command. at 5:/etc/puppet/modules/supervisord/manifests/install.pp
Error: Could not set 'present' on ensure: Could not locate the pip command. at 5:/etc/puppet/modules/supervisord/manifests/install.pp
Wrapped exception:
Could not locate the pip command.
Error: /Stage[main]/Supervisord::Install/Package[supervisor]/ensure: change from absent to present failed: Could not set 'present' on ensure: Could not locate the pip command. at 5:/etc/puppet/modules/supervisord/manifests/install.pp

Configurable service name

When using package_provider = 'apt' ubuntu installs an init.d script as /etc/init.d/supervisor The service.pp file assumes that it is called /etc/init.d/supervisord. Perhaps this also needs to be configurable?

puppetlabs-concat >= 2.0.0

Could you please verify puppet-supervisord for puppetlabs-concat >= 2.0.0 compatibility and update metadata.json?

Wrong supervisorctl path for Centos 6.4

I'm getting the following error:
'Error: /Stage[main]/Supervisord::Reload/Exec[supervisorctl_reread]: Failed to call refresh: Could not find command '/usr/local/bin/supervisorctl'

And while /usr/local/bin/supervisorctl does not exist, /usr/bin/supervisorctl does exist.

buffer_size validate_re gives an error with the defaults

when trying to run an install, I am getting:
Error: Evaluation Error: Error while evaluating a Function Call, validate_re(): 10 does not match "^\d+" at /etc/puppetlabs/code/environments/production/modules/supervisord/manifests/eventlistener.pp:51:3

It is non-obvious why this is not matching. I am NOT setting buffer_size, leaving it as default. Any help is appreciated.

Could not find init script for 'supervisord'

On debian 8 in a docker container:
puppet 4.8.1
module version 0.6.1

class supervisor_daemon {
    supervisord::program { 'sshd':
      command             => '/usr/sbin/sshd',
      priority            => '10',
    }

    supervisord::program { 'mariadb':
      command             => '/usr/sbin/mysqld',
      priority            => '20',
    }

    supervisord::program { 'nullmailer':
      command             => '/usr/sbin/nullmailer-send -s',
      priority            => '110',
    }
}

Leads into following error:
Error: Could not find init script for 'supervisord'
Error: /Stage[main]/Supervisord::Service/Service[supervisord]/ensure: change from stopped to running failed: Could not find init script for 'supervisord'

Supervisord doesn't applies configuration right away

To reproduce, you can try to change socket file's mode and check the actual socket file permission after a puppet's pass.

I bet there is a problem appeared when module has been changed in the way it notifies supervisord after configuration changes (in init.pp):
Class['supervisord::config'] ~> Class['supervisord::reload']

The problem is that supervisord must be restarted (not reloaded) in order to apply changes of "main" configuration (supervisord.conf). I'm not pushing PR coz I'm totally unsure the way we'd like to fix it (I use the module only 1 month long).

Locally I've added fast and dirty hack to restart supervisord on any supervisord.conf changed like that:

diff --git a/supervisord/manifests/config.pp b/supervisord/manifests/config.pp
index 1c8bd8e..b6b2277 100644
--- a/supervisord/manifests/config.pp
+++ b/supervisord/manifests/config.pp
@@ -49,7 +49,8 @@ class supervisord::config inherits supervisord {
concat { $supervisord::config_file:
owner => 'root',
group => '0',

  • mode => '0644'
  • mode => '0644',
  • notify => Service["$supervisord::service_name"]
    }

if $supervisord::unix_socket {
#####################################################################

However, more sane solution would be abstract all conf file snippets related to supervisord itself in a set of concat::fragment with such a notify.

ability to specify supervisord::params as resource

Thank you for this module it is very useful.

supervisord::params has a number of defaults configured in params.pp , it would be nice to be able to set these as a resource within another class like the other ones (eventlistener, group, program, fcgi_program). I see no way of doing this other then modifying the class itself in the module as it is not declared as a resource.

Issue with hiera lookup and boolean value

I'm currently using hiera to create my program:

foo_autostart: true

supervisor_programs:
    'foo':
        command        : "foo"
        [...]
        autostart      : "%{hiera('foo_autostart')}"

And for some reason, I have to use a hiera lookup for the autostart value.
With puppet 3.8.4 and hiera 1.3.4 and the code above, this ends up with autostart = "true". As the module is checking if the value is a real boolean, the compilation fails because "true" is a string.

Based on my knowledge, it's not possible to do a hiera lookup with boolean.

So I'm wondering if we cannot replaced this check:

if $autostart { validate_bool($autostart) }

by this one (already used for the autorestart param):

if $autostart { if !is_bool($autostart) { validate_re($autostart, ['true', 'false']) } }

or even if we cannot use the str2bool func like this (not tested, but you get the idea):

if $autostart { if !is_bool($autostart) { $autostart=str2bool($autostart) } }

See https://forge.puppetlabs.com/puppetlabs/stdlib#str2bool

I'm happy to do the PR, but need to know which solution you want to be implemented...

stdout_logfile & stderr_logfile misinterprets "syslog" value

Setting stdout_logfile or stderr_logfile to "syslog" results in a configuration file that reads:

stdout_logfile=/var/log/supervisor/syslog
stderr_logfile=/var/log/supervisor/syslog

This is incorrect, as it should read:

stdout_logfile=syslog
stderr_logfile=syslog

Doing so will result in the application appropriately logging to syslog instead of maintaining it's own logfile. This applies to [program:x], [fcgi-program:x], and [eventlistener:x].

Reference:
http://supervisord.org/logging.html?highlight=syslog#child-process-logs

Ubuntu executable path is incorrect

If a package is used instead of pip then the path is /usr/bin/supervisord not /usr/local/bin/supervisord

This can be worked around with supervisord::executable: '/usr/bin/supervisord' but it seems like it should know this.

support for loglevel

Is the loglevel configurable? Didnt found anywhere

http://supervisord.org/logging.html

The activity log “level” is configured in the config file via the loglevel parameter in the [supervisord] ini file section. When loglevel is set, messages of the specified priority, plus those with any higher priority are logged to the activity log. For example, if loglevel is error, messages of error and critical priority will be logged. However, if loglevel is warn, messages of warn, error, and critical will be logged.

supervisord service fails to start when defining programs on the class

I encountered a problem when trying to define programs and groups on the supervisord class.

It looks like the create_resources calls for groups and programs aren't being properly anchored to ensure their existence before the service attempts to start.

Here's a snippet from a puppet run, showing the service attempting to start before all the programs have been defined.

Notice: /Stage[main]/Supervisord/Supervisord::Group[my-workers]/File[/etc/supervisor.d/group_my-workers.conf]/ensure: created�
Debug: /Stage[main]/Supervisord/Supervisord::Group[my-workers]/File[/etc/supervisor.d/group_my-workers.conf]: The container Supervisord::Group[my-workers] will propagate my refresh event�
Info: /Stage[main]/Supervisord/Supervisord::Group[my-workers]/File[/etc/supervisor.d/group_my-workers.conf]: Scheduling refresh of Class[Supervisord::Reload]�
Debug: Supervisord::Group[my-workers]: The container Class[Supervisord] will propagate my refresh event�
Notice: /Stage[main]/Supervisord::Config/Concat::Fragment[supervisord_unix]/File[/var/lib/puppet/concat/_etc_supervisord.conf/fragments/01_supervisord_unix]/ensure: defined content as '{md5}2a371bf6742698a806a2ab9879d60540'�
Info: /Stage[main]/Supervisord::Config/Concat::Fragment[supervisord_unix]/File[/var/lib/puppet/concat/_etc_supervisord.conf/fragments/01_supervisord_unix]: Scheduling refresh of Exec[concat_/etc/supervisord.conf]�
Debug: /Stage[main]/Supervisord::Config/Concat::Fragment[supervisord_unix]/File[/var/lib/puppet/concat/_etc_supervisord.conf/fragments/01_supervisord_unix]: The container Concat::Fragment[supervisord_unix] will propagate my refresh event�
Debug: Exec[concat_/etc/supervisord.conf](provider=posix): Executing check '/var/lib/puppet/concat/bin/concatfragments.sh -o "/var/lib/puppet/concat/_etc_supervisord.conf/fragments.concat.out" -d "/var/lib/puppet/concat/_etc_supervisord.conf" -t'�
Debug: Executing '/var/lib/puppet/concat/bin/concatfragments.sh -o "/var/lib/puppet/concat/_etc_supervisord.conf/fragments.concat.out" -d "/var/lib/puppet/concat/_etc_supervisord.conf" -t'�
Debug: /Stage[main]/Supervisord::Config/Concat[/etc/supervisord.conf]/Exec[concat_/etc/supervisord.conf]/unless: cmp: EOF on /var/lib/puppet/concat/_etc_supervisord.conf/fragments.concat.out�
Debug: Exec[concat_/etc/supervisord.conf](provider=posix): Executing '/var/lib/puppet/concat/bin/concatfragments.sh -o "/var/lib/puppet/concat/_etc_supervisord.conf/fragments.concat.out" -d "/var/lib/puppet/concat/_etc_supervisord.conf"'�
Debug: Executing '/var/lib/puppet/concat/bin/concatfragments.sh -o "/var/lib/puppet/concat/_etc_supervisord.conf/fragments.concat.out" -d "/var/lib/puppet/concat/_etc_supervisord.conf"'�
Notice: /Stage[main]/Supervisord::Config/Concat[/etc/supervisord.conf]/Exec[concat_/etc/supervisord.conf]/returns: executed successfully�
Debug: /Stage[main]/Supervisord::Config/Concat[/etc/supervisord.conf]/Exec[concat_/etc/supervisord.conf]: The container Concat[/etc/supervisord.conf] will propagate my refresh event�
Debug: Exec[concat_/etc/supervisord.conf](provider=posix): Executing check '/var/lib/puppet/concat/bin/concatfragments.sh -o "/var/lib/puppet/concat/_etc_supervisord.conf/fragments.concat.out" -d "/var/lib/puppet/concat/_etc_supervisord.conf" -t'�
Debug: Executing '/var/lib/puppet/concat/bin/concatfragments.sh -o "/var/lib/puppet/concat/_etc_supervisord.conf/fragments.concat.out" -d "/var/lib/puppet/concat/_etc_supervisord.conf" -t'�
Notice: /Stage[main]/Supervisord::Config/Concat[/etc/supervisord.conf]/Exec[concat_/etc/supervisord.conf]: Triggered 'refresh' from 4 events�
Debug: /Stage[main]/Supervisord::Config/Concat[/etc/supervisord.conf]/Exec[concat_/etc/supervisord.conf]: The container Concat[/etc/supervisord.conf] will propagate my refresh event�
Notice: /Stage[main]/Supervisord::Config/Concat[/etc/supervisord.conf]/File[/etc/supervisord.conf]/ensure: defined content as '{md5}2712bb67930fa94c5ab40515280dbe33'�
Debug: /Stage[main]/Supervisord::Config/Concat[/etc/supervisord.conf]/File[/etc/supervisord.conf]: The container Concat[/etc/supervisord.conf] will propagate my refresh event�
Debug: Concat::Fragment[supervisord_unix]: The container Class[Supervisord::Config] will propagate my refresh event�
Debug: Concat[/etc/supervisord.conf]: The container Class[Supervisord::Config] will propagate my refresh event�
Debug: Class[Supervisord::Config]: The container Stage[main] will propagate my refresh event�
Info: Class[Supervisord::Config]: Scheduling refresh of Class[Supervisord::Reload]�
Info: Class[Supervisord::Service]: Scheduling refresh of Service[supervisord]�
Debug: Service[supervisord](provider=upstart): Could not find supervisord.conf in /etc/init�
Debug: Service[supervisord](provider=upstart): Could not find supervisord.conf in /etc/init.d�
Debug: Service[supervisord](provider=upstart): Could not find supervisord in /etc/init�
Debug: Executing '/etc/init.d/supervisord status'�
Debug: Executing '/etc/init.d/supervisord start'�
Error: Could not start Service[supervisord]: Execution of '/etc/init.d/supervisord start' returned 2: �
Error: /Stage[main]/Supervisord::Service/Service[supervisord]/ensure: change from stopped to running failed: Could not start Service[supervisord]: Execution of '/etc/init.d/supervisord start' returned 2: �
Debug: Executing '/etc/init.d/supervisord status'�
Debug: /Stage[main]/Supervisord::Service/Service[supervisord]: Skipping restart; service is not running�
Notice: /Stage[main]/Supervisord::Service/Service[supervisord]: Triggered 'refresh' from 1 events�
Debug: /Stage[main]/Supervisord::Service/Service[supervisord]: The container Class[Supervisord::Service] will propagate my refresh event�
Debug: Class[Supervisord::Service]: The container Stage[main] will propagate my refresh event�
Notice: /Stage[main]/Supervisord/Anchor[supervisord::end]: Dependency Service[supervisord] has failures: true�
Warning: /Stage[main]/Supervisord/Anchor[supervisord::end]: Skipping because of failed dependencies�
Notice: /Stage[main]/Supervisord/Supervisord::Program[my-worker-search-consumer]/File[/etc/supervisor.d/program_my-worker-search-consumer.conf]/ensure: created�
Debug: /Stage[main]/Supervisord/Supervisord::Program[my-worker-search-consumer]/File[/etc/supervisor.d/program_my-worker-search-consumer.conf]: The container Supervisord::Program[my-worker-search-consumer] will propagate my refresh event�
Info: /Stage[main]/Supervisord/Supervisord::Program[my-worker-search-consumer]/File[/etc/supervisor.d/program_my-worker-search-consumer.conf]: Scheduling refresh of Class[Supervisord::Reload]�
Debug: Supervisord::Program[my-worker-search-consumer]: The container Class[Supervisord] will propagate my refresh event�

Adding the following to my manifest corrected the issue for me, but I'm sure this should be handled automatically.

# Ensure proper supervisord ordering
Class['supervisord::config']
-> Supervisord::Program <| |>
-> Supervisord::Group <| |>

I would gladly submit a PR for this fix, if someone can enlighten me as to where these resources should be anchored.

Configure a Program examples in README.md have errors

Following the example given causes puppet to throw errors (tested with Centos 6.4, Puppet 3.3.1, Ruby 1.8.7)

Corrected md text for section below

Configure a program

supervisord::program { 'myprogram':
  command     => 'command --args',
  priority    => '100',
  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'
}

Program ignores refreshing

For example, I need some supervisor service. I declare a manifest for config file and a manifest for supervisor::program. Then I add "subscribe" parameter to latter. I expect that when config changes, puppet notifies supervisor::program with refresh event and it should restart service. But this does not happen.
I see only refresh of Exec[supervisorctl_command_start_<program>]. So just start signal is sent, not restart. This behavior should be fixed.

Dependency issue with forge module zack/r10k

The ajcrowe/supervisord module that is currently on the forge depends on puppetlabs-concat like this:

puppetlabs/stdlib (>= 4.4.0 <5.0.0)
puppetlabs/concat (>= 1.0.0 <2.0.0)

however this clashes with the current version of zack/r10k which depends on gentoo/portage:

puppetlabs/stdlib (>= 4.6.0)
puppetlabs/ruby (>= 0.0.2)
puppetlabs/gcc (>= 0.0.3)
puppetlabs/pe_gem (>= 0.0.1)
croddy/make (>= 0.0.3)
puppetlabs/inifile (>= 1.0.0)
puppetlabs/vcsrepo (>= 0.1.2)
puppetlabs/git (>= 0.0.3)
gentoo/portage (>= 2.0.0)

the gentoo/portage module then has:

puppetlabs/concat

and this just installs the latest version of puppetlabs/concat which is at the time of filing this issue:

Version 2.1.0 released Jan 26th 2016

So, in summary if there's no giant blockers in running this module with puppetlabs/concat 2.1.0 it would be awesome to have a new version pushed to the forge with updated dependencies.

Afford for some variant of purge_resources => true

Thanks very much for your work on this module!

I'd really like to be able to define a top-level purge of supervisor.d resources, a la the puppetlabs-firewall module. We run a substantial number of processes that are to be run from a single location only for automated services without queueing (e.g. mass mails), so every class including such processes needs to include a boolean for ensure to make sure that if we switch around our master server duplicate processes on other machines are eliminated. Supervisord is a purely Puppet-managed process, so there's no real case in which

I'd expect this to be an entry in params defaulting to false that when set true purges /etc/supervisor.d of unknown resources and issues a supervisorctl stop.

Has this been discussed before, or do you have any reason to not implement this? I'd be happy to submit a PR but the work isn't worth it for our needs alone. Figured I'd touch base with you before doing the legwork.

Allow integers for numprocs, numprocs_start, retries, ...

I passed an integer for numprocs into supervisord::progame. The validation of validate_re is not able to cast an integer to an string and then perform a regex check.
This could be fixed by checking the type with is_integerfirst and then perform a regex check.

Release

Hi,

can you please make a release? Puppet Forge version is obviously very outdated.

Thank you

Don't install supervisor with pip

On some systems supervisor is available as a regular package with modifications by the packers; would it be possible to install supervisor through this module, but not with pip?

Use of HTTP without TLS

Greetings,

I am a security researcher, who is looking for security smells in Puppet scripts. I found instances where the HTTP protocol is used instead of HTTPS (HTTP with TLS). According to the Common Weakness Enumeration organization this is a security weakness (https://cwe.mitre.org/data/definitions/319.html). I was wondering why HTTP is used? Is it because of lack of tool support?

I am trying to find out if developers are forced to adopt bad practices due to lack of tool support when it comes to the HTTPS protocol. Maybe it is due to dependency on a resource that uses HTTP?

Any feedback is appreciated.

Source: https://github.com/ajcrowe/puppet-supervisord/blob/master/manifests/init.pp (Line 138)

How to provide serverurl using supervisord::supervisorctl

I want to write puppet class file for following command
sudo supervisorctl -s unix:///tmp/supervisord_config.sock restart some_Service

I installed this module using
puppet module install ajcrowe-supervisord --version 0.6.1

In class file, there are options for command and process which I am assuming would be like
supervisord::supervisorctl { 'some_Service':
command => 'restart',
process => 'some_Service',
}

But when I am running the agent, I am getting error
Error: Failed to apply catalog: Validation of Exec[supervisorctl_command_some_Service] failed: 'undef restart some_Service' is not qualified and no path was specified. Please qualify the command or specify a path. at /etc/puppet/modules/supervisord/manifests/supervisorctl.pp:35
I also tried to change the default server url to /tmp, but facing the same issue. Can you please help me for the same.

Define custom path for include files

The include section hardcoded in init.pp
if $config_dirs {
validate_array($config_dirs)
$config_include_string = join($config_dirs, ' ')
}
else {
$config_include_string = "${config_include}/*.conf"
}

Because supervisord does not allow recursive include definition, ("included files cannot include files themselves"), creation of chained include definition, (ie define [include] files=/etc/supervisor.d/custom.conf and define *.ini files in custom conf), is not possible.

We need to allow choose a custom path for include files. For example, as hiera hash
supervisord::include_files:

  • path_to_file1.ini
  • path_to_file2.ini

and create_resources(supervisord::include_files), hiera('supervisord::config_include_string'))

Possible bug with systemctl manifest if program name contains 'RUNNING'

Currently status check is performed by simple grep (https://github.com/ajcrowe/puppet-supervisord/blob/master/manifests/supervisorctl.pp#L25)

if $unless {
    $unless_cmd = join([$supervisorctl, 'status', $process, '|', 'grep', '-i', $unless], ' ')
  }
  else {
    $unless_cmd = undef
}

So, if program name contains any of possible statuses (ERROR, RUNNING, STOPPED, etc), systemctl program will work with errors. Such names are unlikely to be used, but may cause a lot of pain to debug this issue. At least some warning should be emitted in such case.

Option to restart supervisor service on file change

The default Puppet service resource type allows to be notified and restarted when a configuration file is updated. Is there a way that this module could be extended so that when I change a config file for a given supervisord::program, the process if running could be restarted by supervisorctl?

Module uses deprecated hiera_hash instead of lookup

This module still uses the deprecated hiera_hash function (Deprecated in Puppet 4.9). This results in deprecation warnings in the puppetmaster log using Puppet 5 and 6.

Given your consent, I would provide a pull request for a patch replacing those functions.

Parameter issues

Hello, thanks for writing this library. It ended up working for me instead of the more popular puppet-module-supervisor library. I found a couple issues that I want to point out.

Issue 1: autorestart requires the value to be a string, but autostart expects a bool. I think they should both expect bools.

Issue 2: stopwaitsecs isn't supported, but it could be useful implement

Here is an example puppet configuration:

  $supervisord_directory = '/var/www/django/venv/lib/python2.7/site-packages/myapp'
  $supervisord_environment = {
    'C_FORCE_ROOT' => true
  }
 supervisord::program { 'django-celery-indexers':
      directory    => $supervisord_directory,
      environment => $supervisord_environment,
      command     => '/var/www/django/venv/bin/honcho run /var/www/django/venv/bin/celery worker -Q indexers -P prefork --concurrency=2 --loglevel=info',
      user        => 'root',
      #group       => 'root',
      autostart => true,
      autorestart => 'true', ## this needs to be a string for some reason (06/05/2014)
      startsecs => 10,
      ###stopwaitsecs => 60, #gave me invalid parameter
      killasgroup => true,
      stopasgroup => true,
      numprocs => 1,
  }

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.