Add new keystone.wsgi module

This allows deployment tooling to easily switch from passing a binary
path to passing a Python module path. We'll use it shortly.

Change-Id: I36bb9ab43c3263b5064f35f4fc550722a0e83279
This commit is contained in:
Artem Goncharov 2024-10-10 14:02:32 +02:00
parent 6433f1ae1c
commit 57c6b3187f
6 changed files with 47 additions and 2 deletions

View File

@ -58,6 +58,7 @@ apidoc_excluded_paths = [
'tests/*',
'tests',
'test',
'wsgi',
# TODO(gmann): with new release of SQLAlchemy(1.4.27) TypeDecorator used
# in common/sql/core.py file started failing. Remove this oncethe issue of
# TypeDecorator is fixed.

View File

@ -1,5 +1,5 @@
[uwsgi]
wsgi-file = /usr/local/bin/keystone-wsgi-admin
module = keystone.wsgi.api:application
# Versions of mod_proxy_uwsgi>=2.0.6 should use a UNIX socket, see
# http://uwsgi-docs.readthedocs.org/en/latest/Apache.html#mod-proxy-uwsgi

View File

@ -1,5 +1,5 @@
[uwsgi]
wsgi-file = /usr/local/bin/keystone-wsgi-public
module = keystone.wsgi.api:application
# Versions of mod_proxy_uwsgi>=2.0.6 should use a UNIX socket, see
# http://uwsgi-docs.readthedocs.org/en/latest/Apache.html#mod-proxy-uwsgi

View File

22
keystone/wsgi/api.py Normal file
View File

@ -0,0 +1,22 @@
# 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 Keystone API."""
import threading
from keystone.server import wsgi
application = None
with threading.Lock():
if application is None:
application = wsgi.initialize_public_application()

View File

@ -0,0 +1,22 @@
---
features:
- |
A new module, ``keystone.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/keystone-wsgi-public
You can now use:
.. code-block:: ini
[uwsgi]
module = keystone.wsgi.api:application
This also simplifies deployment with other WSGI servers that expect module
paths such as gunicorn.