From ef60f2b7180f269a53f405efa7449618eddf86a1 Mon Sep 17 00:00:00 2001 From: Dinesh Bhor Date: Tue, 5 Sep 2017 14:40:32 +0530 Subject: [PATCH] Enable reloadable config in services uwsgi services: [1] By default uwsgi is set to exit on reload this breaks config reloading of the service [1][2]. It needs to be set to 'false'. [2] Requires to add 'systemctl reload' command support by adding ExecReload in unit file. Non uwsgi services: [1] Non uwsgi services only requires to add ExecReload in unit file. There was a similar patch submitted by Matthew Treinish [3] but it was already set to workflow +1(not merged as having dependency on other patch) and it was having some issues as specified in comment and missing reload functionality for other services. [1] https://etherpad.openstack.org/p/uwsgi-issues [2] http://uwsgi-docs.readthedocs.io/en/latest/Options.html#exit-on-reload [3] https://review.openstack.org/#/c/490904/2 Change-Id: I78f5e9d4574671c74a52af64724946feb41c2d7a --- functions-common | 3 +++ lib/apache | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/functions-common b/functions-common index 52f53ef147..1e6ae5cc76 100644 --- a/functions-common +++ b/functions-common @@ -45,6 +45,7 @@ declare -A -g GITBRANCH declare -A -g GITDIR TRACK_DEPENDS=${TRACK_DEPENDS:-False} +KILL_PATH="$(which kill)" # Save these variables to .stackenv STACK_ENV_VARS="BASE_SQL_CONN DATA_DIR DEST ENABLED_SERVICES HOST_IP \ @@ -1453,6 +1454,7 @@ function write_user_unit_file { iniset -sudo $unitfile "Service" "ExecStart" "$command" iniset -sudo $unitfile "Service" "KillMode" "process" iniset -sudo $unitfile "Service" "TimeoutStopSec" "infinity" + iniset -sudo $unitfile "Service" "ExecReload" "$KILL_PATH -HUP \$MAINPID" if [[ -n "$group" ]]; then iniset -sudo $unitfile "Service" "Group" "$group" fi @@ -1474,6 +1476,7 @@ function write_uwsgi_user_unit_file { iniset -sudo $unitfile "Service" "SyslogIdentifier" "$service" iniset -sudo $unitfile "Service" "User" "$user" iniset -sudo $unitfile "Service" "ExecStart" "$command" + iniset -sudo $unitfile "Service" "ExecReload" "$KILL_PATH -HUP \$MAINPID" iniset -sudo $unitfile "Service" "Type" "notify" iniset -sudo $unitfile "Service" "KillMode" "process" iniset -sudo $unitfile "Service" "Restart" "always" diff --git a/lib/apache b/lib/apache index 39d5b7b071..5dc0e98192 100644 --- a/lib/apache +++ b/lib/apache @@ -259,7 +259,7 @@ function write_uwsgi_config { iniset "$file" uwsgi master true # Set die-on-term & exit-on-reload so that uwsgi shuts down iniset "$file" uwsgi die-on-term true - iniset "$file" uwsgi exit-on-reload true + iniset "$file" uwsgi exit-on-reload false # 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 @@ -316,7 +316,7 @@ function write_local_uwsgi_http_config { iniset "$file" uwsgi master true # Set die-on-term & exit-on-reload so that uwsgi shuts down iniset "$file" uwsgi die-on-term true - iniset "$file" uwsgi exit-on-reload true + iniset "$file" uwsgi exit-on-reload false iniset "$file" uwsgi enable-threads true iniset "$file" uwsgi plugins python # uwsgi recommends this to prevent thundering herd on accept.