Merge "Enable graceful shutdown for services"

This commit is contained in:
Jenkins 2017-09-19 01:49:24 +00:00 committed by Gerrit Code Review
commit cd06b2ee81
3 changed files with 16 additions and 1 deletions

View File

@ -1395,6 +1395,8 @@ function write_user_unit_file {
iniset -sudo $unitfile "Unit" "Description" "Devstack $service" iniset -sudo $unitfile "Unit" "Description" "Devstack $service"
iniset -sudo $unitfile "Service" "User" "$user" iniset -sudo $unitfile "Service" "User" "$user"
iniset -sudo $unitfile "Service" "ExecStart" "$command" iniset -sudo $unitfile "Service" "ExecStart" "$command"
iniset -sudo $unitfile "Service" "KillMode" "process"
iniset -sudo $unitfile "Service" "TimeoutStopSec" "infinity"
if [[ -n "$group" ]]; then if [[ -n "$group" ]]; then
iniset -sudo $unitfile "Service" "Group" "$group" iniset -sudo $unitfile "Service" "Group" "$group"
fi fi
@ -1417,7 +1419,7 @@ function write_uwsgi_user_unit_file {
iniset -sudo $unitfile "Service" "User" "$user" iniset -sudo $unitfile "Service" "User" "$user"
iniset -sudo $unitfile "Service" "ExecStart" "$command" iniset -sudo $unitfile "Service" "ExecStart" "$command"
iniset -sudo $unitfile "Service" "Type" "notify" iniset -sudo $unitfile "Service" "Type" "notify"
iniset -sudo $unitfile "Service" "KillSignal" "SIGQUIT" iniset -sudo $unitfile "Service" "KillMode" "process"
iniset -sudo $unitfile "Service" "Restart" "always" iniset -sudo $unitfile "Service" "Restart" "always"
iniset -sudo $unitfile "Service" "NotifyAccess" "all" iniset -sudo $unitfile "Service" "NotifyAccess" "all"
iniset -sudo $unitfile "Service" "RestartForceExitStatus" "100" iniset -sudo $unitfile "Service" "RestartForceExitStatus" "100"

View File

@ -260,10 +260,15 @@ function write_uwsgi_config {
# Set die-on-term & exit-on-reload so that uwsgi shuts down # Set die-on-term & exit-on-reload so that uwsgi shuts down
iniset "$file" uwsgi die-on-term true iniset "$file" uwsgi die-on-term true
iniset "$file" uwsgi exit-on-reload true iniset "$file" uwsgi exit-on-reload true
# Set worker-reload-mercy so that worker will not exit till the time
# configured after graceful shutdown
iniset "$file" uwsgi worker-reload-mercy $WORKER_TIMEOUT
iniset "$file" uwsgi enable-threads true iniset "$file" uwsgi enable-threads true
iniset "$file" uwsgi plugins python iniset "$file" uwsgi plugins python
# uwsgi recommends this to prevent thundering herd on accept. # uwsgi recommends this to prevent thundering herd on accept.
iniset "$file" uwsgi thunder-lock true iniset "$file" uwsgi thunder-lock true
# Set hook to trigger graceful shutdown on SIGTERM
iniset "$file" uwsgi hook-master-start "unix_signal:15 gracefully_kill_them_all"
# Override the default size for headers from the 4k default. # Override the default size for headers from the 4k default.
iniset "$file" uwsgi buffer-size 65535 iniset "$file" uwsgi buffer-size 65535
# Make sure the client doesn't try to re-use the connection. # Make sure the client doesn't try to re-use the connection.
@ -316,6 +321,11 @@ function write_local_uwsgi_http_config {
iniset "$file" uwsgi plugins python iniset "$file" uwsgi plugins python
# uwsgi recommends this to prevent thundering herd on accept. # uwsgi recommends this to prevent thundering herd on accept.
iniset "$file" uwsgi thunder-lock true iniset "$file" uwsgi thunder-lock true
# Set hook to trigger graceful shutdown on SIGTERM
iniset "$file" uwsgi hook-master-start "unix_signal:15 gracefully_kill_them_all"
# Set worker-reload-mercy so that worker will not exit till the time
# configured after graceful shutdown
iniset "$file" uwsgi worker-reload-mercy $WORKER_TIMEOUT
# Override the default size for headers from the 4k default. # Override the default size for headers from the 4k default.
iniset "$file" uwsgi buffer-size 65535 iniset "$file" uwsgi buffer-size 65535
# Make sure the client doesn't try to re-use the connection. # Make sure the client doesn't try to re-use the connection.

View File

@ -793,6 +793,9 @@ SERVICE_TIMEOUT=${SERVICE_TIMEOUT:-60}
# Service graceful shutdown timeout # Service graceful shutdown timeout
SERVICE_GRACEFUL_SHUTDOWN_TIMEOUT=${SERVICE_GRACEFUL_SHUTDOWN_TIMEOUT:-5} SERVICE_GRACEFUL_SHUTDOWN_TIMEOUT=${SERVICE_GRACEFUL_SHUTDOWN_TIMEOUT:-5}
# Service graceful shutdown timeout
WORKER_TIMEOUT=${WORKER_TIMEOUT:-90}
# Support alternative yum -- in future Fedora 'dnf' will become the # Support alternative yum -- in future Fedora 'dnf' will become the
# only supported installer, but for now 'yum' and 'dnf' are both # only supported installer, but for now 'yum' and 'dnf' are both
# available in parallel with compatible CLIs. Allow manual switching # available in parallel with compatible CLIs. Allow manual switching