From 4585b8422486ec2ca33e0cbd6385f214f43e6040 Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Mon, 27 Mar 2023 15:54:51 +0000 Subject: [PATCH] Revert "Refactor Zaqar to satisfy openstack uwsgi goal" This reverts commit 5a7636786ec4cc8bdf490c11b94b52f377edebb3. Reason for revert: We do not handle href links properly and this breaks other services depending on Zaqar. Change-Id: I5fb0f2f25c280dd69cfb99d9f9b320df552462dc --- devstack/plugin.sh | 32 ++++++++++++------- devstack/settings | 1 - .../notes/uwsgi-goal-975956d4be93b431.yaml | 6 ---- setup.cfg | 3 -- zaqar/transport/wsgi/app.py | 7 +--- 5 files changed, 21 insertions(+), 28 deletions(-) delete mode 100644 releasenotes/notes/uwsgi-goal-975956d4be93b431.yaml diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 1a3189e97..69d5d43cc 100755 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -153,7 +153,19 @@ function configure_zaqar { pip_install uwsgi - write_uwsgi_config "$ZAQAR_UWSGI_CONF" "$ZAQAR_UWSGI_APP" "/messaging" + iniset $ZAQAR_UWSGI_CONF uwsgi master true + iniset $ZAQAR_UWSGI_CONF uwsgi die-on-term true + iniset $ZAQAR_UWSGI_CONF uwsgi exit-on-reload true + iniset $ZAQAR_UWSGI_CONF uwsgi http $ZAQAR_SERVICE_HOST:$ZAQAR_SERVICE_PORT + iniset $ZAQAR_UWSGI_CONF uwsgi processes $API_WORKERS + iniset $ZAQAR_UWSGI_CONF uwsgi enable_threads true + iniset $ZAQAR_UWSGI_CONF uwsgi threads 4 + iniset $ZAQAR_UWSGI_CONF uwsgi thunder-lock true + iniset $ZAQAR_UWSGI_CONF uwsgi buffer-size 65535 + iniset $ZAQAR_UWSGI_CONF uwsgi wsgi-file $ZAQAR_DIR/zaqar/transport/wsgi/app.py + iniset $ZAQAR_UWSGI_CONF uwsgi master true + iniset $ZAQAR_UWSGI_CONF uwsgi add-header "Connection: close" + iniset $ZAQAR_UWSGI_CONF uwsgi lazy-apps true cleanup_zaqar } @@ -246,12 +258,8 @@ function start_zaqar { echo "Waiting for Zaqar to start..." local www_authenticate_uri=http://${ZAQAR_SERVICE_HOST}/identity token=$(openstack token issue -c id -f value --os-auth-url ${www_authenticate_uri}) - if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget --no-proxy -q --header=\"Client-ID:$(uuidgen)\" --header=\"X-Auth-Token:$token\" -O- $ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST/messaging/v2/ping; do sleep 1; done"; then - # TODO(wxy): This check could be removed after the migration to Apache - # proxy. - if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget --no-proxy -q --header=\"Client-ID:$(uuidgen)\" --header=\"X-Auth-Token:$token\" -O- $ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST:$ZAQAR_SERVICE_PORT/v2/ping; do sleep 1; done"; then - die $LINENO "Zaqar did not start" - fi + if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget --no-proxy -q --header=\"Client-ID:$(uuidgen)\" --header=\"X-Auth-Token:$token\" -O- $ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST:$ZAQAR_SERVICE_PORT/v2/ping; do sleep 1; done"; then + die $LINENO "Zaqar did not start" fi } @@ -260,9 +268,9 @@ function stop_zaqar { local serv # Kill the zaqar screen windows for serv in zaqar-wsgi zaqar-websocket; do - stop_process $serv + screen -S $SCREEN_NAME -p $serv -X kill done - remove_uwsgi_config "$ZAQAR_UWSGI_CONF" "$ZAQAR_UWSGI_APP" + uwsgi --stop $ZAQAR_UWSGI_MASTER_PIDFILE } function create_zaqar_accounts { @@ -274,9 +282,9 @@ function create_zaqar_accounts { "messaging" "Zaqar Service") get_or_create_endpoint $zaqar_service \ "$REGION_NAME" \ - "$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST/messaging" \ - "$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST/messaging" \ - "$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST/messaging" + "$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST:$ZAQAR_SERVICE_PORT" \ + "$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST:$ZAQAR_SERVICE_PORT" \ + "$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST:$ZAQAR_SERVICE_PORT" local zaqar_ws_service=$(get_or_create_service "zaqar-websocket" \ "messaging-websocket" "Zaqar Websocket Service") diff --git a/devstack/settings b/devstack/settings index 5d4eb0378..e2401b1a8 100644 --- a/devstack/settings +++ b/devstack/settings @@ -14,7 +14,6 @@ ZAQAR_AUTH_CACHE_DIR=${ZAQAR_AUTH_CACHE_DIR:-/var/cache/zaqar} # Support potential entry-points console scripts ZAQAR_BIN_DIR=$(get_python_exec_prefix) -ZAQAR_UWSGI_APP=$ZAQAR_BIN_DIR/zaqar-wsgi # Set up database backend ZAQAR_BACKEND=${ZAQAR_BACKEND:-mongodb} diff --git a/releasenotes/notes/uwsgi-goal-975956d4be93b431.yaml b/releasenotes/notes/uwsgi-goal-975956d4be93b431.yaml deleted file mode 100644 index 0b24a2654..000000000 --- a/releasenotes/notes/uwsgi-goal-975956d4be93b431.yaml +++ /dev/null @@ -1,6 +0,0 @@ -deprecations: - - | - Set "wsgi-file = zaqar/transport/wsgi/app.py" in uwsgi config file is - deprecated and this way is removed in Bobcat release. Please use something - like (Ubuntu for example): "wsgi-file = /usr/local/bin/zaqar-wsgi" after - installing Zaqar. diff --git a/setup.cfg b/setup.cfg index 0f20daccf..31f4ea67c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,9 +35,6 @@ console_scripts = zaqar-sql-db-manage = zaqar.storage.sqlalchemy.migration.cli:main zaqar-status = zaqar.cmd.status:main -wsgi_scripts = - zaqar-wsgi = zaqar.transport.wsgi.app:build_wsgi - zaqar.data.storage = mongodb = zaqar.storage.mongodb.driver:DataDriver mongodb.fifo = zaqar.storage.mongodb.driver:FIFODataDriver diff --git a/zaqar/transport/wsgi/app.py b/zaqar/transport/wsgi/app.py index bb44291cf..ff4909114 100644 --- a/zaqar/transport/wsgi/app.py +++ b/zaqar/transport/wsgi/app.py @@ -42,14 +42,9 @@ conf(project='zaqar', prog='zaqar-queues', args=[]) log.setup(conf, 'zaqar') gmr.TextGuruMeditation.setup_autorun(version, conf=conf) + boot = bootstrap.Bootstrap(conf) conf.drivers.transport = 'wsgi' application = boot.transport.app # Keep the old name for compatibility app = application - - -def build_wsgi(): - """Another way used by setup.cfg to initialize WSGI app""" - # TODO(wxy): Move the outside code into this function in T. - return app