diff --git a/docs/configuration/environment-variables.md b/docs/configuration/environment-variables.md index 77136e82d..7b119b8d1 100644 --- a/docs/configuration/environment-variables.md +++ b/docs/configuration/environment-variables.md @@ -110,8 +110,8 @@ The following list config variables have special meaning and can be set in a var | `DOKKU_DOCKERFILE_ENTRYPOINT` | dockerfile entrypoint | `dokku config:set` | | | `DOKKU_DOCKERFILE_PORTS` | dockerfile ports | `dokku config:set` | | | `DOKKU_DOCKERFILE_START_CMD` | none | `dokku config:set` | | -| `DOKKU_NGINX_PORT` | automatically assigned | `dokku config:set` | | -| `DOKKU_NGINX_SSL_PORT` | automatically assigned | `dokku config:set` | | +| `DOKKU_PROXY_PORT` | automatically assigned | `dokku config:set` | | +| `DOKKU_PROXY_SSL_PORT` | automatically assigned | `dokku config:set` | | | `DOKKU_PROXY_PORT_MAP` | automatically assigned | `dokku proxy:ports-add`
`dokku proxy:ports-remove`, `dokku proxy:ports-clear` | | | `DOKKU_SKIP_ALL_CHECKS` | none | `dokku config:set` | | | `DOKKU_SKIP_CLEANUP` | | `/etc/environment`
`~dokku/.dokkurc`
`~dokku/.dokkurc/*` | When a deploy is triggered, if this is set to a non-empty value, then old docker containers and images will not be removed. | diff --git a/plugins/nginx-vhosts/functions b/plugins/nginx-vhosts/functions index 4391af4e9..f55f68a9c 100755 --- a/plugins/nginx-vhosts/functions +++ b/plugins/nginx-vhosts/functions @@ -96,21 +96,21 @@ configure_nginx_ports() { if [[ -z "$DOKKU_PROXY_PORT" ]] && [[ -z "$RAW_TCP_PORTS" ]]; then if [[ "$IS_APP_VHOST_ENABLED" == "false" ]]; then - dokku_log_info1 "no nginx port set. setting to random open high port" - local NGINX_PORT=$(get_available_port) + dokku_log_info1 "no proxy port set. setting to random open high port" + local PROXY_PORT=$(get_available_port) else - local NGINX_PORT=80 + local PROXY_PORT=80 fi - config_set --no-restart "$APP" DOKKU_PROXY_PORT="$NGINX_PORT" + config_set --no-restart "$APP" DOKKU_PROXY_PORT="$PROXY_PORT" fi if [[ -z "$DOKKU_PROXY_SSL_PORT" ]]; then if (is_ssl_enabled "$APP"); then - local NGINX_SSL_PORT=443 + local PROXY_SSL_PORT=443 if [[ -z "$RAW_TCP_PORTS" ]] && [[ "$IS_APP_VHOST_ENABLED" == "false" ]]; then - dokku_log_info1 "no nginx ssl port set. setting to random open high port" - NGINX_SSL_PORT=$(get_available_port) + dokku_log_info1 "no proxy ssl port set. setting to random open high port" + PROXY_SSL_PORT=$(get_available_port) fi - config_set --no-restart "$APP" DOKKU_PROXY_SSL_PORT="$NGINX_SSL_PORT" + config_set --no-restart "$APP" DOKKU_PROXY_SSL_PORT="$PROXY_SSL_PORT" fi fi if [[ -z "$DOKKU_PROXY_PORT_MAP" ]]; then @@ -120,13 +120,13 @@ configure_nginx_ports() { local PROXY_PORT_MAP+=" http:${RAW_TCP_PORT}:${RAW_TCP_PORT} " done else - local NGINX_PORT=${NGINX_PORT:-$DOKKU_PROXY_PORT} - local NGINX_SSL_PORT=${NGINX_SSL_PORT:-$DOKKU_PROXY_SSL_PORT} + local PROXY_PORT=${PROXY_PORT:-$DOKKU_PROXY_PORT} + local PROXY_SSL_PORT=${PROXY_SSL_PORT:-$DOKKU_PROXY_SSL_PORT} [[ -f "$DOKKU_ROOT/$APP/PORT.web.1" ]] && local UPSTREAM_PORT="$(< "$DOKKU_ROOT/$APP/PORT.web.1")" - if [[ -n "$NGINX_PORT" ]] && [[ -n "$NGINX_SSL_PORT" ]]; then - local PROXY_PORT_MAP+=" http:${NGINX_PORT}:$UPSTREAM_PORT https:${NGINX_SSL_PORT}:$UPSTREAM_PORT " - elif [[ -n "$NGINX_PORT" ]]; then - local PROXY_PORT_MAP+=" http:${NGINX_PORT}:$UPSTREAM_PORT " + if [[ -n "$PROXY_PORT" ]] && [[ -n "$PROXY_SSL_PORT" ]]; then + local PROXY_PORT_MAP+=" http:${PROXY_PORT}:$UPSTREAM_PORT https:${PROXY_SSL_PORT}:$UPSTREAM_PORT " + elif [[ -n "$PROXY_PORT" ]]; then + local PROXY_PORT_MAP+=" http:${PROXY_PORT}:$UPSTREAM_PORT " fi fi if [[ -n "$PROXY_PORT_MAP" ]]; then @@ -236,8 +236,8 @@ nginx_build_config() { # setup nginx listen ports configure_nginx_ports "$APP" - local NGINX_PORT=$(config_get "$APP" DOKKU_PROXY_PORT) - local NGINX_SSL_PORT=$(config_get "$APP" DOKKU_PROXY_SSL_PORT) + local PROXY_PORT=$(config_get "$APP" DOKKU_PROXY_PORT) + local PROXY_SSL_PORT=$(config_get "$APP" DOKKU_PROXY_SSL_PORT) local PROXY_PORT_MAP=$(config_get "$APP" DOKKU_PROXY_PORT_MAP) local PORT_MAP @@ -306,7 +306,7 @@ nginx_build_config() { HTTP2_SUPPORTED="$HTTP2_SUPPORTED" DOKKU_APP_LISTEN_PORT="$DOKKU_APP_LISTEN_PORT" DOKKU_APP_LISTEN_IP="$DOKKU_APP_LISTEN_IP" APP_SSL_PATH="$APP_SSL_PATH" SSL_INUSE="$SSL_INUSE" SSL_SERVER_NAME="$SSL_SERVER_NAME" - NGINX_PORT="$NGINX_PORT" NGINX_SSL_PORT="$NGINX_SSL_PORT" RAW_TCP_PORTS="$RAW_TCP_PORTS" + PROXY_PORT="$PROXY_PORT" PROXY_SSL_PORT="$PROXY_SSL_PORT" RAW_TCP_PORTS="$RAW_TCP_PORTS" PROXY_PORT_MAP="$PROXY_PORT_MAP" PROXY_UPSTREAM_PORTS="$PROXY_UPSTREAM_PORTS") # execute sigil template processing @@ -354,7 +354,7 @@ migrate_nginx_to_proxy() { declare desc="migrates DOKKU_NGINX_* to DOKKI_PROXY_*" for app in $(dokku_apps); do local nginx_port="$(config_get "$app" DOKKU_NGINX_PORT || true)" - local nginx_ssl_port="$(config_get "$app" DOKKU_NGINX_SSL_PORT || true)" + local nginx_ssl_port="$(config_get "$app" DOKKU_NGINX_SSL_PORT || true)" if [[ -n "$nginx_port" ]]; then dokku_log_info1 "Migrating DOKKU_NGINX_PORT to DOKKU_PROXY_PORT for $app" config_set --no-restart "$app" DOKKU_PROXY_PORT="$nginx_port" diff --git a/plugins/nginx-vhosts/post-certs-update b/plugins/nginx-vhosts/post-certs-update index a195aced2..53b23c84f 100755 --- a/plugins/nginx-vhosts/post-certs-update +++ b/plugins/nginx-vhosts/post-certs-update @@ -9,8 +9,8 @@ nginx_post_certs_update() { local trigger="nginx_post_certs_update" local APP="$1" if [[ "$(get_app_proxy_type "$APP")" == "nginx" ]]; then - local DOKKU_NGINX_PORT=$(config_get "$APP" DOKKU_PROXY_PORT) - local DOKKU_NGINX_SSL_PORT=$(config_get "$APP" DOKKU_PROXY_SSL_PORT) + local DOKKU_PROXY_PORT=$(config_get "$APP" DOKKU_PROXY_PORT) + local DOKKU_PROXY_SSL_PORT=$(config_get "$APP" DOKKU_PROXY_SSL_PORT) local DOKKU_PROXY_PORT_MAP=$(config_get "$APP" DOKKU_PROXY_PORT_MAP) if [[ "$DOKKU_PROXY_PORT" == "80" ]]; then diff --git a/plugins/nginx-vhosts/pre-disable-vhost b/plugins/nginx-vhosts/pre-disable-vhost index e36f16a43..0d5d621be 100755 --- a/plugins/nginx-vhosts/pre-disable-vhost +++ b/plugins/nginx-vhosts/pre-disable-vhost @@ -9,7 +9,7 @@ nginx_pre_disable_vhost_trigger() { local trigger="nginx_pre_disable_vhost_trigger" local APP="$1" if [[ "$(get_app_proxy_type "$APP")" == "nginx" ]]; then - config_unset --no-restart "$APP" DOKKU_PROXY_PORT DOKKU_NGINX_SSL_PORT DOKKU_PROXY_PORT_MAP + config_unset --no-restart "$APP" DOKKU_PROXY_PORT DOKKU_PROXY_SSL_PORT DOKKU_PROXY_PORT_MAP fi } diff --git a/tests/unit/test_helper.bash b/tests/unit/test_helper.bash index ed62dfd52..ee94c70dc 100644 --- a/tests/unit/test_helper.bash +++ b/tests/unit/test_helper.bash @@ -277,12 +277,12 @@ server { listen [::]:{{ \$listen_port }}; listen {{ \$listen_port }}; server_name {{ $.NOSSL_SERVER_NAME }} $CUSTOM_TEMPLATE_SSL_DOMAIN; - return 301 https://\$host:{{ $.NGINX_SSL_PORT }}\$request_uri; + return 301 https://\$host:{{ $.PROXY_SSL_PORT }}\$request_uri; } {{ else if eq \$scheme "https"}} server { - listen [::]:{{ $.NGINX_SSL_PORT }} ssl spdy; - listen {{ $.NGINX_SSL_PORT }} ssl spdy; + listen [::]:{{ $.PROXY_SSL_PORT }} ssl spdy; + listen {{ $.PROXY_SSL_PORT }} ssl spdy; {{ if $.SSL_SERVER_NAME }}server_name {{ $.SSL_SERVER_NAME }} $CUSTOM_TEMPLATE_SSL_DOMAIN; {{ end }} {{ if $.NOSSL_SERVER_NAME }}server_name {{ $.NOSSL_SERVER_NAME }} $CUSTOM_TEMPLATE_SSL_DOMAIN; {{ end }} ssl_certificate {{ $.APP_SSL_PATH }}/server.crt;