Browse code

Install and enable apache uwsgi proxy

The uwsgi proxy version that comes with Ubuntu xenial is too old, so
we have to build it from source. This is a temporary solution until
the next LTS.

This lays the ground work for using it in keystone.

Change-Id: I00fb1759e6988c7df0ce0f3df5ff1ce9fd7cd381

Sean Dague authored on 2017/04/14 02:28:12
Showing 2 changed files
... ...
@@ -66,6 +66,48 @@ function enable_apache_mod {
66 66
     fi
67 67
 }
68 68
 
69
+# NOTE(sdague): Install uwsgi including apache module, we need to get
70
+# to 2.0.6+ to get a working mod_proxy_uwsgi. We can probably build a
71
+# check for that and do it differently for different platforms.
72
+function install_apache_uwsgi {
73
+    local apxs="apxs2"
74
+    if is_fedora; then
75
+        apxs="apxs"
76
+    fi
77
+
78
+    # Ubuntu xenial is back level on uwsgi so the proxy doesn't
79
+    # actually work. Hence we have to build from source for now.
80
+    #
81
+    # Centos 7 actually has the module in epel, but there was a big
82
+    # push to disable epel by default. As such, compile from source
83
+    # there as well.
84
+
85
+    local dir
86
+    dir=$(mktemp -d)
87
+    pushd $dir
88
+    pip_install uwsgi
89
+    pip download uwsgi -c $REQUIREMENTS_DIR/upper-constraints.txt
90
+    local uwsgi
91
+    uwsgi=$(ls uwsgi*)
92
+    tar xvf $uwsgi
93
+    cd uwsgi*/apache2
94
+    sudo $apxs -i -c mod_proxy_uwsgi.c
95
+    popd
96
+    # delete the temp directory
97
+    sudo rm -rf $dir
98
+
99
+    if is_ubuntu; then
100
+        # we've got to enable proxy and proxy_uwsgi for this to work
101
+        sudo a2enmod proxy
102
+        sudo a2enmod proxy_uwsgi
103
+    elif is_fedora; then
104
+        # redhat is missing a nice way to turn on/off modules
105
+        echo "LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so" \
106
+            | sudo tee /etc/httpd/conf.modules.d/02-proxy-uwsgi.conf
107
+    fi
108
+    restart_apache_server
109
+}
110
+
69 111
 # install_apache_wsgi() - Install Apache server and wsgi module
70 112
 function install_apache_wsgi {
71 113
     # Apache installation, because we mark it NOPRIME
... ...
@@ -780,6 +780,9 @@ echo_summary "Installing OpenStack project source"
780 780
 # Install Oslo libraries
781 781
 install_oslo
782 782
 
783
+# Install uwsgi
784
+install_apache_uwsgi
785
+
783 786
 # Install client libraries
784 787
 install_keystoneauth
785 788
 install_keystoneclient