summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-02-18 20:15:21 +0000
committerGerrit Code Review <review@openstack.org>2022-02-18 20:15:21 +0000
commit5c78c8d248ea48953816bc822e026c964b9be4ba (patch)
tree0d00b4ff53d6cbb457723bbef7107de90ce68ef4
parent7e543c2d22516254cbaab111e9dad87a408ab80d (diff)
parentb1e1974fe83f8483887291ee8da7592b3e02167d (diff)
downloaddesignate-5c78c8d248ea48953816bc822e026c964b9be4ba.tar.gz
Merge "Fix grenade job for mod_wsgi to uwsgi transition"
-rw-r--r--devstack/lib/wsgi36
-rwxr-xr-xdevstack/plugin.sh43
-rw-r--r--devstack/upgrade/from-xena/upgrade-designate27
-rwxr-xr-xdevstack/upgrade/upgrade.sh4
4 files changed, 77 insertions, 33 deletions
diff --git a/devstack/lib/wsgi b/devstack/lib/wsgi
new file mode 100644
index 00000000..37633c3e
--- /dev/null
+++ b/devstack/lib/wsgi
@@ -0,0 +1,36 @@
+function designate_configure_uwsgi {
+ write_uwsgi_config "$DESIGNATE_UWSGI_CONF" "$DESIGNATE_UWSGI" "/dns"
+
+ # We are using the http transport to work around an issue with
+ # broken connections when using the uwsgi protocol of a local socket
+ # See bug: https://github.com/unbit/uwsgi/issues/2368
+ wsgi_conf=$(apache_site_config_for designate-api-wsgi)
+ echo 'ProxyPass "/dns" "http://127.0.0.1:60053" retry=0' | sudo tee $wsgi_conf
+
+ iniset $DESIGNATE_UWSGI_CONF uwsgi http-socket 127.0.0.1:60053
+}
+
+function designate_configure_mod_wsgi {
+ local designate_api_apache_conf
+ local venv_path=""
+ local designate_bin_dir=""
+ designate_bin_dir=$(get_python_exec_prefix)
+ designate_api_apache_conf=$(apache_site_config_for designate-api)
+
+ if [[ ${USE_VENV} = True ]]; then
+ venv_path="python-path=${PROJECT_VENV["designate"]}/lib/$(python_version)/site-packages"
+ designate_bin_dir=${PROJECT_VENV["designate"]}/bin
+ fi
+
+ sudo cp $DESIGNATE_DIR/devstack/files/apache-designate-api.template $designate_api_apache_conf
+ sudo sed -e "
+ s|%APACHE_NAME%|$APACHE_NAME|g;
+ s|%DESIGNATE_BIN_DIR%|$designate_bin_dir|g;
+ s|%SSLENGINE%|$designate_ssl|g;
+ s|%SSLCERTFILE%|$designate_certfile|g;
+ s|%SSLKEYFILE%|$designate_keyfile|g;
+ s|%USER%|$STACK_USER|g;
+ s|%VIRTUALENV%|$venv_path|g;
+ s|%APIWORKERS%|$API_WORKERS|g;
+ " -i $designate_api_apache_conf
+}
diff --git a/devstack/plugin.sh b/devstack/plugin.sh
index a7a209f5..69b5b147 100755
--- a/devstack/plugin.sh
+++ b/devstack/plugin.sh
@@ -4,6 +4,10 @@
XTRACE=$(set +o | grep xtrace)
set +o xtrace
+LIBDIR=$DEST/designate/devstack/lib
+
+source $LIBDIR/wsgi
+
# Get backend configuration
# -------------------------
if is_service_enabled designate && [[ -r $DESIGNATE_PLUGINS/backend-$DESIGNATE_BACKEND_DRIVER ]]; then
@@ -121,43 +125,12 @@ function configure_designate {
configure_designate_backend
if [[ "$DESIGNATE_WSGI_MODE" == "uwsgi" ]]; then
- write_uwsgi_config "$DESIGNATE_UWSGI_CONF" "$DESIGNATE_UWSGI" "/dns"
- # We are using the http transport to work around an issue with
- # broken connections when using the uwsgi protocol of a local socket
- # See bug: https://github.com/unbit/uwsgi/issues/2368
- wsgi_conf=$(apache_site_config_for designate-api-wsgi)
- echo 'ProxyPass "/dns" "http://127.0.0.1:60053" retry=0' | sudo tee $wsgi_conf
- iniset $DESIGNATE_UWSGI_CONF uwsgi http-socket 127.0.0.1:60053
+ designate_configure_uwsgi
else
- _config_designate_apache_wsgi
+ designate_configure_mod_wsgi
fi
}
-function _config_designate_apache_wsgi {
- local designate_api_apache_conf
- local venv_path=""
- local designate_bin_dir=""
- designate_bin_dir=$(get_python_exec_prefix)
- designate_api_apache_conf=$(apache_site_config_for designate-api)
-
- if [[ ${USE_VENV} = True ]]; then
- venv_path="python-path=${PROJECT_VENV["designate"]}/lib/$(python_version)/site-packages"
- designate_bin_dir=${PROJECT_VENV["designate"]}/bin
- fi
-
- sudo cp $DESIGNATE_DIR/devstack/files/apache-designate-api.template $designate_api_apache_conf
- sudo sed -e "
- s|%APACHE_NAME%|$APACHE_NAME|g;
- s|%DESIGNATE_BIN_DIR%|$designate_bin_dir|g;
- s|%SSLENGINE%|$designate_ssl|g;
- s|%SSLCERTFILE%|$designate_certfile|g;
- s|%SSLKEYFILE%|$designate_keyfile|g;
- s|%USER%|$STACK_USER|g;
- s|%VIRTUALENV%|$venv_path|g;
- s|%APIWORKERS%|$API_WORKERS|g;
- " -i $designate_api_apache_conf
-}
-
function configure_designatedashboard {
# Compile message catalogs
if [ -d ${DESIGNATEDASHBOARD_DIR}/designatedashboard/locale ]; then
@@ -311,6 +284,8 @@ function start_designate {
if [[ "$DESIGNATE_WSGI_MODE" == "uwsgi" ]]; then
run_process "designate-api" "$(which uwsgi) --procname-prefix designate-api --ini $DESIGNATE_UWSGI_CONF"
+ enable_apache_site designate-api-wsgi
+ restart_apache_server
else
enable_apache_site designate-api
restart_apache_server
@@ -326,6 +301,8 @@ function start_designate {
function stop_designate {
if [[ "$DESIGNATE_WSGI_MODE" == "uwsgi" ]]; then
stop_process "designate-api"
+ disable_apache_site designate-api-wsgi
+ restart_apache_server
else
disable_apache_site designate-api
restart_apache_server
diff --git a/devstack/upgrade/from-xena/upgrade-designate b/devstack/upgrade/from-xena/upgrade-designate
new file mode 100644
index 00000000..cbad27c8
--- /dev/null
+++ b/devstack/upgrade/from-xena/upgrade-designate
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+# Designate moved from using mod_wsgi to running uwsgi with an Apache proxy
+# pass-through for devstack in the yoga release cycle.
+# This upgrade script updates the Apache configuration to switch the wsgi
+# approach during a xena->yoga grenade test.
+# Since this is a from-* script, it will run after installing the new code
+# but before the upgraded code is started.
+
+function configure_designate_upgrade {
+ source $GRENADE_DIR/functions
+ source ${TARGET_DEVSTACK_DIR}/lib/apache
+ DESIGNATE_DEVSTACK_DIR=$(dirname $(dirname $0))
+ source $DESIGNATE_DEVSTACK_DIR/lib/wsgi
+
+ # Disable the old site using mod_wsgi
+ disable_apache_site designate-api
+
+ # Setup the apache uswgi site "designate-api-wsgi"
+ designate_configure_uwsgi
+ enable_apache_site designate-api-wsgi
+ restart_apache_server
+
+ # Switch designate-api to run under uwsgi
+ stop_process designate-api
+ run_process "designate-api" "$(which uwsgi) --procname-prefix designate-api --ini $DESIGNATE_UWSGI_CONF"
+}
diff --git a/devstack/upgrade/upgrade.sh b/devstack/upgrade/upgrade.sh
index f8bdfc56..3f391d75 100755
--- a/devstack/upgrade/upgrade.sh
+++ b/devstack/upgrade/upgrade.sh
@@ -29,6 +29,9 @@ source $GRENADE_DIR/grenaderc
# Import common functions
source $GRENADE_DIR/functions
+# Get the Apache functions
+source ${TARGET_DEVSTACK_DIR}/lib/apache
+
# This script exits on an error so that errors don't compound and you see
# only the first error that occurred.
set -o errexit
@@ -82,6 +85,7 @@ run_process designate-worker "$DESIGNATE_BIN_DIR/designate-worker --config-file
run_process designate-mdns "$DESIGNATE_BIN_DIR/designate-mdns --config-file $DESIGNATE_CONF"
run_process designate-agent "$DESIGNATE_BIN_DIR/designate-agent --config-file $DESIGNATE_CONF"
run_process designate-sink "$DESIGNATE_BIN_DIR/designate-sink --config-file $DESIGNATE_CONF"
+restart_apache_server
# Start proxies if enabled
if is_service_enabled designate-api && is_service_enabled tls-proxy; then