From ecdeadeb7a1aa87cba2cdb0c1a2bb1ffc4aabf25 Mon Sep 17 00:00:00 2001 From: Arnaud M Date: Thu, 9 Nov 2023 23:15:17 +0100 Subject: [PATCH] Change the wsgi path for devstack Since pip 23.1, the wsgi_script from PBR are not installed anymore (see [1]) So, instead, rely on the wsgi.py app which is directly bundled in mistral source code. [1] https://discuss.python.org/t/adding-support-for-wsgi-scripts-entrypoint/30905/11 Change-Id: Ideed8421427e865f8010b7bfca58c3f010ac6bd6 Signed-off-by: Arnaud M --- README.rst | 2 ++ devstack/files/apache-mistral-api.template | 9 +++------ devstack/plugin.sh | 15 ++++++--------- setup.cfg | 3 --- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/README.rst b/README.rst index f4690762f..d768181ba 100644 --- a/README.rst +++ b/README.rst @@ -35,3 +35,5 @@ Project Resources * Source for the project can be found at: https://opendev.org/openstack/mistral + +* WSGI app is located in `mistral/api/wsgi.py` diff --git a/devstack/files/apache-mistral-api.template b/devstack/files/apache-mistral-api.template index 83be271f7..884f70bc7 100644 --- a/devstack/files/apache-mistral-api.template +++ b/devstack/files/apache-mistral-api.template @@ -1,9 +1,9 @@ Listen %PUBLICPORT% - WSGIDaemonProcess mistral-api processes=%API_WORKERS% threads=1 user=%USER% display-name=%{GROUP} %VIRTUALENV% + WSGIDaemonProcess mistral-api processes=%API_WORKERS% threads=1 user=%USER% display-name=%{GROUP} python-home=%MISTRAL_ENV_DIR% WSGIProcessGroup mistral-api - WSGIScriptAlias / %MISTRAL_BIN_DIR%/mistral-wsgi-api + WSGIScriptAlias / %MISTRAL_DIR%/mistral/api/wsgi.py WSGIApplicationGroup %{GLOBAL} WSGIPassAuthorization On AllowEncodedSlashes On @@ -12,11 +12,8 @@ Listen %PUBLICPORT% ErrorLog /var/log/%APACHE_NAME%/mistral_api.log CustomLog /var/log/%APACHE_NAME%/mistral_api_access.log combined - %SSLENGINE% - %SSLCERTFILE% - %SSLKEYFILE% - + = 2.4> Require all granted diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 771162b6c..64ae6ecd0 100755 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -21,6 +21,10 @@ else MISTRAL_BIN_DIR=$(get_python_exec_prefix) fi +# By default, mistral is installed in DEVSTACK_VENV +# NOTE(arnaud) maybe check if PROJECT_VENV should be used here +MISTRAL_ENV_DIR=${DEVSTACK_VENV} + # Toggle for deploying Mistral API under HTTPD + mod_wsgi MISTRAL_USE_MOD_WSGI=${MISTRAL_USE_MOD_WSGI:-True} @@ -249,23 +253,16 @@ function _mistral_cleanup_apache_wsgi { function _config_mistral_apache_wsgi { local mistral_apache_conf mistral_apache_conf=$(apache_site_config_for mistral-api) - local mistral_ssl="" - local mistral_certfile="" - local mistral_keyfile="" local mistral_api_port=$MISTRAL_SERVICE_PORT - local venv_path="" sudo cp $MISTRAL_FILES_DIR/apache-mistral-api.template $mistral_apache_conf sudo sed -e " s|%PUBLICPORT%|$mistral_api_port|g; s|%APACHE_NAME%|$APACHE_NAME|g; - s|%MISTRAL_BIN_DIR%|$MISTRAL_BIN_DIR|g; + s|%MISTRAL_DIR%|$MISTRAL_DIR|g; + s|%MISTRAL_ENV_DIR%|$MISTRAL_ENV_DIR|g; s|%API_WORKERS%|$API_WORKERS|g; - s|%SSLENGINE%|$mistral_ssl|g; - s|%SSLCERTFILE%|$mistral_certfile|g; - s|%SSLKEYFILE%|$mistral_keyfile|g; s|%USER%|$STACK_USER|g; - s|%VIRTUALENV%|$venv_path|g " -i $mistral_apache_conf } diff --git a/setup.cfg b/setup.cfg index 231219ecb..93af3b882 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,9 +28,6 @@ console_scripts = mistral-server = mistral.cmd.launch:main mistral-db-manage = mistral.db.sqlalchemy.migration.cli:main -wsgi_scripts = - mistral-wsgi-api = mistral.api.app:init_wsgi - mistral.rpc.backends = oslo_client = mistral.rpc.oslo.oslo_client:OsloRPCClient oslo_server = mistral.rpc.oslo.oslo_server:OsloRPCServer