Revamp supervisor docker, Create host upgrade w/o supervisor
- Create new file host-upgrade.pp that should be used for Fuel upgrades instead of host-only.pp. Upgrade mode excludes supervisor from upgrades. Fuel upgrade utility will install new supervisor configuration independent of Puppet. - Refactor dockerctl attach function to provide possibility to correctly handle SIGINT sent from supervisord during stop process. In order to do so we fork "docker attach" and run loop in order to "trap" (catch) SIGINT/SIGTERM and shutdown container properly - Use SIGTERM instead of SIGINT for dhcrelay_monitor supervisor service, because we have "sleep 30" loop in the monitor script, so it will handle SIGINT only when sleep ends. - Break dependency of docker build on supervisor Change-Id: I100c7705eb5515158bd940519fc02323c0bbe983 Related-bug: #1350764 Partial-bug: #1358144
This commit is contained in:
parent
e292af206c
commit
0f27198dc4
@ -53,7 +53,6 @@ $dependent_dirs = ["/var/log/docker-logs", "/var/log/docker-logs/remote",
|
||||
Service[$docker_service],
|
||||
Exec['wait for docker-to-become-ready'],
|
||||
],
|
||||
before => Service['supervisord'],
|
||||
unless => 'docker ps -a | grep -q fuel',
|
||||
}
|
||||
}
|
||||
|
@ -253,9 +253,21 @@ function start_container {
|
||||
|
||||
}
|
||||
|
||||
function shutdown_container {
|
||||
echo "Stopping $1..."
|
||||
kill $2
|
||||
${DOCKER} stop $1
|
||||
exit 0
|
||||
}
|
||||
|
||||
function attach_container {
|
||||
echo "Attaching to container $container_name..."
|
||||
${DOCKER} attach $1
|
||||
${DOCKER} attach $1 &
|
||||
APID=$!
|
||||
trap "shutdown_container $1 $APID" INT TERM
|
||||
while test -d "/proc/$APID/fd" ; do
|
||||
sleep 10 & wait $!
|
||||
done
|
||||
}
|
||||
|
||||
function shell_container {
|
||||
|
58
deployment/puppet/nailgun/examples/host-upgrade.pp
Normal file
58
deployment/puppet/nailgun/examples/host-upgrade.pp
Normal file
@ -0,0 +1,58 @@
|
||||
$fuel_settings = parseyaml($astute_settings_yaml)
|
||||
$fuel_version = parseyaml($fuel_version_yaml)
|
||||
|
||||
if is_hash($::fuel_version) and $::fuel_version['VERSION'] and
|
||||
$::fuel_version['VERSION']['production'] {
|
||||
$production = $::fuel_version['VERSION']['production']
|
||||
}
|
||||
else {
|
||||
$production = 'prod'
|
||||
}
|
||||
|
||||
$ntp_servers = [$::fuel_settings['NTP1'], $::fuel_settings['NTP2'],
|
||||
$::fuel_settings['NTP3']]
|
||||
|
||||
Class['nailgun::packages'] ->
|
||||
Class['nailgun::host'] ->
|
||||
Class['docker::dockerctl'] ->
|
||||
Class['docker'] ->
|
||||
Class['openstack::logrotate'] ->
|
||||
Class['nailgun::client']
|
||||
|
||||
class { 'nailgun::packages': }
|
||||
|
||||
class { 'nailgun::host':
|
||||
production => $production,
|
||||
cobbler_host => $::fuel_settings['ADMIN_NETWORK']['ipaddress'],
|
||||
nailgun_group => $nailgun_group,
|
||||
nailgun_user => $nailgun_user,
|
||||
dns_domain => $::fuel_settings['DNS_DOMAIN'],
|
||||
dns_search => $::fuel_settings['DNS_SEARCH'],
|
||||
|
||||
}
|
||||
|
||||
class { "openstack::clocksync":
|
||||
ntp_servers => $ntp_servers,
|
||||
config_template => "ntp/ntp.conf.centosserver.erb",
|
||||
}
|
||||
|
||||
class { "docker::dockerctl":
|
||||
release => $::fuel_version['VERSION']['release'],
|
||||
production => $production,
|
||||
admin_ipaddress => $::fuel_settings['ADMIN_NETWORK']['ipaddress'],
|
||||
}
|
||||
class { "docker": }
|
||||
|
||||
class {'openstack::logrotate':
|
||||
role => 'server',
|
||||
rotation => 'weekly',
|
||||
keep => '4',
|
||||
limitsize => '100M',
|
||||
}
|
||||
|
||||
class { "nailgun::client":
|
||||
server => $::fuel_settings['ADMIN_NETWORK']['ipaddress'],
|
||||
keystone_user => $::fuel_settings['FUEL_ACCESS']['user'],
|
||||
keystone_pass => $::fuel_settings['FUEL_ACCESS']['password'],
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ class nailgun::supervisor(
|
||||
$nailgun_env,
|
||||
$ostf_env,
|
||||
$conf_file = "nailgun/supervisord.conf.erb",
|
||||
$restart_service = true,
|
||||
) {
|
||||
|
||||
file { "/etc/sysconfig/supervisord":
|
||||
@ -37,6 +38,11 @@ class nailgun::supervisor(
|
||||
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'|>
|
||||
|
Loading…
Reference in New Issue
Block a user