From 7f690381d64e3440be3dc86fbc851e238b36e7c0 Mon Sep 17 00:00:00 2001 From: Erno Kuvaja Date: Thu, 23 Jul 2020 17:26:57 +0100 Subject: [PATCH] Return the mod_proxy_uwsgi paragraph Doc change b264d5bfb8e877359ff8cf82658c1bca02536f48 did remove whole mod_proxy_uwsgi section based on not possible under PY3, PY27 was still supported in Train and while broken the started and served subset of requests just like with pure uWSGI deployment. This patch returns that section with clarified warning. This is only relevant for Train and before. Change-Id: I7b284f07da2a483c009df016f9562f217ed35d0f --- doc/source/admin/apache-httpd.rst | 40 ++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/doc/source/admin/apache-httpd.rst b/doc/source/admin/apache-httpd.rst index e8e0c74069..859f112941 100644 --- a/doc/source/admin/apache-httpd.rst +++ b/doc/source/admin/apache-httpd.rst @@ -36,10 +36,44 @@ The clearest we can say is just don't do it. mod_proxy_uwsgi ''''''''''''''' -This has not been doable since Ussuri as we only support Python 3. +.. WARNING:: -In theory the same applies as mod_wsgi but even without chunked encoding the -code is still broken under uwsgi. + Running Glance under HTTPD in this configuration will only work on Python 2 + if you use ``Transfer-Encoding: chunked``. Also if running with Python 2 + Apache will be buffering the chunked encoding before passing the request + on to uWSGI. See bug: https://github.com/unbit/uwsgi/issues/1540 + The async tasks, namely (by default) admin only tasks API and Interoperable + Image Import will not work under uWSGI even with proxying. There might be + problems with reload and graceful shutdowns of the service that are not + documented elsewhere. Treat this as any uWSGI deployment, not supported. + +Instead of running uWSGI as a webserver listening on a local port and then +having Apache HTTP proxy all the incoming requests with mod_proxy. The +normally recommended way of deploying the uWSGI server with Apache HTTPD is to +use mod_proxy_uwsgi and set up a local socket file for uWSGI to listen on. +Apache will send the requests using the uwsgi protocol over this local socket +file. However, there are issues with doing this and using chunked-encoding, so +this is not recommended for use with Glance. + +You can work around these issues by configuring your Apache proxy to buffer the +chunked data and send the full content length to the uWSGI server. You do this +by adding:: + + SetEnv proxy-sendcl 1 + +to the apache config file using mod_proxy_uwsgi. For more details on using +mod_proxy_uwsgi see the official docs: +http://uwsgi-docs.readthedocs.io/en/latest/Apache.html?highlight=mod_uwsgi_proxy#mod-proxy-uwsgi + +There are some additional considerations when doing this though. Having Apache +locally buffer the chunked data to disk before passing it to uWSGI means you'll +need to have sufficient disk space in /tmp (or whatever you set TMPDIR to) to +store all the disk files. The other aspect to consider is that this buffering +can take some time to write the images to disk. To prevent random failures +you'll likely have to increase timeout values in the uWSGI configuration file +to ensure uWSGI will wait long enough for this to happen. (Depending on the +uploaded image file sizes it may be necessary to set the timeouts to multiple +minutes.) mod_wsgi --------