From d0db62a476e29355ca08db0237295139c8fce4f6 Mon Sep 17 00:00:00 2001 From: Kirill Zaitsev Date: Fri, 26 May 2017 19:02:52 +0300 Subject: [PATCH] Use systemd-tmpfiles to create /var/run/uwsgi On ubuntu contents of /var/run do not persist between reboots. Devstack uses /var/run/uwsgi as home for wsgi sockets. This means that after rebooting the machine services, that rely on uwsgi would fail to start. Currently it affects keystone.service and placement-api.service. This patch changes delegates directory creation to systemd-tmpfiles, which would run on startup. Change-Id: I27d168cea93698739ef08ac76c828695a49176c7 Closes-Bug: #1692767 --- lib/apache | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/apache b/lib/apache index 34ac660266..3be6c1dbb1 100644 --- a/lib/apache +++ b/lib/apache @@ -229,7 +229,13 @@ function write_uwsgi_config { # create a home for the sockets; note don't use /tmp -- apache has # a private view of it on some platforms. local socket_dir='/var/run/uwsgi' - sudo install -d -o $STACK_USER -m 755 $socket_dir + + # /var/run will be empty on ubuntu after reboot, so we can use systemd-temptiles + # to automatically create $socket_dir. + sudo mkdir -p /etc/tmpfiles.d/ + echo "d $socket_dir 0755 $STACK_USER root" | sudo tee /etc/tmpfiles.d/uwsgi.conf + sudo systemd-tmpfiles --create /etc/tmpfiles.d/uwsgi.conf + local socket="$socket_dir/${name}.socket" # always cleanup given that we are using iniset here