Listen on 127.0.0.1 in devstack

To allow monitoring checks to work, the API should additionally listen
on 127.0.0.1. This changes the devstack plugin so the generated apache
configuration will allow monasca to work without additional tweaking
in a dev environment.

Change-Id: Iaca8eac43d66de5a08e85cf58d7af42c29618bca
This commit is contained in:
Tim Buckley
2016-07-11 10:34:05 -06:00
parent 6cbd0424f1
commit 0fef37e57a
2 changed files with 14 additions and 1 deletions

View File

@@ -1,5 +1,9 @@
Listen %SERVICE_HOST%:%FREEZER_API_PORT%
# Placeholder to conditionally insert a 'Listen 127.0.0.1' directive when
# %SERVICE_HOST% is not already 127.0.0.1
%LOCAL_LISTEN%
<VirtualHost *:%FREEZER_API_PORT%>
WSGIDaemonProcess freezer-api processes=2 threads=2 user=%USER% display-name=%{GROUP}
WSGIProcessGroup freezer-api

View File

@@ -195,6 +195,14 @@ function create_freezer_api_accounts {
function configure_apache_freezer_app {
local freezer_api_apache_conf=$(apache_site_config_for freezer-api)
# Add a %LOCAL_LISTEN% parameter to conditionally listen 127.0.0.1 when
# not already doing so to allow monitoring checks
local local_listen="Listen 127.0.0.1:$FREEZER_API_PORT"
if [[ "${SERVICE_HOST}" == "127.0.0.1" ]] || [[ "${SERVICE_HOST}" == "localhost" ]]; then
local_listen=""
fi
sudo cp $FREEZER_API_FILES/apache-freezer-api.template $freezer_api_apache_conf
sudo sed -e "
s|%FREEZER_API_PORT%|$FREEZER_API_PORT|g;
@@ -202,7 +210,8 @@ function configure_apache_freezer_app {
s|%USER%|$STACK_USER|g;
s|%FREEZER_API_DIR%|$FREEZER_API_DIR|g;
s|%APACHE_NAME%|$APACHE_NAME|g;
s|%VIRTUALENV%|$venv_path|g
s|%VIRTUALENV%|$venv_path|g;
s|%LOCAL_LISTEN%|$local_listen|g
" -i $freezer_api_apache_conf
}