Refactor Zaqar to satisfy openstack uwsgi goal
After this change, Zaqar-wsgi will not be forced to port 8888 by devstack. Use apache proxy now and the endpoint will be like: http://IP/messaging by default. Change-Id: I413cd24a9ef70a8bbada46d63d5dfdff09366b3e
This commit is contained in:
parent
c611c5c6e8
commit
5a7636786e
@ -153,19 +153,7 @@ function configure_zaqar {
|
||||
|
||||
pip_install uwsgi
|
||||
|
||||
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
|
||||
write_uwsgi_config "$ZAQAR_UWSGI_CONF" "$ZAQAR_UWSGI_APP" "/messaging"
|
||||
|
||||
cleanup_zaqar
|
||||
}
|
||||
@ -258,9 +246,13 @@ 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
|
||||
fi
|
||||
}
|
||||
|
||||
# stop_zaqar() - Stop running processes
|
||||
@ -268,9 +260,9 @@ function stop_zaqar {
|
||||
local serv
|
||||
# Kill the zaqar screen windows
|
||||
for serv in zaqar-wsgi zaqar-websocket; do
|
||||
screen -S $SCREEN_NAME -p $serv -X kill
|
||||
stop_process $serv
|
||||
done
|
||||
uwsgi --stop $ZAQAR_UWSGI_MASTER_PIDFILE
|
||||
remove_uwsgi_config "$ZAQAR_UWSGI_CONF" "$ZAQAR_UWSGI_APP"
|
||||
}
|
||||
|
||||
function create_zaqar_accounts {
|
||||
@ -282,9 +274,9 @@ function create_zaqar_accounts {
|
||||
"messaging" "Zaqar Service")
|
||||
get_or_create_endpoint $zaqar_service \
|
||||
"$REGION_NAME" \
|
||||
"$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"
|
||||
"$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST/messaging" \
|
||||
"$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST/messaging" \
|
||||
"$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST/messaging"
|
||||
|
||||
local zaqar_ws_service=$(get_or_create_service "zaqar-websocket" \
|
||||
"messaging-websocket" "Zaqar Websocket Service")
|
||||
|
@ -14,6 +14,7 @@ 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}
|
||||
|
6
releasenotes/notes/uwsgi-goal-975956d4be93b431.yaml
Normal file
6
releasenotes/notes/uwsgi-goal-975956d4be93b431.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
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.
|
@ -35,6 +35,9 @@ 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
|
||||
|
@ -42,9 +42,14 @@ 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
|
||||
|
Loading…
Reference in New Issue
Block a user