Revert "Refactor Zaqar to satisfy openstack uwsgi goal"

This reverts commit 5a7636786e.

Reason for revert: We do not handle href links properly and this breaks other services depending on Zaqar.

Change-Id: I5fb0f2f25c280dd69cfb99d9f9b320df552462dc
This commit is contained in:
Erik Olof Gunnar Andersson 2023-03-27 15:54:51 +00:00
parent 5a7636786e
commit 4585b84224
5 changed files with 21 additions and 28 deletions

View File

@ -153,7 +153,19 @@ function configure_zaqar {
pip_install uwsgi 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 cleanup_zaqar
} }
@ -246,13 +258,9 @@ function start_zaqar {
echo "Waiting for Zaqar to start..." echo "Waiting for Zaqar to start..."
local www_authenticate_uri=http://${ZAQAR_SERVICE_HOST}/identity local www_authenticate_uri=http://${ZAQAR_SERVICE_HOST}/identity
token=$(openstack token issue -c id -f value --os-auth-url ${www_authenticate_uri}) 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 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" die $LINENO "Zaqar did not start"
fi fi
fi
} }
# stop_zaqar() - Stop running processes # stop_zaqar() - Stop running processes
@ -260,9 +268,9 @@ function stop_zaqar {
local serv local serv
# Kill the zaqar screen windows # Kill the zaqar screen windows
for serv in zaqar-wsgi zaqar-websocket; do for serv in zaqar-wsgi zaqar-websocket; do
stop_process $serv screen -S $SCREEN_NAME -p $serv -X kill
done done
remove_uwsgi_config "$ZAQAR_UWSGI_CONF" "$ZAQAR_UWSGI_APP" uwsgi --stop $ZAQAR_UWSGI_MASTER_PIDFILE
} }
function create_zaqar_accounts { function create_zaqar_accounts {
@ -274,9 +282,9 @@ function create_zaqar_accounts {
"messaging" "Zaqar Service") "messaging" "Zaqar Service")
get_or_create_endpoint $zaqar_service \ get_or_create_endpoint $zaqar_service \
"$REGION_NAME" \ "$REGION_NAME" \
"$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST/messaging" \ "$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST:$ZAQAR_SERVICE_PORT" \
"$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST/messaging" \ "$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST:$ZAQAR_SERVICE_PORT" \
"$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST/messaging" "$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST:$ZAQAR_SERVICE_PORT"
local zaqar_ws_service=$(get_or_create_service "zaqar-websocket" \ local zaqar_ws_service=$(get_or_create_service "zaqar-websocket" \
"messaging-websocket" "Zaqar Websocket Service") "messaging-websocket" "Zaqar Websocket Service")

View File

@ -14,7 +14,6 @@ ZAQAR_AUTH_CACHE_DIR=${ZAQAR_AUTH_CACHE_DIR:-/var/cache/zaqar}
# Support potential entry-points console scripts # Support potential entry-points console scripts
ZAQAR_BIN_DIR=$(get_python_exec_prefix) ZAQAR_BIN_DIR=$(get_python_exec_prefix)
ZAQAR_UWSGI_APP=$ZAQAR_BIN_DIR/zaqar-wsgi
# Set up database backend # Set up database backend
ZAQAR_BACKEND=${ZAQAR_BACKEND:-mongodb} ZAQAR_BACKEND=${ZAQAR_BACKEND:-mongodb}

View File

@ -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.

View File

@ -35,9 +35,6 @@ console_scripts =
zaqar-sql-db-manage = zaqar.storage.sqlalchemy.migration.cli:main zaqar-sql-db-manage = zaqar.storage.sqlalchemy.migration.cli:main
zaqar-status = zaqar.cmd.status:main zaqar-status = zaqar.cmd.status:main
wsgi_scripts =
zaqar-wsgi = zaqar.transport.wsgi.app:build_wsgi
zaqar.data.storage = zaqar.data.storage =
mongodb = zaqar.storage.mongodb.driver:DataDriver mongodb = zaqar.storage.mongodb.driver:DataDriver
mongodb.fifo = zaqar.storage.mongodb.driver:FIFODataDriver mongodb.fifo = zaqar.storage.mongodb.driver:FIFODataDriver

View File

@ -42,14 +42,9 @@ conf(project='zaqar', prog='zaqar-queues', args=[])
log.setup(conf, 'zaqar') log.setup(conf, 'zaqar')
gmr.TextGuruMeditation.setup_autorun(version, conf=conf) gmr.TextGuruMeditation.setup_autorun(version, conf=conf)
boot = bootstrap.Bootstrap(conf) boot = bootstrap.Bootstrap(conf)
conf.drivers.transport = 'wsgi' conf.drivers.transport = 'wsgi'
application = boot.transport.app application = boot.transport.app
# Keep the old name for compatibility # Keep the old name for compatibility
app = application 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