From 44c3cdef5c31bdcdc8e4961ec9d8ce1647aa8c09 Mon Sep 17 00:00:00 2001 From: "wu.chunyang" Date: Wed, 24 Aug 2022 17:17:42 +0800 Subject: [PATCH] Rename app.wsgi to app_wsgi.py 1. app.wsgi is a python script and should be end with py extension. 2. Generate trove-wsgi script which is needed by kolla to support https and ipv6. 3. Ignore build directory in git 4. update docs Change-Id: Ibbd6ecb8db25aa3a443d3f526f4cf6d418eb26f3 --- .gitignore | 5 +++++ devstack/files/apache-trove-api.template | 2 +- devstack/plugin.sh | 2 +- doc/source/install/apache-mod-wsgi.rst | 2 +- etc/apache2/trove | 2 +- setup.cfg | 2 ++ tox.ini | 2 +- trove/cmd/{app.wsgi => api_wsgi.py} | 1 + 8 files changed, 13 insertions(+), 5 deletions(-) rename trove/cmd/{app.wsgi => api_wsgi.py} (99%) diff --git a/.gitignore b/.gitignore index 35949d159a..38857d78be 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,11 @@ trove.iml # Files generated by Visual Studio Code .vscode/ +# Files generated by setup.py +*.egg-info +build +.eggs + # Sphinx doc/build/* doc/source/api/* diff --git a/devstack/files/apache-trove-api.template b/devstack/files/apache-trove-api.template index 06c88b2685..767f18cffe 100644 --- a/devstack/files/apache-trove-api.template +++ b/devstack/files/apache-trove-api.template @@ -21,7 +21,7 @@ Listen %TROVE_SERVICE_PORT% WSGIDaemonProcess trove-api user=%USER% processes=%APIWORKERS% threads=1 display-name=%{GROUP} - WSGIScriptAlias / %TROVE_WSGI_DIR%/app.wsgi + WSGIScriptAlias / %TROVE_WSGI_DIR%/app_wsgi.py WSGIApplicationGroup %{GLOBAL} WSGIProcessGroup trove-api WSGIPassAuthorization On diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 2b34158e5c..3ef04fbb30 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -169,7 +169,7 @@ function config_trove_apache_wsgi { local trove_apache_conf sudo mkdir -p ${TROVE_WSGI_DIR} - sudo cp $TROVE_DIR/trove/cmd/app.wsgi $TROVE_WSGI_DIR/app.wsgi + sudo cp $TROVE_DIR/trove/cmd/app_wsgi.py $TROVE_WSGI_DIR/app.wsgi trove_apache_conf=$(apache_site_config_for trove-api) sudo cp $TROVE_DEVSTACK_FILES/apache-trove-api.template ${trove_apache_conf} sudo sed -e " diff --git a/doc/source/install/apache-mod-wsgi.rst b/doc/source/install/apache-mod-wsgi.rst index 61968662c7..7b4d855d4a 100644 --- a/doc/source/install/apache-mod-wsgi.rst +++ b/doc/source/install/apache-mod-wsgi.rst @@ -36,7 +36,7 @@ Installing API behind mod_wsgi * Modify the ``WSGIDaemonProcess`` directive to set the ``user`` and ``group`` values to appropriate user on your server. * Modify the ``WSGIScriptAlias`` directive to point to the - trove/api/app.wsgi script. + trove/api/app_wsgi.py script. * Modify the ``Directory`` directive to set the path to the Trove API code. * Modify the ``ErrorLog and CustomLog`` to redirect the logs to the right diff --git a/etc/apache2/trove b/etc/apache2/trove index 1ed82c2612..d8257423b7 100644 --- a/etc/apache2/trove +++ b/etc/apache2/trove @@ -19,7 +19,7 @@ Listen 8779 WSGIDaemonProcess trove-api user=stack group=stack processes=2 threads=2 display-name=%{GROUP} - WSGIScriptAlias / /opt/stack/trove/trove/cmd/app.wsgi + WSGIScriptAlias / /opt/stack/trove/trove/cmd/app_wsgi.py WSGIProcessGroup trove-api ErrorLog /var/log/httpd/trove_error.log diff --git a/setup.cfg b/setup.cfg index 393898ba80..340ff3ad7b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -26,6 +26,8 @@ packages = trove [entry_points] +wsgi_scripts = + trove-wsgi = trove.cmd.api_wsgi:wsgimain console_scripts = trove-api = trove.cmd.api:main trove-taskmanager = trove.cmd.taskmanager:main diff --git a/tox.ini b/tox.ini index c35a01dfa1..4a24d45fc8 100644 --- a/tox.ini +++ b/tox.ini @@ -65,7 +65,7 @@ builtins = _ # add *.yaml for playbooks/trove-devstack-base.yaml, as it will be matched by # trove-* in the "filename" configuration. exclude=.venv,.tox,.git,dist,doc,*egg,tools,etc,build,*.po,*.pot,integration,releasenotes,*.yaml -filename=*.py,trove-*,app.wsgi +filename=*.py,trove-* [hacking] import_exceptions = trove.common.i18n diff --git a/trove/cmd/app.wsgi b/trove/cmd/api_wsgi.py similarity index 99% rename from trove/cmd/app.wsgi rename to trove/cmd/api_wsgi.py index a134539cf2..78eadd5bb7 100644 --- a/trove/cmd/app.wsgi +++ b/trove/cmd/api_wsgi.py @@ -38,4 +38,5 @@ def wsgimain(CONF): LOG.debug("Trove started on %s", CONF.host) return pastedeploy.paste_deploy_app(conf_file, 'trove', {}) + application = wsgimain()