Merge "Use common helper to generate uwsgi setting"

This commit is contained in:
Zuul 2024-12-31 18:49:35 +00:00 committed by Gerrit Code Review
commit c9389d83a0
3 changed files with 15 additions and 37 deletions

View File

@ -45,6 +45,7 @@ function cleanup_zaqar {
if [ "$ZAQAR_BACKEND" = 'mongodb' ] ; then
cleanup_zaqar_mongodb
fi
remove_uwsgi_config "$ZAQAR_UWSGI_CONF" "zaqar"
}
# cleanup_zaqar_mongodb() - Remove residual data files, anything left over from previous
@ -146,23 +147,7 @@ function configure_zaqar {
fi
iniset_rpc_backend zaqar $ZAQAR_CONF DEFAULT
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
cleanup_zaqar
write_uwsgi_config "$ZAQAR_UWSGI_CONF" "$ZAQAR_UWSGI" "/messaging" "" "zaqar"
}
function configure_redis {
@ -237,6 +222,7 @@ function install_zaqar {
if is_service_enabled horizon; then
install_zaqarui
fi
pip_install uwsgi
}
function install_zaqarui {
@ -265,14 +251,14 @@ function install_zaqarclient {
# start_zaqar() - Start running processes, including screen
function start_zaqar {
cat $ZAQAR_UWSGI_CONF
run_process zaqar-wsgi "$ZAQAR_BIN_DIR/uwsgi --ini $ZAQAR_UWSGI_CONF --pidfile2 $ZAQAR_UWSGI_MASTER_PIDFILE"
run_process zaqar-wsgi "$ZAQAR_BIN_DIR/uwsgi --ini $ZAQAR_UWSGI_CONF"
run_process zaqar-websocket "$ZAQAR_BIN_DIR/zaqar-server --config-file $ZAQAR_CONF"
echo "Waiting for Zaqar to start..."
local www_authenticate_uri=http://${ZAQAR_SERVICE_HOST}/identity
local ping_url=$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST/messaging/v2/ping
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:$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- $ping_url; do sleep 1; done"; then
die $LINENO "Zaqar did not start"
fi
}
@ -282,9 +268,8 @@ 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
}
function create_zaqar_accounts {
@ -292,20 +277,15 @@ function create_zaqar_accounts {
if [[ "$KEYSTONE_IDENTITY_BACKEND" = 'sql' ]]; then
local zaqar_service=$(get_or_create_service "zaqar" \
"messaging" "Zaqar Service")
get_or_create_endpoint $zaqar_service \
get_or_create_service "zaqar" "messaging" "Zaqar Service"
get_or_create_endpoint "messaging" \
"$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"
local zaqar_ws_service=$(get_or_create_service "zaqar-websocket" \
"messaging-websocket" "Zaqar Websocket Service")
get_or_create_endpoint $zaqar_ws_service \
get_or_create_service "zaqar-websocket" \
"messaging-websocket" "Zaqar Websocket Service"
get_or_create_endpoint "messaging-websocket" \
"$REGION_NAME" \
"$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST:$ZAQAR_WEBSOCKET_PORT" \
"$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST:$ZAQAR_WEBSOCKET_PORT" \
"$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST:$ZAQAR_WEBSOCKET_PORT"
fi

View File

@ -7,7 +7,7 @@ ZAQAR_CONF_DIR=/etc/zaqar
ZAQAR_CONF=$ZAQAR_CONF_DIR/zaqar.conf
ZAQAR_POLICY_CONF=$ZAQAR_CONF_DIR/policy.yaml
ZAQAR_UWSGI_CONF=$ZAQAR_CONF_DIR/uwsgi.conf
ZAQAR_UWSGI_MASTER_PIDFILE=/tmp/uwsgizaqarmasterprocess.pid
ZAQAR_UWSGI=$ZAQAR_DIR/zaqar/transport/wsgi/app.py
ZAQAR_API_LOG_DIR=/var/log/zaqar
ZAQAR_API_LOG_FILE=$ZAQAR_API_LOG_DIR/queues.log
ZAQAR_AUTH_CACHE_DIR=${ZAQAR_AUTH_CACHE_DIR:-/var/cache/zaqar}

View File

@ -19,8 +19,6 @@ source $ZAQAR_DEVSTACK_DIR/plugin.sh
set -o xtrace
for serv in zaqar-websocket; do
for serv in zaqar-wsgi zaqar-websocket; do
stop_process $serv
done
uwsgi --stop $ZAQAR_UWSGI_MASTER_PIDFILE