Merge "Use common helper to generate uwsgi setting"
This commit is contained in:
commit
c9389d83a0
@ -45,6 +45,7 @@ function cleanup_zaqar {
|
|||||||
if [ "$ZAQAR_BACKEND" = 'mongodb' ] ; then
|
if [ "$ZAQAR_BACKEND" = 'mongodb' ] ; then
|
||||||
cleanup_zaqar_mongodb
|
cleanup_zaqar_mongodb
|
||||||
fi
|
fi
|
||||||
|
remove_uwsgi_config "$ZAQAR_UWSGI_CONF" "zaqar"
|
||||||
}
|
}
|
||||||
|
|
||||||
# cleanup_zaqar_mongodb() - Remove residual data files, anything left over from previous
|
# cleanup_zaqar_mongodb() - Remove residual data files, anything left over from previous
|
||||||
@ -146,23 +147,7 @@ function configure_zaqar {
|
|||||||
fi
|
fi
|
||||||
iniset_rpc_backend zaqar $ZAQAR_CONF DEFAULT
|
iniset_rpc_backend zaqar $ZAQAR_CONF DEFAULT
|
||||||
|
|
||||||
pip_install uwsgi
|
write_uwsgi_config "$ZAQAR_UWSGI_CONF" "$ZAQAR_UWSGI" "/messaging" "" "zaqar"
|
||||||
|
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function configure_redis {
|
function configure_redis {
|
||||||
@ -237,6 +222,7 @@ function install_zaqar {
|
|||||||
if is_service_enabled horizon; then
|
if is_service_enabled horizon; then
|
||||||
install_zaqarui
|
install_zaqarui
|
||||||
fi
|
fi
|
||||||
|
pip_install uwsgi
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_zaqarui {
|
function install_zaqarui {
|
||||||
@ -265,14 +251,14 @@ function install_zaqarclient {
|
|||||||
|
|
||||||
# start_zaqar() - Start running processes, including screen
|
# start_zaqar() - Start running processes, including screen
|
||||||
function start_zaqar {
|
function start_zaqar {
|
||||||
cat $ZAQAR_UWSGI_CONF
|
run_process zaqar-wsgi "$ZAQAR_BIN_DIR/uwsgi --ini $ZAQAR_UWSGI_CONF"
|
||||||
run_process zaqar-wsgi "$ZAQAR_BIN_DIR/uwsgi --ini $ZAQAR_UWSGI_CONF --pidfile2 $ZAQAR_UWSGI_MASTER_PIDFILE"
|
|
||||||
run_process zaqar-websocket "$ZAQAR_BIN_DIR/zaqar-server --config-file $ZAQAR_CONF"
|
run_process zaqar-websocket "$ZAQAR_BIN_DIR/zaqar-server --config-file $ZAQAR_CONF"
|
||||||
|
|
||||||
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
|
||||||
|
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})
|
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"
|
die $LINENO "Zaqar did not start"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -282,9 +268,8 @@ 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
|
||||||
screen -S $SCREEN_NAME -p $serv -X kill
|
stop_process serv
|
||||||
done
|
done
|
||||||
uwsgi --stop $ZAQAR_UWSGI_MASTER_PIDFILE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_zaqar_accounts {
|
function create_zaqar_accounts {
|
||||||
@ -292,20 +277,15 @@ function create_zaqar_accounts {
|
|||||||
|
|
||||||
if [[ "$KEYSTONE_IDENTITY_BACKEND" = 'sql' ]]; then
|
if [[ "$KEYSTONE_IDENTITY_BACKEND" = 'sql' ]]; then
|
||||||
|
|
||||||
local zaqar_service=$(get_or_create_service "zaqar" \
|
get_or_create_service "zaqar" "messaging" "Zaqar Service"
|
||||||
"messaging" "Zaqar Service")
|
get_or_create_endpoint "messaging" \
|
||||||
get_or_create_endpoint $zaqar_service \
|
|
||||||
"$REGION_NAME" \
|
"$REGION_NAME" \
|
||||||
"$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:$ZAQAR_SERVICE_PORT"
|
|
||||||
|
|
||||||
local zaqar_ws_service=$(get_or_create_service "zaqar-websocket" \
|
get_or_create_service "zaqar-websocket" \
|
||||||
"messaging-websocket" "Zaqar Websocket Service")
|
"messaging-websocket" "Zaqar Websocket Service"
|
||||||
get_or_create_endpoint $zaqar_ws_service \
|
get_or_create_endpoint "messaging-websocket" \
|
||||||
"$REGION_NAME" \
|
"$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"
|
"$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST:$ZAQAR_WEBSOCKET_PORT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ ZAQAR_CONF_DIR=/etc/zaqar
|
|||||||
ZAQAR_CONF=$ZAQAR_CONF_DIR/zaqar.conf
|
ZAQAR_CONF=$ZAQAR_CONF_DIR/zaqar.conf
|
||||||
ZAQAR_POLICY_CONF=$ZAQAR_CONF_DIR/policy.yaml
|
ZAQAR_POLICY_CONF=$ZAQAR_CONF_DIR/policy.yaml
|
||||||
ZAQAR_UWSGI_CONF=$ZAQAR_CONF_DIR/uwsgi.conf
|
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_DIR=/var/log/zaqar
|
||||||
ZAQAR_API_LOG_FILE=$ZAQAR_API_LOG_DIR/queues.log
|
ZAQAR_API_LOG_FILE=$ZAQAR_API_LOG_DIR/queues.log
|
||||||
ZAQAR_AUTH_CACHE_DIR=${ZAQAR_AUTH_CACHE_DIR:-/var/cache/zaqar}
|
ZAQAR_AUTH_CACHE_DIR=${ZAQAR_AUTH_CACHE_DIR:-/var/cache/zaqar}
|
||||||
|
@ -19,8 +19,6 @@ source $ZAQAR_DEVSTACK_DIR/plugin.sh
|
|||||||
|
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
for serv in zaqar-websocket; do
|
for serv in zaqar-wsgi zaqar-websocket; do
|
||||||
stop_process $serv
|
stop_process $serv
|
||||||
done
|
done
|
||||||
|
|
||||||
uwsgi --stop $ZAQAR_UWSGI_MASTER_PIDFILE
|
|
Loading…
x
Reference in New Issue
Block a user