Merge "Update Apache + mod_wsgi deployment mechanisms"

This commit is contained in:
Jenkins 2014-07-07 23:53:26 +00:00 committed by Gerrit Code Review
commit 49d14407c5
5 changed files with 37 additions and 31 deletions

View File

@ -133,11 +133,23 @@ Example (Qpid):
# Apache Frontend
Apache web server is enabled for wsgi services by setting
`APACHE_ENABLED_SERVICES` in your ``localrc`` section. Remember to
enable these services at first as above.
Apache web server can be enabled for wsgi services that support being deployed
under HTTPD + mod_wsgi. By default, services that recommend running under
HTTPD + mod_wsgi are deployed under Apache. To use an alternative deployment
strategy (e.g. eventlet) for services that support an alternative to HTTPD +
mod_wsgi set ``ENABLE_HTTPD_MOD_WSGI_SERVICES`` to ``False`` in your
``local.conf``.
APACHE_ENABLED_SERVICES+=key,swift
Each service that can be run under HTTPD + mod_wsgi also has an override
toggle available that can be set in your ``local.conf``.
Example (Keystone):
KEYSTONE_USE_MOD_WSGI="True"
Example (Swift):
SWIFT_USE_MOD_WSGI="True"
# Swift

View File

@ -8,7 +8,6 @@
#
# lib/apache exports the following functions:
#
# - is_apache_enabled_service
# - install_apache_wsgi
# - config_apache_wsgi
# - apache_site_config_for
@ -42,23 +41,6 @@ fi
# Functions
# ---------
# is_apache_enabled_service() checks if the service(s) specified as arguments are
# apache enabled by the user in ``APACHE_ENABLED_SERVICES`` as web front end.
#
# Multiple services specified as arguments are ``OR``'ed together; the test
# is a short-circuit boolean, i.e it returns on the first match.
#
# Uses global ``APACHE_ENABLED_SERVICES``
# APACHE_ENABLED_SERVICES service [service ...]
function is_apache_enabled_service {
services=$@
for service in ${services}; do
[[ ,${APACHE_ENABLED_SERVICES}, =~ ,${service}, ]] && return 0
done
return 1
}
# install_apache_wsgi() - Install Apache server and wsgi module
function install_apache_wsgi {
# Apache installation, because we mark it NOPRIME

View File

@ -46,6 +46,9 @@ KEYSTONECLIENT_DIR=$DEST/python-keystoneclient
# Example of KEYSTONE_EXTENSIONS=oauth1,federation
KEYSTONE_EXTENSIONS=${KEYSTONE_EXTENSIONS:-}
# Toggle for deploying Keystone under HTTPD + mod_wsgi
KEYSTONE_USE_MOD_WSGI=${KEYSTONE_USE_MOD_WSGI:-False}
# Select the backend for Keystone's service catalog
KEYSTONE_CATALOG_BACKEND=${KEYSTONE_CATALOG_BACKEND:-sql}
KEYSTONE_CATALOG=$KEYSTONE_CONF_DIR/default_catalog.templates
@ -112,6 +115,7 @@ function _cleanup_keystone_apache_wsgi {
sudo rm -f $KEYSTONE_WSGI_DIR/*.wsgi
disable_apache_site keystone
sudo rm -f $(apache_site_config_for keystone)
restart_apache_server
}
# _config_keystone_apache_wsgi() - Set WSGI config files of Keystone
@ -265,11 +269,11 @@ function configure_keystone {
fi
# Format logging
if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ] && ! is_apache_enabled_service key ; then
if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ] && [ "$KEYSTONE_USE_MOD_WSGI" == "False" ] ; then
setup_colorized_logging $KEYSTONE_CONF DEFAULT
fi
if is_apache_enabled_service key; then
if [ "$KEYSTONE_USE_MOD_WSGI" == "True" ]; then
iniset $KEYSTONE_CONF DEFAULT debug "True"
# Eliminate the %(asctime)s.%(msecs)03d from the log format strings
iniset $KEYSTONE_CONF DEFAULT logging_context_format_string "%(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s"
@ -442,7 +446,7 @@ function install_keystone {
fi
git_clone $KEYSTONE_REPO $KEYSTONE_DIR $KEYSTONE_BRANCH
setup_develop $KEYSTONE_DIR
if is_apache_enabled_service key; then
if [ "$KEYSTONE_USE_MOD_WSGI" == "True" ]; then
install_apache_wsgi
fi
}
@ -455,7 +459,7 @@ function start_keystone {
service_port=$KEYSTONE_SERVICE_PORT_INT
fi
if is_apache_enabled_service key; then
if [ "$KEYSTONE_USE_MOD_WSGI" == "True" ]; then
restart_apache_server
screen_it key "cd $KEYSTONE_DIR && sudo tail -f /var/log/$APACHE_NAME/keystone"
else

View File

@ -118,6 +118,8 @@ ACCOUNT_PORT_BASE=${ACCOUNT_PORT_BASE:-6012}
# Tell Tempest this project is present
TEMPEST_SERVICES+=,swift
# Toggle for deploying Keystone under HTTPD + mod_wsgi
SWIFT_USE_MOD_WSGI=${SWIFT_USE_MOD_WSGI:-False}
# Functions
# ---------
@ -139,7 +141,7 @@ function cleanup_swift {
rm ${SWIFT_DISK_IMAGE}
fi
rm -rf ${SWIFT_DATA_DIR}/run/
if is_apache_enabled_service swift; then
if [ "$SWIFT_USE_MOD_WSGI" == "True" ]; then
_cleanup_swift_apache_wsgi
fi
}
@ -470,7 +472,7 @@ EOF
sudo killall -HUP rsyslogd
fi
if is_apache_enabled_service swift; then
if [ "$SWIFT_USE_MOD_WSGI" == "True" ]; then
_config_swift_apache_wsgi
fi
}
@ -621,7 +623,7 @@ function init_swift {
function install_swift {
git_clone $SWIFT_REPO $SWIFT_DIR $SWIFT_BRANCH
setup_develop $SWIFT_DIR
if is_apache_enabled_service swift; then
if [ "$SWIFT_USE_MOD_WSGI" == "True" ]; then
install_apache_wsgi
fi
}
@ -645,7 +647,7 @@ function start_swift {
start_service rsyncd
fi
if is_apache_enabled_service swift; then
if [ "$SWIFT_USE_MOD_WSGI" == "True" ]; then
restart_apache_server
swift-init --run-dir=${SWIFT_DATA_DIR}/run rest start
screen_it s-proxy "cd $SWIFT_DIR && sudo tail -f /var/log/$APACHE_NAME/proxy-server"
@ -682,7 +684,7 @@ function start_swift {
# stop_swift() - Stop running processes (non-screen)
function stop_swift {
if is_apache_enabled_service swift; then
if [ "$SWIFT_USE_MOD_WSGI" == "True" ]; then
swift-init --run-dir=${SWIFT_DATA_DIR}/run rest stop && return 0
fi

View File

@ -52,6 +52,12 @@ if [[ -z "$ENABLED_SERVICES" ]]; then
ENABLED_SERVICES+=,rabbit,tempest,mysql
fi
# Global toggle for enabling services under mod_wsgi. If this is set to
# ``True`` all services that use HTTPD + mod_wsgi as the preferred method of
# deployment, will be deployed under Apache. If this is set to ``False`` all
# services will rely on the local toggle variable (e.g. ``KEYSTONE_USE_MOD_WSGI``)
ENABLE_HTTPD_MOD_WSGI_SERVICES=True
# Tell Tempest which services are available. The default is set here as
# Tempest falls late in the configuration sequence. This differs from
# ``ENABLED_SERVICES`` in that the project names are used here rather than