Hey all, 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? Thanks in advance! -- Arnaud Morin
On 10/22/19 12:19 PM, Arnaud Morin wrote:
Hey all,
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?
Thanks in advance!
Hi Arnaud, If you wish, you can have a look at the nova-api package in Debian, which by default, is set to use uwsgi for both the compute and the metadata API. This consist of a sysv-rc / systemd startup script, plus a configuration file. Note that this system also has support over SSL if you just drop the certificate + key in the right folder. Nearly all API package in Debian are configured this way. If it's not the case, it means that either we didn't have time to do the switch yet (which is kind of rare, I hope), or there's no such support upstream for running under a wsgi server. Cheers, Thomas Goirand (zigo)
Hey Thomas, Thank you for your example. If I understand well, you are using 4 processes in the uwsgi config. I dont see any number of thread, does it mean the uwsgi is not spawning threads but only processes? ( so there is only 1 thread per process?) Thanks, -- Arnaud Morin On 23.10.19 - 13:45, Thomas Goirand wrote:
On 10/22/19 12:19 PM, Arnaud Morin wrote:
Hey all,
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?
Thanks in advance!
Hi Arnaud,
If you wish, you can have a look at the nova-api package in Debian, which by default, is set to use uwsgi for both the compute and the metadata API. This consist of a sysv-rc / systemd startup script, plus a configuration file. Note that this system also has support over SSL if you just drop the certificate + key in the right folder.
Nearly all API package in Debian are configured this way. If it's not the case, it means that either we didn't have time to do the switch yet (which is kind of rare, I hope), or there's no such support upstream for running under a wsgi server.
Cheers,
Thomas Goirand (zigo)
On 10/24/19 11:06 AM, Arnaud Morin wrote:
Hey Thomas,
Thank you for your example. If I understand well, you are using 4 processes in the uwsgi config. I dont see any number of thread, does it mean the uwsgi is not spawning threads but only processes? ( so there is only 1 thread per process?)
Thanks,
Hi Arnaud, If you carefully read the notes for nova, they are saying that we should leave the number of thread to 1, otherwise there may be some eventlet reconnection to rabbit issues. It's however fine to increase the number of processes. Cheers, Thomas Goirand (zigo)
That what I figured out after writing my previous mail. Anyway, thanks for your help! See you in Shanghai. -- Arnaud Morin On 25.10.19 - 01:15, Thomas Goirand wrote:
On 10/24/19 11:06 AM, Arnaud Morin wrote:
Hey Thomas,
Thank you for your example. If I understand well, you are using 4 processes in the uwsgi config. I dont see any number of thread, does it mean the uwsgi is not spawning threads but only processes? ( so there is only 1 thread per process?)
Thanks,
Hi Arnaud,
If you carefully read the notes for nova, they are saying that we should leave the number of thread to 1, otherwise there may be some eventlet reconnection to rabbit issues.
It's however fine to increase the number of processes.
Cheers,
Thomas Goirand (zigo)
Hey all, I am back to this nova processes/threads configuration. Here is what I have in my apache wsgi config: $ grep WSGIDaemonProcess /etc/apache2/sites-enabled/10-nova-api.conf WSGIDaemonProcess nova-api display-name=nova-api group=nova processes=1 python-home=/opt/openstack/nova python-path=/opt/openstack/nova/ threads=1 user=nova As you can see, I set 1 process, and 1 thread. But here is the result after restarting apache: $ ps -ef | grep nova nova 8535 8527 4 09:10 ? 00:02:15 nova-api -k start $ ps -o pid -o thcount -p8535 PID THCNT 8535 4 So, nova-api is running 4 threads! I am running nova stein. I checked in nova code but I am far from beeing an expert on the subjet, so does anyone can give me a clue on why nova is doing threading, while it should not? Thanks in advance, -- Arnaud Morin On 25.10.19 - 01:15, Thomas Goirand wrote:
On 10/24/19 11:06 AM, Arnaud Morin wrote:
Hey Thomas,
Thank you for your example. If I understand well, you are using 4 processes in the uwsgi config. I dont see any number of thread, does it mean the uwsgi is not spawning threads but only processes? ( so there is only 1 thread per process?)
Thanks,
Hi Arnaud,
If you carefully read the notes for nova, they are saying that we should leave the number of thread to 1, otherwise there may be some eventlet reconnection to rabbit issues.
It's however fine to increase the number of processes.
Cheers,
Thomas Goirand (zigo)
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
Hi Chris, That's helping a lot, thanks for all of this! Regards, -- Arnaud Morin On 23.10.19 - 16:26, Chris Dent wrote:
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
participants (4)
-
Arnaud Morin
-
Chris Dent
-
Thomas Goirand
-
Thomas Goirand