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
| ... | ... |
@@ -133,11 +133,23 @@ Example (Qpid): |
| 133 | 133 |
|
| 134 | 134 |
# Apache Frontend |
| 135 | 135 |
|
| 136 |
-Apache web server is enabled for wsgi services by setting |
|
| 137 |
-`APACHE_ENABLED_SERVICES` in your ``localrc`` section. Remember to |
|
| 138 |
-enable these services at first as above. |
|
| 136 |
+Apache web server can be enabled for wsgi services that support being deployed |
|
| 137 |
+under HTTPD + mod_wsgi. By default, services that recommend running under |
|
| 138 |
+HTTPD + mod_wsgi are deployed under Apache. To use an alternative deployment |
|
| 139 |
+strategy (e.g. eventlet) for services that support an alternative to HTTPD + |
|
| 140 |
+mod_wsgi set ``ENABLE_HTTPD_MOD_WSGI_SERVICES`` to ``False`` in your |
|
| 141 |
+``local.conf``. |
|
| 139 | 142 |
|
| 140 |
- APACHE_ENABLED_SERVICES+=key,swift |
|
| 143 |
+Each service that can be run under HTTPD + mod_wsgi also has an override |
|
| 144 |
+toggle available that can be set in your ``local.conf``. |
|
| 145 |
+ |
|
| 146 |
+Example (Keystone): |
|
| 147 |
+ |
|
| 148 |
+ KEYSTONE_USE_MOD_WSGI="True" |
|
| 149 |
+ |
|
| 150 |
+Example (Swift): |
|
| 151 |
+ |
|
| 152 |
+ SWIFT_USE_MOD_WSGI="True" |
|
| 141 | 153 |
|
| 142 | 154 |
# Swift |
| 143 | 155 |
|
| ... | ... |
@@ -8,7 +8,6 @@ |
| 8 | 8 |
# |
| 9 | 9 |
# lib/apache exports the following functions: |
| 10 | 10 |
# |
| 11 |
-# - is_apache_enabled_service |
|
| 12 | 11 |
# - install_apache_wsgi |
| 13 | 12 |
# - config_apache_wsgi |
| 14 | 13 |
# - apache_site_config_for |
| ... | ... |
@@ -42,23 +41,6 @@ fi |
| 42 | 42 |
|
| 43 | 43 |
# Functions |
| 44 | 44 |
# --------- |
| 45 |
- |
|
| 46 |
-# is_apache_enabled_service() checks if the service(s) specified as arguments are |
|
| 47 |
-# apache enabled by the user in ``APACHE_ENABLED_SERVICES`` as web front end. |
|
| 48 |
-# |
|
| 49 |
-# Multiple services specified as arguments are ``OR``'ed together; the test |
|
| 50 |
-# is a short-circuit boolean, i.e it returns on the first match. |
|
| 51 |
-# |
|
| 52 |
-# Uses global ``APACHE_ENABLED_SERVICES`` |
|
| 53 |
-# APACHE_ENABLED_SERVICES service [service ...] |
|
| 54 |
-function is_apache_enabled_service {
|
|
| 55 |
- services=$@ |
|
| 56 |
- for service in ${services}; do
|
|
| 57 |
- [[ ,${APACHE_ENABLED_SERVICES}, =~ ,${service}, ]] && return 0
|
|
| 58 |
- done |
|
| 59 |
- return 1 |
|
| 60 |
-} |
|
| 61 |
- |
|
| 62 | 45 |
# install_apache_wsgi() - Install Apache server and wsgi module |
| 63 | 46 |
function install_apache_wsgi {
|
| 64 | 47 |
# Apache installation, because we mark it NOPRIME |
| ... | ... |
@@ -46,6 +46,9 @@ KEYSTONECLIENT_DIR=$DEST/python-keystoneclient |
| 46 | 46 |
# Example of KEYSTONE_EXTENSIONS=oauth1,federation |
| 47 | 47 |
KEYSTONE_EXTENSIONS=${KEYSTONE_EXTENSIONS:-}
|
| 48 | 48 |
|
| 49 |
+# Toggle for deploying Keystone under HTTPD + mod_wsgi |
|
| 50 |
+KEYSTONE_USE_MOD_WSGI=${KEYSTONE_USE_MOD_WSGI:-False}
|
|
| 51 |
+ |
|
| 49 | 52 |
# Select the backend for Keystone's service catalog |
| 50 | 53 |
KEYSTONE_CATALOG_BACKEND=${KEYSTONE_CATALOG_BACKEND:-sql}
|
| 51 | 54 |
KEYSTONE_CATALOG=$KEYSTONE_CONF_DIR/default_catalog.templates |
| ... | ... |
@@ -112,6 +115,7 @@ function _cleanup_keystone_apache_wsgi {
|
| 112 | 112 |
sudo rm -f $KEYSTONE_WSGI_DIR/*.wsgi |
| 113 | 113 |
disable_apache_site keystone |
| 114 | 114 |
sudo rm -f $(apache_site_config_for keystone) |
| 115 |
+ restart_apache_server |
|
| 115 | 116 |
} |
| 116 | 117 |
|
| 117 | 118 |
# _config_keystone_apache_wsgi() - Set WSGI config files of Keystone |
| ... | ... |
@@ -265,11 +269,11 @@ function configure_keystone {
|
| 265 | 265 |
fi |
| 266 | 266 |
|
| 267 | 267 |
# Format logging |
| 268 |
- if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ] && ! is_apache_enabled_service key ; then |
|
| 268 |
+ if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ] && [ "$KEYSTONE_USE_MOD_WSGI" == "False" ] ; then |
|
| 269 | 269 |
setup_colorized_logging $KEYSTONE_CONF DEFAULT |
| 270 | 270 |
fi |
| 271 | 271 |
|
| 272 |
- if is_apache_enabled_service key; then |
|
| 272 |
+ if [ "$KEYSTONE_USE_MOD_WSGI" == "True" ]; then |
|
| 273 | 273 |
iniset $KEYSTONE_CONF DEFAULT debug "True" |
| 274 | 274 |
# Eliminate the %(asctime)s.%(msecs)03d from the log format strings |
| 275 | 275 |
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 {
|
| 442 | 442 |
fi |
| 443 | 443 |
git_clone $KEYSTONE_REPO $KEYSTONE_DIR $KEYSTONE_BRANCH |
| 444 | 444 |
setup_develop $KEYSTONE_DIR |
| 445 |
- if is_apache_enabled_service key; then |
|
| 445 |
+ if [ "$KEYSTONE_USE_MOD_WSGI" == "True" ]; then |
|
| 446 | 446 |
install_apache_wsgi |
| 447 | 447 |
fi |
| 448 | 448 |
} |
| ... | ... |
@@ -455,7 +459,7 @@ function start_keystone {
|
| 455 | 455 |
service_port=$KEYSTONE_SERVICE_PORT_INT |
| 456 | 456 |
fi |
| 457 | 457 |
|
| 458 |
- if is_apache_enabled_service key; then |
|
| 458 |
+ if [ "$KEYSTONE_USE_MOD_WSGI" == "True" ]; then |
|
| 459 | 459 |
restart_apache_server |
| 460 | 460 |
screen_it key "cd $KEYSTONE_DIR && sudo tail -f /var/log/$APACHE_NAME/keystone" |
| 461 | 461 |
else |
| ... | ... |
@@ -118,6 +118,8 @@ ACCOUNT_PORT_BASE=${ACCOUNT_PORT_BASE:-6012}
|
| 118 | 118 |
# Tell Tempest this project is present |
| 119 | 119 |
TEMPEST_SERVICES+=,swift |
| 120 | 120 |
|
| 121 |
+# Toggle for deploying Keystone under HTTPD + mod_wsgi |
|
| 122 |
+SWIFT_USE_MOD_WSGI=${SWIFT_USE_MOD_WSGI:-False}
|
|
| 121 | 123 |
|
| 122 | 124 |
# Functions |
| 123 | 125 |
# --------- |
| ... | ... |
@@ -139,7 +141,7 @@ function cleanup_swift {
|
| 139 | 139 |
rm ${SWIFT_DISK_IMAGE}
|
| 140 | 140 |
fi |
| 141 | 141 |
rm -rf ${SWIFT_DATA_DIR}/run/
|
| 142 |
- if is_apache_enabled_service swift; then |
|
| 142 |
+ if [ "$SWIFT_USE_MOD_WSGI" == "True" ]; then |
|
| 143 | 143 |
_cleanup_swift_apache_wsgi |
| 144 | 144 |
fi |
| 145 | 145 |
} |
| ... | ... |
@@ -470,7 +472,7 @@ EOF |
| 470 | 470 |
sudo killall -HUP rsyslogd |
| 471 | 471 |
fi |
| 472 | 472 |
|
| 473 |
- if is_apache_enabled_service swift; then |
|
| 473 |
+ if [ "$SWIFT_USE_MOD_WSGI" == "True" ]; then |
|
| 474 | 474 |
_config_swift_apache_wsgi |
| 475 | 475 |
fi |
| 476 | 476 |
} |
| ... | ... |
@@ -621,7 +623,7 @@ function init_swift {
|
| 621 | 621 |
function install_swift {
|
| 622 | 622 |
git_clone $SWIFT_REPO $SWIFT_DIR $SWIFT_BRANCH |
| 623 | 623 |
setup_develop $SWIFT_DIR |
| 624 |
- if is_apache_enabled_service swift; then |
|
| 624 |
+ if [ "$SWIFT_USE_MOD_WSGI" == "True" ]; then |
|
| 625 | 625 |
install_apache_wsgi |
| 626 | 626 |
fi |
| 627 | 627 |
} |
| ... | ... |
@@ -645,7 +647,7 @@ function start_swift {
|
| 645 | 645 |
start_service rsyncd |
| 646 | 646 |
fi |
| 647 | 647 |
|
| 648 |
- if is_apache_enabled_service swift; then |
|
| 648 |
+ if [ "$SWIFT_USE_MOD_WSGI" == "True" ]; then |
|
| 649 | 649 |
restart_apache_server |
| 650 | 650 |
swift-init --run-dir=${SWIFT_DATA_DIR}/run rest start
|
| 651 | 651 |
screen_it s-proxy "cd $SWIFT_DIR && sudo tail -f /var/log/$APACHE_NAME/proxy-server" |
| ... | ... |
@@ -682,7 +684,7 @@ function start_swift {
|
| 682 | 682 |
# stop_swift() - Stop running processes (non-screen) |
| 683 | 683 |
function stop_swift {
|
| 684 | 684 |
|
| 685 |
- if is_apache_enabled_service swift; then |
|
| 685 |
+ if [ "$SWIFT_USE_MOD_WSGI" == "True" ]; then |
|
| 686 | 686 |
swift-init --run-dir=${SWIFT_DATA_DIR}/run rest stop && return 0
|
| 687 | 687 |
fi |
| 688 | 688 |
|
| ... | ... |
@@ -52,6 +52,12 @@ if [[ -z "$ENABLED_SERVICES" ]]; then |
| 52 | 52 |
ENABLED_SERVICES+=,rabbit,tempest,mysql |
| 53 | 53 |
fi |
| 54 | 54 |
|
| 55 |
+# Global toggle for enabling services under mod_wsgi. If this is set to |
|
| 56 |
+# ``True`` all services that use HTTPD + mod_wsgi as the preferred method of |
|
| 57 |
+# deployment, will be deployed under Apache. If this is set to ``False`` all |
|
| 58 |
+# services will rely on the local toggle variable (e.g. ``KEYSTONE_USE_MOD_WSGI``) |
|
| 59 |
+ENABLE_HTTPD_MOD_WSGI_SERVICES=True |
|
| 60 |
+ |
|
| 55 | 61 |
# Tell Tempest which services are available. The default is set here as |
| 56 | 62 |
# Tempest falls late in the configuration sequence. This differs from |
| 57 | 63 |
# ``ENABLED_SERVICES`` in that the project names are used here rather than |