Add uWSGI configuration samples

Added some samples on uWSGI config and some docs
on how to run manila with uWSGI for contributors.

Partially-implements: blueprint wsgi-web-servers-support

Change-Id: I8e68619b00255197b3d3cf6796c60d1a3a04ff36
This commit is contained in:
Victoria Martinez de la Cruz 2019-01-14 21:37:56 +00:00
parent fba472e3a6
commit 7a1414977f
4 changed files with 101 additions and 0 deletions

View File

@ -0,0 +1,79 @@
====================================
Running manila API with a web server
====================================
As part of the `community goals for Pike`_, manila has packaged
a wsgi script entrypoint that allows you to run it with a real web server
like Apache HTTPD or NGINX.
This doc shows a sample of deploying manila with uwsgi
Installing the API via uwsgi
-----------------------------
For this deployment we use uwsgi as a web server bound to a random
local port. Then we configure apache using mod_proxy to forward all incoming
requests on the specified endpoint to that local webserver. This has the
advantage of letting apache manage all inbound http connections, but allowing
uwsgi run the python code. This also means that when we make
changes to manila code or configuration we don't need to restart all of apache
(which may be running other services as well) and just need to restart the local
uwsgi daemon.
The httpd/ directory contains sample files for configuring HTTPD to run manila
under uwsgi. To use sample configs, simply copy `httpd/uwsgi-manila.conf` to the
appropiate location for your apache server.
On RHEL/CentOS/Fedora it is::
/etc/httpd/conf.d/uwsgi-manila.conf
On SLES/OpenSUSE it is::
/etc/apache2/vhosts.d/uwsgi-manila.conf
On Debian/Ubuntu it is::
/etc/apache2/sites-available/uwsgi-manila.conf
Enable mod_proxy by running ``sudo a2enmod proxy``
On Ubuntu/Debian systems enable the site using the a2ensite tool::
sudo a2ensite /etc/apache2/sites-available/uwsgi-manila.conf
This is not required on RHEL/CentOS/Fedora systems.
Start or restart HTTPD/Apache2 to pick up the new configuration.
Now we have to configure and start the uwsgi service.
Copy the `httpd/manila-uwsgi.ini` file to `/etc/manila`. Update the file to
match your system configuration (i.e. tweak the number of processes and threads)
Install uwsgi.
On RHEL/CentOS::
sudo yum install uwsgi-plugin-python3
On Fedora::
sudo dnf install uwsgi-plugin-python3
On SLES/OpenSUSE::
sudo zypper install uwsgi-python3
On Ubuntu/Debian::
sudo apt-get install uwsgi-plugin-python3
And start the manila server using uwsgi::
uwsgi --ini /etc/manila/manila-uwsgi.ini
.. NOTE::
In the sample configs port 51999 is used, this is a randomly selected number.
.. _community goals for Pike: https://governance.openstack.org/tc/goals/pike/deploy-api-in-wsgi.html#control-plane-api-endpoints-deployment-via-wsgi

View File

@ -37,6 +37,7 @@ Programming HowTos and Tutorials
development.environment development.environment
development-environment-devstack development-environment-devstack
apache-httpd
unit_tests unit_tests
tempest_tests tempest_tests
addmethod.openstackapi addmethod.openstackapi

18
httpd/manila-uwsgi.ini Normal file
View File

@ -0,0 +1,18 @@
[uwsgi]
socket-timeout = 10
http-auto-chunked = true
http-chunked-input = true
http-raw-body = true
chmod-socket = 666
lazy-apps = true
add-header = Connection: close
buffer-size = 65535
thunder-lock = true
plugins = python
enable-threads = true
exit-on-reload = true
die-on-term = true
master = true
processes = 4
http-socket = 127.0.0.1:61999
wsgi-file = /usr/local/bin/manila-wsgi-api

3
httpd/uwsgi-manila.conf Normal file
View File

@ -0,0 +1,3 @@
KeepAlive Off
SetEnv proxy-sendchunked 1
ProxyPass "/share" "http://127.0.0.1:51999" retry=0