Add wsgi module to blazar
Changes in python packaging tooling mean that the wsgi_scripts functionality via PBR may not longer function. This patch switches blazar from using the PBR wsgi_scripts method to using a new wsgi module that provides the same behavior as the generated wsgi scripts provided. A related devstack patch enables devstack to setup uWSGI to use the new module path instead of the generated wsgi scripts. For more details see the proposed OpenStack goal [1]. [1] https://review.opendev.org/c/openstack/governance/+/902807 Change-Id: Ib16d5d1ea5d7416d7b1f026f771d6c2b77657970
This commit is contained in:
0
blazar/wsgi/__init__.py
Normal file
0
blazar/wsgi/__init__.py
Normal file
24
blazar/wsgi/api.py
Normal file
24
blazar/wsgi/api.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# 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 application entry-point for the Blazar API."""
|
||||
|
||||
import threading
|
||||
|
||||
from blazar.api import wsgi_app
|
||||
|
||||
application = None
|
||||
|
||||
lock = threading.Lock()
|
||||
with lock:
|
||||
if application is None:
|
||||
application = wsgi_app.init_app()
|
||||
@@ -80,7 +80,7 @@ function configure_blazar {
|
||||
iniadd $NOVA_CONF filter_scheduler available_filters "blazarnova.scheduler.filters.blazar_filter.BlazarFilter"
|
||||
|
||||
if [[ "$BLAZAR_USE_MOD_WSGI" == "True" ]]; then
|
||||
write_uwsgi_config "$BLAZAR_UWSGI_CONF" "$BLAZAR_UWSGI" "/reservation"
|
||||
write_uwsgi_config "$BLAZAR_UWSGI_CONF" "$BLAZAR_UWSGI" "/reservation" "" "blazar"
|
||||
fi
|
||||
|
||||
# Database
|
||||
|
||||
@@ -31,7 +31,7 @@ BLAZAR_DASHBOARD_DIR=$DEST/blazar-dashboard
|
||||
# wsgi deployment
|
||||
BLAZAR_USE_MOD_WSGI=${BLAZAR_USE_MOD_WSGI:-True}
|
||||
BLAZAR_BIN_DIR=$(get_python_exec_prefix)
|
||||
BLAZAR_UWSGI=$BLAZAR_BIN_DIR/blazar-api-wsgi
|
||||
BLAZAR_UWSGI=blazar.wsgi.api:application
|
||||
BLAZAR_UWSGI_CONF=$BLAZAR_CONF_DIR/blazar-api-uwsgi.ini
|
||||
|
||||
BLAZAR_SERVICE_HOST=${BLAZAR_SERVICE_HOST:-$SERVICE_HOST}
|
||||
|
||||
29
releasenotes/notes/remove-wsgi-scripts-1e2011c1d40df1c7.yaml
Normal file
29
releasenotes/notes/remove-wsgi-scripts-1e2011c1d40df1c7.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
A new module, ``blazar.wsgi``, has been added as a place to gather WSGI
|
||||
``application`` objects. This is intended to ease deployment by providing a
|
||||
consistent location for these objects. For example, if using uWSGI then
|
||||
instead of:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[uwsgi]
|
||||
wsgi-file = /bin/blazar-api-wsgi
|
||||
|
||||
You can now use:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[uwsgi]
|
||||
module = blazar.wsgi.api:application
|
||||
|
||||
This also simplifies deployment with other WSGI servers that expect module
|
||||
paths such as gunicorn.
|
||||
upgrade:
|
||||
- |
|
||||
The WSGI script ``blazar-api-wsgi`` has been removed. Deployment tooling
|
||||
should instead reference the Python module path for the wsgi module in
|
||||
Blazar, ``blazar.wsgi.api:application`` if their chosen WSGI server
|
||||
supports this (gunicorn, uWSGI, etc.) or implement a .wsgi script
|
||||
themselves if not (mod_wsgi).
|
||||
Reference in New Issue
Block a user