Update Apache + mod_wsgi deployment mechanisms
Added a global toggle for enabling HTTPD + mod_wsgi for services that default deploy to running under Apache. When the variable ``ENABLE_HTTPD_MOD_WSGI_SERVICES`` is set to ``True`` any service that recommends deploying under HTTPD + mod_wsgi, will be run under Apache. If ``ENABLE_HTTPD_MOD_WSGI_SERVICES`` is set to ``False`` the any service that is defaulted to running under HTTPD + mod_wsgi will (if capable) be run in an alternate deployment strategy (e.g. eventlet). Updated Swift and Keystone to have individual toggles for deploying under HTTPD + mod_wsgi. This is done to allow for gate to run on the services under mod_wsgi where appropriate. Toggles are ``KEYSTONE_USE_MOD_WSGI`` and ``SWIFT_USE_MOD_WSGI`` and are both defaulted to "False" (do not deploy under HTTPD + mod_wsgi). Change-Id: Id3b121b8f1cde369d184b586e0d875bdbda34813
This commit is contained in:
parent
9c0f077dd5
commit
46455a34d5
20
README.md
20
README.md
@ -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
|
||||
|
||||
|
18
lib/apache
18
lib/apache
@ -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
|
||||
|
12
lib/keystone
12
lib/keystone
@ -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
|
||||
|
12
lib/swift
12
lib/swift
@ -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
|
||||
|
||||
|
6
stackrc
6
stackrc
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user