Properly remap http port 80 mappings to https 443 when adding an ssl certificate

Rather than removing all port mappings, we simply remap port 80 mappings to 443. The previous behavior would remove custom port mappings for all applications and reset them on any certificate change, preventing automation from plugins such as letsencrypt. While this behavior doesn't matter for buildpack deploys - which only expose a single port on container port 5000 - Dockerfile deploys would frequently be affected by such a change, requiring a remapping of all custom ports.

This commit also standardizes on the method used to source the proxy functions
This commit is contained in:
Jose Diaz-Gonzalez
2016-07-15 02:51:31 -04:00
parent c93396aff9
commit 0d4560177a
9 changed files with 77 additions and 39 deletions

View File

@@ -20,7 +20,12 @@ nginx_post_certs_update() {
config_unset --no-restart "$APP" DOKKU_NGINX_SSL_PORT
fi
if [[ "$DOKKU_PROXY_PORT_MAP" == *http:80:* ]]; then
config_unset --no-restart "$APP" DOKKU_PROXY_PORT_MAP
# shellcheck disable=SC2046
remove_proxy_ports "$APP" $(filter_app_proxy_ports "$APP" "https" "443")
# shellcheck disable=SC2046
for port_map in $(filter_app_proxy_ports "$APP" "http" "80"); do
add_proxy_ports "$APP" "https:443:$(cut -d ':' -f3 <<< "$port_map")"
done
fi
fi
}

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/proxy/functions"
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/ps/functions"
nginx_proxy_disable() {

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/proxy/functions"
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/ps/functions"
nginx_proxy_enable() {