[ops] nova wsgi config

Chris Dent cdent+os at anticdent.org
Wed Oct 23 15:26:23 UTC 2019


On Tue, 22 Oct 2019, Arnaud Morin wrote:

> I am trying to configure apache as a WSGI.
> Is there any other documentation than this:
> https://docs.openstack.org/nova/stein/user/wsgi.html
>
> Is there any recommendations?

There are a lot of options, and which you use can mostly come down
to personal preference and other aspects of your environment. For
example, if you're running in a kubernetes environment, using apache
at all can be overkill: the nova-api container(s) can expose an http
service which are reached through the ingress. Adding apache in that
environment would mean you had proxy -> proxy/apache -> service. If
you're trying save some space, that's overkill.

However, if what you want is some kind of combination where apache
is in front of the nova-api you have three basic options:

* Use apache plus mod_proxy to talk to the eventlet driven
   `nova-api` process.

* Use apache plus mod_wsgi to talk to the `nova-api-wsgi` application,
   probably using WSGIDaemonProcess.

* Use apache plus mod_proxy_uwsgi to talk to the `nova-api-wsgi`
   application, itself being run by uwsgi, where the uwsgi process
   is started and managed by something like systemd or uwsgi emperor
   mode.

If you use either of the latter two you need to be aware of a
potential issue with eventlet as described in the release notes for
stein: https://docs.openstack.org/releasenotes/nova/stein.html#known-issues

There's some boilerplate documentation for using mod wsgi and uwsgi for
various projects. Here's the one for zun:

     https://docs.openstack.org/zun/train/contributor/mod-wsgi.html

There's some documentation in placement which has links to the
changes that added placement in devstack, first using mod_wsgi and
then using uwsgi:

     https://docs.openstack.org/placement/latest/install/

That can be a useful guide, just remember to replace placement names
with the corresponding nova names. Where placement uses
`placement-api`, nova wants `nova-api-wsgi`.

There are many options for how to do this, so there's no
straightforward cookiecutter answer. The important thing to remember
is that `nova-api-wsgi` is a standard WSGI application and there are
all kinds of resources on the web for how to host a WSGI application
on a variety of web servers in various ways. Things you learn about
handling a WSGI application of one sort can be transferred to others
(with the important caveat about nova and eventlet described above).

My current way for doing this kind of thing is to run uwsgi in a
container and then have a proxy talk to that container. See
https://github.com/cdent/placedock for how I've done this with
Placement. If there's no container involved, I simply run uwsgi
standalone.

-- 
Chris Dent                       ٩◔̯◔۶           https://anticdent.org/
freenode: cdent


More information about the openstack-discuss mailing list