Merge "Add uWSGI support"

This commit is contained in:
Zuul 2018-01-08 18:09:32 +00:00 committed by Gerrit Code Review
commit 01cf26019e
6 changed files with 64 additions and 26 deletions

View File

@ -43,8 +43,9 @@ Bare Metal service comes with an example file for configuring the
``APACHE_RUN_GROUP`` directives to set the user and group values to ``APACHE_RUN_GROUP`` directives to set the user and group values to
an appropriate user on your server. an appropriate user on your server.
#. Modify the ``WSGIScriptAlias`` directive to point to the #. Modify the ``WSGIScriptAlias`` directive to point to the automatically
``ironic/api/app.wsgi`` script. generated ``ironic-api-wsgi`` script that is located in `IRONIC_BIN`
directory.
#. Modify the ``Directory`` directive to set the path to the Ironic API code. #. Modify the ``Directory`` directive to set the path to the Ironic API code.
@ -68,5 +69,5 @@ Bare Metal service comes with an example file for configuring the
sudo systemctl reload apache2 sudo systemctl reload apache2
.. note:: .. note::
The file ``ironic/api/app.wsgi`` is installed with the rest of the Bare Metal The file ``ironic-api-wsgi`` is automatically generated by pbr and is
service application code, and should not need to be modified. available in `IRONIC_BIN` directory. It should not be modified.

View File

@ -12,13 +12,14 @@
# This is an example Apache2 configuration file for using the # This is an example Apache2 configuration file for using the
# Ironic API through mod_wsgi. This version assumes you are # Ironic API through mod_wsgi. This version assumes you are
# running devstack to configure the software. # running devstack to configure the software, and PBR has generated
# and installed the ironic-api-wsgi script while installing ironic.
Listen 6385 Listen 6385
<VirtualHost *:6385> <VirtualHost *:6385>
WSGIDaemonProcess ironic user=stack group=stack threads=10 display-name=%{GROUP} WSGIDaemonProcess ironic user=stack group=stack threads=10 display-name=%{GROUP}
WSGIScriptAlias / /opt/stack/ironic/ironic/api/app.wsgi WSGIScriptAlias / /usr/local/bin/ironic-api-wsgi
SetEnv APACHE_RUN_USER stack SetEnv APACHE_RUN_USER stack
SetEnv APACHE_RUN_GROUP stack SetEnv APACHE_RUN_GROUP stack

View File

@ -16,24 +16,6 @@
Use this file for deploying the API service under Apache2 mod_wsgi. Use this file for deploying the API service under Apache2 mod_wsgi.
""" """
import sys from ironic.api import wsgi
from oslo_config import cfg application = wsgi.initialize_wsgi_app(show_deprecated=True)
import oslo_i18n as i18n
from oslo_log import log
from ironic.api import app
from ironic.common import service
CONF = cfg.CONF
i18n.install('ironic')
service.prepare_service(sys.argv)
LOG = log.getLogger(__name__)
LOG.debug("Configuration:")
CONF.log_opt_values(LOG, log.DEBUG)
application = app.VersionSelectorApplication()

41
ironic/api/wsgi.py Normal file
View File

@ -0,0 +1,41 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""WSGI script for Ironic API, installed by pbr."""
import sys
from oslo_config import cfg
import oslo_i18n as i18n
from oslo_log import log
from ironic.api import app
from ironic.common import service
CONF = cfg.CONF
LOG = log.getLogger(__name__)
def initialize_wsgi_app(show_deprecated=False):
i18n.install('ironic')
service.prepare_service(sys.argv)
LOG.debug("Configuration:")
CONF.log_opt_values(LOG, log.DEBUG)
if show_deprecated:
LOG.warning("Using ironic/api/app.wsgi is deprecated and it will "
"be removed in Rocky release. Please use automatically "
"generated ironic-api-wsgi instead.")
return app.VersionSelectorApplication()

View File

@ -0,0 +1,10 @@
---
upgrade:
- An Ironic API WSGI application script ``ironic-api-wsgi`` is now available.
It is auto-generated by ``pbr`` and allows to run the API service
using WSGI server (for example Nginx and uWSGI or Apache with mod_wsgi).
deprecations:
- Using ``ironic/api/app.wsgi`` script is deprecated and it will be removed
in Rocky release.
Please switch to automatically generated ``ironic-api-wsgi`` script
instead.

View File

@ -44,6 +44,9 @@ console_scripts =
ironic-conductor = ironic.cmd.conductor:main ironic-conductor = ironic.cmd.conductor:main
ironic-rootwrap = oslo_rootwrap.cmd:main ironic-rootwrap = oslo_rootwrap.cmd:main
wsgi_scripts =
ironic-api-wsgi = ironic.api.wsgi:initialize_wsgi_app
ironic.dhcp = ironic.dhcp =
neutron = ironic.dhcp.neutron:NeutronDHCPApi neutron = ironic.dhcp.neutron:NeutronDHCPApi
none = ironic.dhcp.none:NoneDHCPApi none = ironic.dhcp.none:NoneDHCPApi