ajcrowe / puppet-supervisord

Puppet Module to install and configure applications under supervisord
MIT License
37 stars 104 forks source link

ability to specify supervisord::params as resource #37

Closed jerkyrs closed 9 years ago

jerkyrs commented 9 years ago

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.

ajcrowe commented 9 years ago

Hi @sejames, can you give an example of what you're trying to configure?

jerkyrs commented 9 years ago

Hi @ajcrowe , I am trying to configure the settings in /etc/supervisord.conf such as inet_http_server parameters (port, username, password) as well as some of the supervisord parameters.

ajcrowe commented 9 years ago

You can just specify those when you instantiate the class

class supervisor {
  inet_server          => true,
  inet_server_hostname => 'localhost',
  inet_server_port     => '9000'
  inet_auth            => true,
  inet_username        => 'myuser',
  inet_password        => 'password'
}

Hope that makes sense, you can also put these in hiera as supervisord::<param>

jerkyrs commented 9 years ago

Hi Alex, Not yet using Hiera, we have large number of manifests, some use external modules some do not. We have main init.pp and for example company/manifests/init.pp as well as this one for supervisord,

supervisord.pp

class company::supervisord {
include supervisord
supervisord::program { 'myprogram':
  command     => 'command --args',
  priority    => '100',
  environment => {
    'HOME'   => '/home/myuser',
    'PATH'   => '/bin:/sbin:/usr/bin:/usr/sbin',
    'SECRET' => 'mysecret'
  }
}

The above works fine but not able to specify the params. We normally then just apply the manifest from nodes.pp include statement , where might we define this class as everything i try gives me an error. The documentation says

class supervisord {
  $install_pip  => true,
}

but im not sure where to put this.

Your reference to supervisord class above misses the "d" and also misses "$" when defining. Ive tried both as either an class on its own or inner class. Should this be defined in my supervisord.pp as above?

ajcrowe commented 9 years ago

sorry @sejames yes it should be supervisord and I messed up the format.

You would replace the include supervisord with class { supervisord: ... and that way you can override any of the class params.

Fixed example:

class { 'supervisord':
  inet_server          => true,
  inet_server_hostname => 'localhost',
  inet_server_port     => '9000'
  inet_auth            => true,
  inet_username        => 'myuser',
  inet_password        => 'password'
}
ajcrowe commented 9 years ago

Marking as answered.