fuel-library/deployment/puppet/nailgun/manifests/supervisor.pp
Matthew Mosesohn 682eed618f Inhibit start of supervisord for nailgun
Starting supervisord starts nailgun app too early
before it is ready to serve requests. It will be
started later in the docker container in the
foreground. This prevents a race condition where
DB upgrade takes place and nailgun is stopped.

Change-Id: Icd27758f00e8f472041eb83019cb89dcb030afd1
Closes-Bug: #1453400
2015-05-12 14:33:58 +03:00

55 lines
1.4 KiB
Puppet

class nailgun::supervisor(
$service_enabled = true,
$nailgun_env,
$ostf_env,
$conf_file = "nailgun/supervisord.conf.erb",
$restart_service = true,
) {
file { "/etc/sysconfig/supervisord":
source => 'puppet:///modules/nailgun/supervisor-sysconfig',
owner => 'root',
group => 'root',
mode => '0644',
}
file { "/etc/rc.d/init.d/supervisord":
source => 'puppet:///modules/nailgun/supervisor-init',
owner => 'root',
group => 'root',
mode => '0755',
require => [Package["supervisor"],
File["/etc/sysconfig/supervisord"]],
notify => Service["supervisord"],
}
file { "/etc/supervisord.conf":
content => template($conf_file),
owner => 'root',
group => 'root',
mode => 0644,
require => Package["supervisor"],
notify => Service["supervisord"],
}
service { "supervisord":
ensure => $service_enabled,
enable => $service_enabled,
require => [
Package["supervisor"],
],
hasrestart => true,
restart => $restart_service ? {
false => "/bin/true",
default => "/usr/bin/supervisorctl stop all; /etc/init.d/supervisord restart",
},
}
Package<| title == 'supervisor' or title == 'nginx' or
title == 'python-fuelclient'|> ~> Service<| title == 'supervisord'|>
if !defined(Service['supervisord']) {
notify{ "Module ${module_name} cannot notify service supervisord on packages update": }
}
}