support uwsgi in devstack
This change allows to use uwsgi as web server. Change-Id: Ib3a22e10c6f95ce387575ea5eeea0d97d6bfac1d
This commit is contained in:
parent
9170fa0370
commit
17ee70a82f
@ -24,6 +24,23 @@ else
|
|||||||
VITRAGE_BIN_DIR=$(get_python_exec_prefix)
|
VITRAGE_BIN_DIR=$(get_python_exec_prefix)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$VITRAGE_DEPLOY" ]; then
|
||||||
|
# Default
|
||||||
|
VITRAGE_DEPLOY=simple
|
||||||
|
|
||||||
|
# Fallback to common wsgi devstack configuration
|
||||||
|
if [ "$ENABLE_HTTPD_MOD_WSGI_SERVICES" == "True" ]; then
|
||||||
|
VITRAGE_DEPLOY=mod_wsgi
|
||||||
|
|
||||||
|
# Deprecated config
|
||||||
|
elif [ -n "$VITRAGE_USE_MOD_WSGI" ] ; then
|
||||||
|
echo_summary "VITRAGE_USE_MOD_WSGI is deprecated, use VITRAGE_DEPLOY instead"
|
||||||
|
if [ "$VITRAGE_USE_MOD_WSGI" == True ]; then
|
||||||
|
VITRAGE_DEPLOY=mod_wsgi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Test if any Vitrage services are enabled
|
# Test if any Vitrage services are enabled
|
||||||
# is_vitrage_enabled
|
# is_vitrage_enabled
|
||||||
function is_vitrage_enabled {
|
function is_vitrage_enabled {
|
||||||
@ -97,7 +114,7 @@ function _vitrage_cleanup_apache_wsgi {
|
|||||||
# cleanup_vitrage() - Remove residual data files, anything left over
|
# cleanup_vitrage() - Remove residual data files, anything left over
|
||||||
# from previous runs that a clean run would need to clean up
|
# from previous runs that a clean run would need to clean up
|
||||||
function cleanup_vitrage {
|
function cleanup_vitrage {
|
||||||
if [ "$VITRAGE_USE_MOD_WSGI" == "True" ]; then
|
if [ "$VITRAGE_DEPLOY" == "mod_wsgi" ]; then
|
||||||
_vitrage_cleanup_apache_wsgi
|
_vitrage_cleanup_apache_wsgi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -122,6 +139,16 @@ function configure_vitrage {
|
|||||||
|
|
||||||
iniset $VITRAGE_CONF DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL"
|
iniset $VITRAGE_CONF DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL"
|
||||||
|
|
||||||
|
# Set up logging
|
||||||
|
if [ "$SYSLOG" != "False" ]; then
|
||||||
|
iniset $VITRAGE_CONF DEFAULT use_syslog "True"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Format logging
|
||||||
|
if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ] && [ "$VITRAGE_DEPLOY" != "mod_wsgi" ]; then
|
||||||
|
setup_colorized_logging $VITRAGE_CONF DEFAULT
|
||||||
|
fi
|
||||||
|
|
||||||
# Install the policy file for the API server
|
# Install the policy file for the API server
|
||||||
cp $VITRAGE_DIR/etc/vitrage/policy.json $VITRAGE_CONF_DIR
|
cp $VITRAGE_DIR/etc/vitrage/policy.json $VITRAGE_CONF_DIR
|
||||||
iniset $VITRAGE_CONF oslo_policy policy_file $VITRAGE_CONF_DIR/policy.json
|
iniset $VITRAGE_CONF oslo_policy policy_file $VITRAGE_CONF_DIR/policy.json
|
||||||
@ -177,11 +204,33 @@ function configure_vitrage {
|
|||||||
iniset $VITRAGE_CONF "keystone_authtoken" project_name $admin_project_name
|
iniset $VITRAGE_CONF "keystone_authtoken" project_name $admin_project_name
|
||||||
iniset $VITRAGE_CONF "keystone_authtoken" project_domain_name $admin_domain_name
|
iniset $VITRAGE_CONF "keystone_authtoken" project_domain_name $admin_domain_name
|
||||||
|
|
||||||
if [ "$VITRAGE_USE_MOD_WSGI" == "True" ]; then
|
if [ "$VITRAGE_DEPLOY" == "mod_wsgi" ]; then
|
||||||
iniset $VITRAGE_CONF api pecan_debug "False"
|
|
||||||
_vitrage_config_apache_wsgi
|
_vitrage_config_apache_wsgi
|
||||||
fi
|
elif [ "$VITRAGE_DEPLOY" == "uwsgi" ]; then
|
||||||
|
# iniset creates these files when it's called if they don't exist.
|
||||||
|
VITRAGE_UWSGI_FILE=$VITRAGE_CONF_DIR/vitrage-uwsgi.ini
|
||||||
|
|
||||||
|
rm -f "$VITRAGE_UWSGI_FILE"
|
||||||
|
|
||||||
|
iniset "$VITRAGE_UWSGI_FILE" uwsgi http $VITRAGE_SERVICE_HOST:$VITRAGE_SERVICE_PORT
|
||||||
|
iniset "$VITRAGE_UWSGI_FILE" uwsgi wsgi-file "$VITRAGE_DIR/vitrage/api/app.wsgi"
|
||||||
|
# This is running standalone
|
||||||
|
iniset "$VITRAGE_UWSGI_FILE" uwsgi master true
|
||||||
|
# Set die-on-term & exit-on-reload so that uwsgi shuts down
|
||||||
|
iniset "$VITRAGE_UWSGI_FILE" uwsgi die-on-term true
|
||||||
|
iniset "$VITRAGE_UWSGI_FILE" uwsgi exit-on-reload true
|
||||||
|
iniset "$VITRAGE_UWSGI_FILE" uwsgi threads 10
|
||||||
|
iniset "$VITRAGE_UWSGI_FILE" uwsgi processes $API_WORKERS
|
||||||
|
iniset "$VITRAGE_UWSGI_FILE" uwsgi enable-threads true
|
||||||
|
iniset "$VITRAGE_UWSGI_FILE" uwsgi plugins python
|
||||||
|
iniset "$VITRAGE_UWSGI_FILE" uwsgi lazy-apps true
|
||||||
|
# uwsgi recommends this to prevent thundering herd on accept.
|
||||||
|
iniset "$VITRAGE_UWSGI_FILE" uwsgi thunder-lock true
|
||||||
|
# Override default size for headers from the 4k default.
|
||||||
|
iniset "$VITRAGE_UWSGI_FILE" uwsgi buffer-size 65535
|
||||||
|
# Make sure client doesn't try to re-use the connection.
|
||||||
|
iniset "$VITRAGE_UWSGI_FILE" uwsgi add-header "Connection: close"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# init_vitrage() - Initialize etc.
|
# init_vitrage() - Initialize etc.
|
||||||
@ -198,7 +247,13 @@ function init_vitrage {
|
|||||||
function install_vitrage {
|
function install_vitrage {
|
||||||
install_vitrageclient
|
install_vitrageclient
|
||||||
setup_develop "$VITRAGE_DIR"
|
setup_develop "$VITRAGE_DIR"
|
||||||
sudo install -d -o $STACK_USER -m 755 $VITRAGE_CONF_DIR $VITRAGE_API_LOG_DIR
|
sudo install -d -o $STACK_USER -m 755 $VITRAGE_CONF_DIR
|
||||||
|
|
||||||
|
if [ "$VITRAGE_DEPLOY" == "mod_wsgi" ]; then
|
||||||
|
install_apache_wsgi
|
||||||
|
elif [ "$VITRAGE_DEPLOY" == "uwsgi" ]; then
|
||||||
|
pip_install uwsgi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# install_vitrageclient()
|
# install_vitrageclient()
|
||||||
@ -214,13 +269,15 @@ function install_vitrageclient {
|
|||||||
|
|
||||||
# start_vitrage() - Start running processes, including screen
|
# start_vitrage() - Start running processes, including screen
|
||||||
function start_vitrage {
|
function start_vitrage {
|
||||||
if [[ "$VITRAGE_USE_MOD_WSGI" == "False" ]]; then
|
if [[ "$VITRAGE_DEPLOY" == "mod_wsgi" ]]; then
|
||||||
run_process vitrage-api "$VITRAGE_BIN_DIR/vitrage-api -d -v --log-dir=$VITRAGE_API_LOG_DIR --config-file $VITRAGE_CONF"
|
|
||||||
else
|
|
||||||
enable_apache_site vitrage
|
enable_apache_site vitrage
|
||||||
restart_apache_server
|
restart_apache_server
|
||||||
tail_log vitrage /var/log/$APACHE_NAME/vitrage.log
|
tail_log vitrage /var/log/$APACHE_NAME/vitrage.log
|
||||||
tail_log vitrage-api /var/log/$APACHE_NAME/vitrage_access.log
|
tail_log vitrage-api /var/log/$APACHE_NAME/vitrage_access.log
|
||||||
|
elif [ "$VITRAGE_DEPLOY" == "uwsgi" ]; then
|
||||||
|
run_process vitrage-api "$VITRAGE_BIN_DIR/uwsgi $VITRAGE_UWSGI_FILE"
|
||||||
|
else
|
||||||
|
run_process vitrage-api "$VITRAGE_BIN_DIR/vitrage-api -d -v --config-file $VITRAGE_CONF"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Only die on API if it was actually intended to be turned on
|
# Only die on API if it was actually intended to be turned on
|
||||||
@ -238,7 +295,7 @@ function start_vitrage {
|
|||||||
|
|
||||||
# stop_vitrage() - Stop running processes
|
# stop_vitrage() - Stop running processes
|
||||||
function stop_vitrage {
|
function stop_vitrage {
|
||||||
if [ "$VITRAGE_USE_MOD_WSGI" == "True" ]; then
|
if [ "$VITRAGE_DEPLOY" == "mod_wsgi" ]; then
|
||||||
disable_apache_site vitrage
|
disable_apache_site vitrage
|
||||||
restart_apache_server
|
restart_apache_server
|
||||||
fi
|
fi
|
||||||
|
@ -5,8 +5,7 @@ enable_service vitrage-api
|
|||||||
enable_service vitrage-graph
|
enable_service vitrage-graph
|
||||||
# Notifier
|
# Notifier
|
||||||
enable_service vitrage-notifier
|
enable_service vitrage-notifier
|
||||||
|
# Collector
|
||||||
# Notifier
|
|
||||||
enable_service vitrage-collector
|
enable_service vitrage-collector
|
||||||
|
|
||||||
|
|
||||||
@ -14,7 +13,6 @@ enable_service vitrage-collector
|
|||||||
VITRAGE_DIR=$DEST/vitrage
|
VITRAGE_DIR=$DEST/vitrage
|
||||||
VITRAGE_CONF_DIR=/etc/vitrage
|
VITRAGE_CONF_DIR=/etc/vitrage
|
||||||
VITRAGE_CONF=$VITRAGE_CONF_DIR/vitrage.conf
|
VITRAGE_CONF=$VITRAGE_CONF_DIR/vitrage.conf
|
||||||
VITRAGE_API_LOG_DIR=/var/log/vitrage-api
|
|
||||||
VITRAGE_AUTH_CACHE_DIR=${VITRAGE_AUTH_CACHE_DIR:-/var/cache/vitrage}
|
VITRAGE_AUTH_CACHE_DIR=${VITRAGE_AUTH_CACHE_DIR:-/var/cache/vitrage}
|
||||||
VITRAGE_WSGI_DIR=${VITRAGE_WSGI_DIR:-/var/www/vitrage}
|
VITRAGE_WSGI_DIR=${VITRAGE_WSGI_DIR:-/var/www/vitrage}
|
||||||
|
|
||||||
@ -22,7 +20,13 @@ VITRAGE_WSGI_DIR=${VITRAGE_WSGI_DIR:-/var/www/vitrage}
|
|||||||
VITRAGE_SERVICE_PROTOCOL=http
|
VITRAGE_SERVICE_PROTOCOL=http
|
||||||
VITRAGE_SERVICE_HOST=$SERVICE_HOST
|
VITRAGE_SERVICE_HOST=$SERVICE_HOST
|
||||||
VITRAGE_SERVICE_PORT=${VITRAGE_SERVICE_PORT:-8999}
|
VITRAGE_SERVICE_PORT=${VITRAGE_SERVICE_PORT:-8999}
|
||||||
VITRAGE_USE_MOD_WSGI=${VITRAGE_USE_MOD_WSGI:-${ENABLE_HTTPD_MOD_WSGI_SERVICES}}
|
|
||||||
|
# VITRAGE_DEPLOY defines how Vitrage is deployed, allowed values:
|
||||||
|
# - mod_wsgi : Run Vitrage under Apache HTTPd mod_wsgi
|
||||||
|
# - simple : Run vitrage-api
|
||||||
|
# - uwsgi : Run Vitrage under uwsgi
|
||||||
|
# - <empty>: Fallback to VITRAGE_USE_MOD_WSGI or ENABLE_HTTPD_MOD_WSGI_SERVICES
|
||||||
|
VITRAGE_DEPLOY=${VITRAGE_DEPLOY}
|
||||||
|
|
||||||
# Toggle for deploying Vitrage with/without nagios
|
# Toggle for deploying Vitrage with/without nagios
|
||||||
VITRAGE_USE_NAGIOS=$(trueorfalse False VITRAGE_USE_NAGIOS)
|
VITRAGE_USE_NAGIOS=$(trueorfalse False VITRAGE_USE_NAGIOS)
|
||||||
|
Loading…
Reference in New Issue
Block a user