From 6b5a267065410245e17b207ce1eefb6c741fea65 Mon Sep 17 00:00:00 2001 From: Andy McCrae Date: Tue, 15 Aug 2017 15:48:11 +0100 Subject: [PATCH] Fix reloads for uWSGI uWSGI won't reload properly unless we use one of the built in options for uWSGI reloads: touch-reload pidfile reload using uwsgi binary This opts to use the pid file option, which uses the built in uWSGI --reload option along with the "pidfile" option specified in the conf file to reload the service. Change-Id: I720011f3486fa5c1cf8cf8f5d826ca726930f751 --- templates/nova-systemd-init.j2 | 2 +- templates/nova-uwsgi.ini.j2 | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/templates/nova-systemd-init.j2 b/templates/nova-systemd-init.j2 index 9633dd24..3900d335 100644 --- a/templates/nova-systemd-init.j2 +++ b/templates/nova-systemd-init.j2 @@ -15,7 +15,7 @@ ExecStart={{ item.program_override }} {{ item.program_config_options | default(' {% else %} ExecStart={{ nova_bin }}/{{ item.service_name }} {{ item.program_config_options | default('') }} {{ item.log_string | default('--log-file=') }}/var/log/nova/{{ item.service_name }}.log {% endif %} -ExecReload=/bin/kill -HUP $MAINPID +ExecReload={{ (item.wsgi_app is defined and item.wsgi_app) | ternary(nova_bin + '/uwsgi --reload /var/run/' + item.service_name + '/' + item.service_name +'.pid','/bin/kill -HUP $MAINPID') }} # Give a reasonable amount of time for the server to start up/shut down TimeoutSec=120 diff --git a/templates/nova-uwsgi.ini.j2 b/templates/nova-uwsgi.ini.j2 index a2d39fc0..ad23aca0 100644 --- a/templates/nova-uwsgi.ini.j2 +++ b/templates/nova-uwsgi.ini.j2 @@ -11,10 +11,11 @@ master = true enable-threads = true processes = {{ nova_wsgi_processes }} threads = {{ nova_wsgi_threads }} -exit-on-reload = true +exit-on-reload = false die-on-term = true lazy-apps = true add-header = Connection: close buffer-size = {{ nova_wsgi_buffer_size }} thunder-lock = true logfile-chmod = 644 +pidfile = /var/run/{{ item.service_name }}/{{ item.service_name }}.pid