Browse code

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

Kirill Zaitsev authored on 2017/05/27 01:02:52
Showing 1 changed files
... ...
@@ -229,7 +229,13 @@ function write_uwsgi_config {
229 229
     # create a home for the sockets; note don't use /tmp -- apache has
230 230
     # a private view of it on some platforms.
231 231
     local socket_dir='/var/run/uwsgi'
232
-    sudo install -d -o $STACK_USER -m 755 $socket_dir
232
+
233
+    # /var/run will be empty on ubuntu after reboot, so we can use systemd-temptiles
234
+    # to automatically create $socket_dir.
235
+    sudo mkdir -p /etc/tmpfiles.d/
236
+    echo "d $socket_dir 0755 $STACK_USER root" | sudo tee /etc/tmpfiles.d/uwsgi.conf
237
+    sudo systemd-tmpfiles --create /etc/tmpfiles.d/uwsgi.conf
238
+
233 239
     local socket="$socket_dir/${name}.socket"
234 240
 
235 241
     # always cleanup given that we are using iniset here