dokku / dokku-redirect

A plugin for dokku that gives the ability to set simple redirects for an application
MIT License
107 stars 9 forks source link

Getting index out of range: 1 #19

Closed jimhaakman closed 6 years ago

jimhaakman commented 6 years ago

When setting up a redirect I get the following error:

-----> Configuring redirect for www.example.com to via HTTP 301... template: nginx.conf.sigil:4:19: executing "nginx.conf.sigil" at <index $port_map_list...>: error calling index: index out of range: 1

Dokku version: 0.11.3 dokku-redirect version: 0.5.0

How can I fix this?

josegonzalez commented 6 years ago

Can you run that with dokku trace on and show the output?

jimhaakman commented 6 years ago
++ [[ ! example =~ ^[a-z].* ]]
++ return 0
++ [[ ! -d /home/dokku/example ]]
++ return 0
++ local APP_PROXY_ENABLED=true
+++ config_get example DOKKU_DISABLE_PROXY
+++ declare 'desc=get value of given config var'
+++ config_sub get example DOKKU_DISABLE_PROXY
+++ declare 'desc=executes a config subcommand'
+++ local name=get
+++ shift
+++ /var/lib/dokku/plugins/available/config/subcommands/get config:get example DOKKU_DISABLE_PROXY
++ local DOKKU_DISABLE_PROXY=
++ [[ -n '' ]]
++ echo true
+ [[ true == \t\r\u\e ]]
+ [[ -z '' ]]
+ [[ -z '' ]]
++ xargs
++ plugn trigger network-get-listeners example
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ [[ ! -n '' ]]
+ DOKKU_APP_LISTENERS=172.17.0.10:5000
+ configure_nginx_ports example
+ declare 'desc=configure nginx listening ports'
+ local APP=example
+ verify_app_name example
+ declare 'desc=verify app name format and app existence'
+ local APP=example
+ is_valid_app_name example
+ declare 'desc=verify app name format'
+ local APP=example
+ [[ ! -n example ]]
+ [[ ! example =~ ^[a-z].* ]]
+ return 0
+ [[ ! -d /home/dokku/example ]]
+ return 0
++ get_app_raw_tcp_ports example
++ declare 'desc=extracts raw tcp port numbers from DOCKERFILE_PORTS config variable'
++ source /var/lib/dokku/plugins/available/config/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+++ source /var/lib/dokku/core-plugins/available/common/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
++ local APP=example
++ verify_app_name example
++ declare 'desc=verify app name format and app existence'
++ local APP=example
++ is_valid_app_name example
++ declare 'desc=verify app name format'
++ local APP=example
++ [[ ! -n example ]]
++ [[ ! example =~ ^[a-z].* ]]
++ return 0
++ [[ ! -d /home/dokku/example ]]
++ return 0
+++ config_get example DOKKU_DOCKERFILE_PORTS
+++ declare 'desc=get value of given config var'
+++ config_sub get example DOKKU_DOCKERFILE_PORTS
+++ declare 'desc=executes a config subcommand'
+++ local name=get
+++ shift
+++ /var/lib/dokku/plugins/available/config/subcommands/get config:get example DOKKU_DOCKERFILE_PORTS
++ local DOCKERFILE_PORTS=
+++ echo ''
+++ xargs
++ local raw_tcp_ports=
++ echo ''
+ local RAW_TCP_PORTS=
++ config_get example DOKKU_NGINX_PORT
++ declare 'desc=get value of given config var'
++ config_sub get example DOKKU_NGINX_PORT
++ declare 'desc=executes a config subcommand'
++ local name=get
++ shift
++ /var/lib/dokku/plugins/available/config/subcommands/get config:get example DOKKU_NGINX_PORT
+ local DOKKU_NGINX_PORT=80
++ config_get example DOKKU_NGINX_SSL_PORT
++ declare 'desc=get value of given config var'
++ config_sub get example DOKKU_NGINX_SSL_PORT
++ declare 'desc=executes a config subcommand'
++ local name=get
++ shift
++ /var/lib/dokku/plugins/available/config/subcommands/get config:get example DOKKU_NGINX_SSL_PORT
+ local DOKKU_NGINX_SSL_PORT=443
++ config_get example DOKKU_PROXY_PORT_MAP
++ declare 'desc=get value of given config var'
++ config_sub get example DOKKU_PROXY_PORT_MAP
++ declare 'desc=executes a config subcommand'
++ local name=get
++ shift
++ /var/lib/dokku/plugins/available/config/subcommands/get config:get example DOKKU_PROXY_PORT_MAP
+ local 'DOKKU_PROXY_PORT_MAP=http:80:5000 https:443:5000'
++ is_app_vhost_enabled example
++ declare 'desc=returns true or false if vhost support is enabled for a given application'
++ source /var/lib/dokku/plugins/available/config/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+++ source /var/lib/dokku/core-plugins/available/common/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
++ local APP=example
++ verify_app_name example
++ declare 'desc=verify app name format and app existence'
++ local APP=example
++ is_valid_app_name example
++ declare 'desc=verify app name format'
++ local APP=example
++ [[ ! -n example ]]
++ [[ ! example =~ ^[a-z].* ]]
++ return 0
++ [[ ! -d /home/dokku/example ]]
++ return 0
+++ config_get example NO_VHOST
+++ declare 'desc=get value of given config var'
+++ config_sub get example NO_VHOST
+++ declare 'desc=executes a config subcommand'
+++ local name=get
+++ shift
+++ /var/lib/dokku/plugins/available/config/subcommands/get config:get example NO_VHOST
++ local NO_VHOST=
++ local APP_VHOST_ENABLED=true
++ [[ '' == \1 ]]
++ echo true
+ local IS_APP_VHOST_ENABLED=true
+ local UPSTREAM_PORT=5000
+ [[ -z 80 ]]
+ [[ -z 443 ]]
+ [[ -z http:80:5000 https:443:5000 ]]
++ config_get example DOKKU_NGINX_PORT
++ declare 'desc=get value of given config var'
++ config_sub get example DOKKU_NGINX_PORT
++ declare 'desc=executes a config subcommand'
++ local name=get
++ shift
++ /var/lib/dokku/plugins/available/config/subcommands/get config:get example DOKKU_NGINX_PORT
+ local NGINX_PORT=80
++ config_get example DOKKU_NGINX_SSL_PORT
++ declare 'desc=get value of given config var'
++ config_sub get example DOKKU_NGINX_SSL_PORT
++ declare 'desc=executes a config subcommand'
++ local name=get
++ shift
++ /var/lib/dokku/plugins/available/config/subcommands/get config:get example DOKKU_NGINX_SSL_PORT
+ local NGINX_SSL_PORT=443
++ config_get example DOKKU_PROXY_PORT_MAP
++ declare 'desc=get value of given config var'
++ config_sub get example DOKKU_PROXY_PORT_MAP
++ declare 'desc=executes a config subcommand'
++ local name=get
++ shift
++ /var/lib/dokku/plugins/available/config/subcommands/get config:get example DOKKU_PROXY_PORT_MAP
+ local 'PROXY_PORT_MAP=http:80:5000 https:443:5000'
+ local PORT_MAP
+ for PORT_MAP in '$PROXY_PORT_MAP'
++ awk -F : '{ print $3 }'
+ local PROXY_UPSTREAM_PORT=5000
++ is_val_in_list 5000 '' ' '
++ declare 'desc=return true if value (5000) is in list () separated by delimiter ( ); delimiter defaults to comma'
++ local value=5000 list= 'delimiter= '
++ local 'IFS= ' val_in_list=false
++ echo false
+ [[ false == \f\a\l\s\e ]]
+ local 'PROXY_UPSTREAM_PORTS+=5000 '
+ for PORT_MAP in '$PROXY_PORT_MAP'
++ awk -F : '{ print $3 }'
+ local PROXY_UPSTREAM_PORT=5000
++ is_val_in_list 5000 '5000 ' ' '
++ declare 'desc=return true if value (5000) is in list (5000 ) separated by delimiter ( ); delimiter defaults to comma'
++ local value=5000 'list=5000 ' 'delimiter= '
++ local 'IFS= ' val_in_list=false
++ for val in '$list'
++ [[ 5000 == \5\0\0\0 ]]
++ val_in_list=true
++ echo true
+ [[ true == \f\a\l\s\e ]]
++ echo '5000 '
++ xargs
+ local PROXY_UPSTREAM_PORTS=5000
++ mktemp -d /tmp/dokku_nginx_template.XXXXX
+ local NGINX_BUILD_CONFIG_TMP_WORK_DIR=/tmp/dokku_nginx_template.9F2Vk
++ mktemp --tmpdir=/tmp/dokku_nginx_template.9F2Vk nginx.conf.XXXXXX
+ local NGINX_CONF=/tmp/dokku_nginx_template.9F2Vk/nginx.conf.tKUghX
+ local CUSTOM_NGINX_TEMPLATE=/tmp/dokku_nginx_template.9F2Vk/nginx.conf.sigil
+ trap 'rm -rf $NGINX_CONF $NGINX_BUILD_CONFIG_TMP_WORK_DIR > /dev/null' RETURN INT TERM EXIT
+ get_custom_nginx_template example /tmp/dokku_nginx_template.9F2Vk/nginx.conf.sigil
+ declare 'desc=attempts to copy custom nginx template from app image'
+ local APP=example
+ verify_app_name example
+ declare 'desc=verify app name format and app existence'
+ local APP=example
+ is_valid_app_name example
+ declare 'desc=verify app name format'
+ local APP=example
+ [[ ! -n example ]]
+ [[ ! example =~ ^[a-z].* ]]
+ return 0
+ [[ ! -d /home/dokku/example ]]
+ return 0
+ local DESTINATION=/tmp/dokku_nginx_template.9F2Vk/nginx.conf.sigil
++ get_running_image_tag example
++ declare 'desc=retrieve current image tag for a given app. returns empty string if no deployed containers are found'
++ local APP=example
++ verify_app_name example
++ declare 'desc=verify app name format and app existence'
++ local APP=example
++ is_valid_app_name example
++ declare 'desc=verify app name format'
++ local APP=example
++ [[ ! -n example ]]
++ [[ ! example =~ ^[a-z].* ]]
++ return 0
++ [[ ! -d /home/dokku/example ]]
++ return 0
++ CIDS=($(get_app_container_ids "$APP"))
+++ get_app_container_ids example
+++ declare 'desc=returns list of docker container ids for given app and optional container_type'
+++ local APP=example
+++ local CONTAINER_TYPE=
+++ verify_app_name example
+++ declare 'desc=verify app name format and app existence'
+++ local APP=example
+++ is_valid_app_name example
+++ declare 'desc=verify app name format'
+++ local APP=example
+++ [[ ! -n example ]]
+++ [[ ! example =~ ^[a-z].* ]]
+++ return 0
+++ [[ ! -d /home/dokku/example ]]
+++ return 0
+++ [[ -f /home/dokku/example/CONTAINER ]]
+++ [[ -n '' ]]
+++ local 'CONTAINER_PATTERN=/home/dokku/example/CONTAINER.*'
+++ shopt -s nullglob
+++ local DOKKU_CID_FILE
+++ for DOKKU_CID_FILE in '$CONTAINER_PATTERN'
+++ local 'DOKKU_CIDS+= '
+++ local DOKKU_CIDS+=92a28b42a04c002faf40f8d72750a53c8962d849129ba92d79bf928347e38f0b
+++ local 'DOKKU_CIDS+= '
+++ shopt -u nullglob
+++ echo ' 92a28b42a04c002faf40f8d72750a53c8962d849129ba92d79bf928347e38f0b '
++ local CIDS
+++ docker inspect -f '{{ .Config.Image }}' 92a28b42a04c002faf40f8d72750a53c8962d849129ba92d79bf928347e38f0b
+++ awk -F: '{ print $2 }'
++ local RUNNING_IMAGE_TAG=latest
++ echo latest
+ local IMAGE_TAG=latest
++ get_deploying_app_image_name example latest
++ declare 'desc=return deploying image identifier for a given app, tag tuple. validate if tag is presented'
++ local APP=example
++ local IMAGE_TAG=latest
++ IMAGE_REPO=
++ is_valid_app_name example
++ declare 'desc=verify app name format'
++ local APP=example
++ [[ ! -n example ]]
++ [[ ! example =~ ^[a-z].* ]]
++ return 0
+++ plugn trigger deployed-app-repository example
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ [[ ! -n '' ]]
++ local IMAGE_REMOTE_REPOSITORY=
+++ plugn trigger deployed-app-image-tag example
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ [[ ! -n '' ]]
++ local NEW_IMAGE_TAG=
+++ plugn trigger deployed-app-image-repo example
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ [[ ! -n '' ]]
++ local NEW_IMAGE_REPO=
++ [[ -n '' ]]
++ [[ -n '' ]]
++ [[ -z '' ]]
+++ get_app_image_repo example
+++ declare 'desc=central definition of image repo pattern'
+++ local APP=example
+++ local IMAGE_REPO=dokku/example
+++ is_valid_app_name example
+++ declare 'desc=verify app name format'
+++ local APP=example
+++ [[ ! -n example ]]
+++ [[ ! example =~ ^[a-z].* ]]
+++ return 0
+++ echo dokku/example
++ IMAGE_REPO=dokku/example
++ [[ -z latest ]]
++ local IMAGE=dokku/example:latest
++ verify_image dokku/example:latest
++ declare 'desc=verify image existence'
++ local IMAGE=dokku/example:latest
++ docker inspect dokku/example:latest
++ return 0
++ echo dokku/example:latest
+ local IMAGE=dokku/example:latest
+ local NGINX_TEMPLATE_NAME=nginx.conf.sigil
+ copy_from_image dokku/example:latest nginx.conf.sigil /tmp/dokku_nginx_template.9F2Vk/nginx.conf.sigil
+ [[ -f /tmp/dokku_nginx_template.9F2Vk/nginx.conf.sigil ]]
++ get_app_domains example
++ declare 'desc=return app domains'
++ verify_app_name example
++ declare 'desc=verify app name format and app existence'
++ local APP=example
++ is_valid_app_name example
++ declare 'desc=verify app name format'
++ local APP=example
++ [[ ! -n example ]]
++ [[ ! example =~ ^[a-z].* ]]
++ return 0
++ [[ ! -d /home/dokku/example ]]
++ return 0
++ local APP=example
++ local APP_VHOST_FILE=/home/dokku/example/VHOST
++ local GLOBAL_VHOST_PATH=/home/dokku/VHOST
++ local GLOBAL_HOSTNAME_PATH=/home/dokku/HOSTNAME
+++ is_app_vhost_enabled example
+++ declare 'desc=returns true or false if vhost support is enabled for a given application'
+++ source /var/lib/dokku/plugins/available/config/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
++++ source /var/lib/dokku/core-plugins/available/common/functions
+++++ set -eo pipefail
+++++ [[ -n 1 ]]
+++++ set -x
+++ local APP=example
+++ verify_app_name example
+++ declare 'desc=verify app name format and app existence'
+++ local APP=example
+++ is_valid_app_name example
+++ declare 'desc=verify app name format'
+++ local APP=example
+++ [[ ! -n example ]]
+++ [[ ! example =~ ^[a-z].* ]]
+++ return 0
+++ [[ ! -d /home/dokku/example ]]
+++ return 0
++++ config_get example NO_VHOST
++++ declare 'desc=get value of given config var'
++++ config_sub get example NO_VHOST
++++ declare 'desc=executes a config subcommand'
++++ local name=get
++++ shift
++++ /var/lib/dokku/plugins/available/config/subcommands/get config:get example NO_VHOST
+++ local NO_VHOST=
+++ local APP_VHOST_ENABLED=true
+++ [[ '' == \1 ]]
+++ echo true
++ [[ true == \t\r\u\e ]]
++ [[ -f /home/dokku/example/VHOST ]]
++ cat /home/dokku/example/VHOST
+ local 'NONSSL_VHOSTS=example.com
example.dokku-server.com'
++ xargs
++ echo 'example.com
example.dokku-server.com'
+ local 'NOSSL_SERVER_NAME=example.com example.dokku-server.com'
+ is_ssl_enabled example
+ declare 'desc=returns 0 if ssl is enabled for given app'
+ local APP=example
+ verify_app_name example
+ declare 'desc=verify app name format and app existence'
+ local APP=example
+ is_valid_app_name example
+ declare 'desc=verify app name format'
+ local APP=example
+ [[ ! -n example ]]
+ [[ ! example =~ ^[a-z].* ]]
+ return 0
+ [[ ! -d /home/dokku/example ]]
+ return 0
+ local APP_SSL_PATH=/home/dokku/example/tls
+ [[ -e /home/dokku/example/tls/server.crt ]]
+ [[ -e /home/dokku/example/tls/server.key ]]
+ return 0
+ local SSL_INUSE=true
+ local SCHEME=https
+ validate_ssl_domains example
+ declare 'desc=check configured domains against SSL cert contents and show warning if mismatched'
+ local APP=example
+ verify_app_name example
+ declare 'desc=verify app name format and app existence'
+ local APP=example
+ is_valid_app_name example
+ declare 'desc=verify app name format'
+ local APP=example
+ [[ ! -n example ]]
+ [[ ! example =~ ^[a-z].* ]]
+ return 0
+ [[ ! -d /home/dokku/example ]]
+ return 0
++ get_ssl_hostnames example
++ declare 'desc=returns a string of ssl hostnames extracted from an app'\''s ssl certificate'
++ local APP=example
++ verify_app_name example
++ declare 'desc=verify app name format and app existence'
++ local APP=example
++ is_valid_app_name example
++ declare 'desc=verify app name format'
++ local APP=example
++ [[ ! -n example ]]
++ [[ ! example =~ ^[a-z].* ]]
++ return 0
++ [[ ! -d /home/dokku/example ]]
++ return 0
++ local SSL_PATH=/home/dokku/example/tls
+++ cut -c4-
+++ openssl x509 -in /home/dokku/example/tls/server.crt -noout -subject
+++ grep CN=
+++ tr / '\n'
++ local SSL_HOSTNAME=example.com
+++ tr , '\n'
+++ sed -e 's/[[:space:]]*DNS://g'
+++ tail -n 1
+++ grep --after-context=1 '509v3 Subject Alternative Name:'
+++ openssl x509 -in /home/dokku/example/tls/server.crt -noout -text
++ local 'SSL_HOSTNAME_ALT=example.com
example.dokku-server.com
www.example.com'
++ [[ -n example.com
example.dokku-server.com
www.example.com ]]
++ local 'SSL_HOSTNAMES=example.com\nexample.com
example.dokku-server.com
www.example.com'
++ echo -e 'example.com\nexample.com
example.dokku-server.com
www.example.com'
++ sort -u
++ return 0
+ local 'SSL_HOSTNAME=example.com
example.dokku-server.com
www.example.com'
++ echo 'example.com
example.dokku-server.com
www.example.com'
++ sed 's/ /|/g'
++ sed 's/\*/\[^\.\]\*/g'
++ sed 's|\.|\\.|g'
++ xargs
+ local 'SSL_HOSTNAME_REGEX=example\.com|example\.dokku-server\.com|www\.example\.com'
+ egrep -q '^example\.com|example\.dokku-server\.com|www\.example\.com$' /home/dokku/example/VHOST
++ get_ssl_hostnames example
++ declare 'desc=returns a string of ssl hostnames extracted from an app'\''s ssl certificate'
++ local APP=example
++ verify_app_name example
++ declare 'desc=verify app name format and app existence'
++ local APP=example
++ is_valid_app_name example
++ declare 'desc=verify app name format'
++ local APP=example
++ [[ ! -n example ]]
++ [[ ! example =~ ^[a-z].* ]]
++ return 0
++ [[ ! -d /home/dokku/example ]]
++ return 0
++ local SSL_PATH=/home/dokku/example/tls
+++ cut -c4-
+++ openssl x509 -in /home/dokku/example/tls/server.crt -noout -subject
+++ grep CN=
+++ tr / '\n'
++ local SSL_HOSTNAME=example.com
+++ grep --after-context=1 '509v3 Subject Alternative Name:'
+++ sed -e 's/[[:space:]]*DNS://g'
+++ tr , '\n'
+++ tail -n 1
+++ openssl x509 -in /home/dokku/example/tls/server.crt -noout -text
++ local 'SSL_HOSTNAME_ALT=example.com
example.dokku-server.com
www.example.com'
++ [[ -n example.com
example.dokku-server.com
www.example.com ]]
++ local 'SSL_HOSTNAMES=example.com\nexample.com
example.dokku-server.com
www.example.com'
++ echo -e 'example.com\nexample.com
example.dokku-server.com
www.example.com'
++ sort -u
++ return 0
+ local 'SSL_HOSTNAME=example.com
example.dokku-server.com
www.example.com'
++ echo 'example.com
example.dokku-server.com
www.example.com'
++ xargs
++ sed 's/ /|/g'
++ sed 's/\*/\[^\.\]\*/g'
++ sed 's|\.|\\.|g'
+ local 'SSL_HOSTNAME_REGEX=example\.com|example\.dokku-server\.com|www\.example\.com'
+ [[ true == \t\r\u\e ]]
++ egrep '^example\.com|example\.dokku-server\.com|www\.example\.com$' /home/dokku/example/VHOST
+ local 'SSL_VHOSTS=example.com
example.dokku-server.com'
+ local SSL_SERVER_NAME
+ local host
+ for host in '$SSL_VHOSTS'
+ [[ ! example.com example.dokku-server.com =~ (^|[[:space:]])example.com($|[[:space:]]) ]]
+ for host in '$SSL_VHOSTS'
+ [[ ! example.com example.dokku-server.com =~ (^|[[:space:]])example.dokku-server.com($|[[:space:]]) ]]
+ local NGINX_LOCATION NGINX_VERSION SPDY_SUPPORTED HTTP2_SUPPORTED
++ get_nginx_location
++ declare 'desc=check that nginx is at the expected location and return it'
++ local NGINX_LOCATION
+++ which nginx
++ NGINX_LOCATION=/usr/sbin/nginx
++ [[ -z /usr/sbin/nginx ]]
++ [[ ! -x /usr/sbin/nginx ]]
++ echo /usr/sbin/nginx
+ NGINX_LOCATION=/usr/sbin/nginx
+ [[ -z /usr/sbin/nginx ]]
++ /usr/sbin/nginx -v
++ cut -d/ -f 2
+ NGINX_VERSION='1.10.3 (Ubuntu)'
++ is_spdy_enabled '1.10.3 (Ubuntu)'
++ declare 'desc=detects whether the installed nginx version has spdy support'
++ local 'NGINX_VERSION=1.10.3 (Ubuntu)'
++ local MAJOR_VERSION MINOR_VERSION PATCH_VERSION
++ local HAS_SUPPORT=true
+++ awk '{split($0,a,"."); print a[1]}'
+++ echo '1.10.3 (Ubuntu)'
++ MAJOR_VERSION=1
+++ awk '{split($0,a,"."); print a[2]}'
+++ echo '1.10.3 (Ubuntu)'
++ MINOR_VERSION=10
+++ echo '1.10.3 (Ubuntu)'
+++ awk '{split($0,a,"."); print a[3]}'
++ PATCH_VERSION='3 (Ubuntu)'
++ [[ 1 -ge 2 ]]
++ [[ 1 -eq 1 ]]
++ [[ 10 -ge 10 ]]
++ HAS_SUPPORT=false
++ echo false
+ SPDY_SUPPORTED=false
++ is_http2_enabled '1.10.3 (Ubuntu)'
++ declare 'desc=detects whether the installed nginx version has http2 support'
++ local 'NGINX_VERSION=1.10.3 (Ubuntu)'
++ local MAJOR_VERSION MINOR_VERSION PATCH_VERSION
++ local HAS_SUPPORT=false
+++ awk '{split($0,a,"."); print a[1]}'
+++ echo '1.10.3 (Ubuntu)'
++ MAJOR_VERSION=1
+++ echo '1.10.3 (Ubuntu)'
+++ awk '{split($0,a,"."); print a[2]}'
++ MINOR_VERSION=10
+++ echo '1.10.3 (Ubuntu)'
+++ awk '{split($0,a,"."); print a[3]}'
++ PATCH_VERSION='3 (Ubuntu)'
++ [[ 1 -ge 2 ]]
++ [[ 1 -eq 1 ]]
++ [[ 10 -eq 11 ]]
++ [[ 10 -ge 12 ]]
++ echo false
+ HTTP2_SUPPORTED=false
++ xargs
++ echo 'http:80:5000 https:443:5000'
+ PROXY_PORT_MAP='http:80:5000 https:443:5000'
++ config_export app example
++ declare 'desc=returns export command for config variable of specified type (app/global)'
++ local CONFIG_TYPE=app
++ shift
++ local APP=example
++ [[ app == \g\l\o\b\a\l ]]
++ shift
++ config_sub export example
++ declare 'desc=executes a config subcommand'
++ local name=export
++ shift
++ /var/lib/dokku/plugins/available/config/subcommands/export config:export example
++ return 0
+ eval 'export DOKKU_APP_RESTORE='\''1'\''
export DOKKU_APP_TYPE='\''herokuish'\''
export DOKKU_LETSENCRYPT_EMAIL='\''email@example.com'\''
export DOKKU_NGINX_PORT='\''80'\''
export DOKKU_NGINX_SSL_PORT='\''443'\''
export DOKKU_PROXY_PORT_MAP='\''http:80:5000 https:443:5000'\'''
++ export DOKKU_APP_RESTORE=1
++ DOKKU_APP_RESTORE=1
++ export DOKKU_APP_TYPE=herokuish
++ DOKKU_APP_TYPE=herokuish
++ export DOKKU_LETSENCRYPT_EMAIL=email@example.com
++ DOKKU_LETSENCRYPT_EMAIL=email@example.com
++ export DOKKU_NGINX_PORT=80
++ DOKKU_NGINX_PORT=80
++ export DOKKU_NGINX_SSL_PORT=443
++ DOKKU_NGINX_SSL_PORT=443
++ export 'DOKKU_PROXY_PORT_MAP=http:80:5000 https:443:5000'
++ DOKKU_PROXY_PORT_MAP='http:80:5000 https:443:5000'
+ SIGIL_PARAMS=(-f $NGINX_TEMPLATE APP="$APP" DOKKU_ROOT="$DOKKU_ROOT" NOSSL_SERVER_NAME="$NOSSL_SERVER_NAME" DOKKU_APP_LISTENERS="$DOKKU_APP_LISTENERS" DOKKU_LIB_ROOT="$DOKKU_LIB_ROOT" PASSED_LISTEN_IP_PORT="$PASSED_LISTEN_IP_PORT" SPDY_SUPPORTED="$SPDY_SUPPORTED" 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_MAP="$PROXY_PORT_MAP" PROXY_UPSTREAM_PORTS="$PROXY_UPSTREAM_PORTS")
+ local SIGIL_PARAMS
+ xargs -i echo '-----> Configuring {}...(using built-in template)'
++ echo 'example.com
example.dokku-server.com' 'example.com
example.dokku-server.com'
++ sort -u
++ tr ' ' '\n'
-----> Configuring example.com...(using built-in template)
-----> Configuring example.dokku-server.com...(using built-in template)
+ cat -s
+ sigil -f /var/lib/dokku/plugins/available/nginx-vhosts/templates/nginx.conf.sigil APP=example DOKKU_ROOT=/home/dokku 'NOSSL_SERVER_NAME=example.com example.dokku-server.com' DOKKU_APP_LISTENERS=172.17.0.10:5000 DOKKU_LIB_ROOT=/var/lib/dokku PASSED_LISTEN_IP_PORT= SPDY_SUPPORTED=false HTTP2_SUPPORTED=false DOKKU_APP_LISTEN_PORT= DOKKU_APP_LISTEN_IP= APP_SSL_PATH=/home/dokku/example/tls SSL_INUSE=true SSL_SERVER_NAME= NGINX_PORT=80 NGINX_SSL_PORT=443 RAW_TCP_PORTS= 'PROXY_PORT_MAP=http:80:5000 https:443:5000' PROXY_UPSTREAM_PORTS=5000
+ is_deployed example
+ declare 'desc=return 0 if given app has a running container'
+ local APP=example
+ [[ -f /home/dokku/example/CONTAINER ]]
++ ls /home/dokku/example/CONTAINER.web.1
++ echo 0
+ [[ 0 -eq 0 ]]
+ return 0
+ dokku_log_info1 'Creating https nginx.conf'
+ declare 'desc=log info1 formatter'
+ echo '-----> Creating https nginx.conf'
-----> Creating https nginx.conf
+ mv /tmp/dokku_nginx_template.9F2Vk/nginx.conf.tKUghX /home/dokku/example/nginx.conf
+ is_deployed example
+ declare 'desc=return 0 if given app has a running container'
+ local APP=example
+ [[ -f /home/dokku/example/CONTAINER ]]
++ ls /home/dokku/example/CONTAINER.web.1
++ echo 0
+ [[ 0 -eq 0 ]]
+ return 0
+ dokku_log_info1 'Running nginx-pre-reload'
+ declare 'desc=log info1 formatter'
+ echo '-----> Running nginx-pre-reload'
-----> Running nginx-pre-reload
+ plugn trigger nginx-pre-reload example '' ''
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ [[ ! -n '' ]]
+ source /var/lib/dokku/plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ source /var/lib/dokku/plugins/available/certs/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
++ source /var/lib/dokku/core-plugins/available/common/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+ source /var/lib/dokku/plugins/available/config/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
++ source /var/lib/dokku/core-plugins/available/common/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+ source /var/lib/dokku/plugins/available/proxy/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
++ source /var/lib/dokku/core-plugins/available/common/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
++ source /var/lib/dokku/plugins/available/config/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+++ source /var/lib/dokku/core-plugins/available/common/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
+ source /var/lib/dokku/plugins/available/nginx-vhosts/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
++ source /var/lib/dokku/core-plugins/available/common/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
++ source /var/lib/dokku/plugins/available/certs/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+++ source /var/lib/dokku/core-plugins/available/common/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
++ source /var/lib/dokku/plugins/available/config/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+++ source /var/lib/dokku/core-plugins/available/common/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
++ source /var/lib/dokku/plugins/available/domains/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+++ source /var/lib/dokku/core-plugins/available/common/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
++ source /var/lib/dokku/plugins/available/proxy/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+++ source /var/lib/dokku/core-plugins/available/common/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
+++ source /var/lib/dokku/plugins/available/config/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
++++ source /var/lib/dokku/core-plugins/available/common/functions
+++++ set -eo pipefail
+++++ [[ -n 1 ]]
+++++ set -x
++ source /var/lib/dokku/plugins/available/ps/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+++ source /var/lib/dokku/core-plugins/available/common/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
+++ source /var/lib/dokku/plugins/available/config/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
++++ source /var/lib/dokku/core-plugins/available/common/functions
+++++ set -eo pipefail
+++++ [[ -n 1 ]]
+++++ set -x
+ redirect_nginx_pre_load_trigger example '' ''
+ declare 'desc=add nginx redirect servers'
+ local trigger=redirect_nginx_pre_load_trigger
+ local APP=example
+ local APP_ROOT=/home/dokku/example
+ local REDIRECT_FILE=/home/dokku/example/REDIRECTS
+ [[ ! -s /home/dokku/example/REDIRECTS ]]
++ get_app_proxy_type example
++ declare 'desc=return app proxy type'
++ local APP=example
++ verify_app_name example
++ declare 'desc=verify app name format and app existence'
++ local APP=example
++ is_valid_app_name example
++ declare 'desc=verify app name format'
++ local APP=example
++ [[ ! -n example ]]
++ [[ ! example =~ ^[a-z].* ]]
++ return 0
++ [[ ! -d /home/dokku/example ]]
++ return 0
+++ config_get example DOKKU_APP_PROXY_TYPE
+++ declare 'desc=get value of given config var'
+++ config_sub get example DOKKU_APP_PROXY_TYPE
+++ declare 'desc=executes a config subcommand'
+++ local name=get
+++ shift
+++ /var/lib/dokku/plugins/available/config/subcommands/get config:get example DOKKU_APP_PROXY_TYPE
+++ true
++ local DOKKU_APP_PROXY_TYPE=
++ local APP_PROXY_TYPE=nginx
++ echo nginx
+ [[ nginx == \n\g\i\n\x ]]
+ local NGINX_CONF=/home/dokku/example/nginx.conf
++ dirname /var/lib/dokku/plugins/enabled/redirect/nginx-pre-reload
+ local NGINX_TEMPLATE=/var/lib/dokku/plugins/enabled/redirect/templates/nginx.conf.sigil
++ config_get example DOKKU_PROXY_PORT_MAP
++ declare 'desc=get value of given config var'
++ config_sub get example DOKKU_PROXY_PORT_MAP
++ declare 'desc=executes a config subcommand'
++ local name=get
++ shift
++ /var/lib/dokku/plugins/available/config/subcommands/get config:get example DOKKU_PROXY_PORT_MAP
+ local 'PROXY_PORT_MAP=http:80:5000 https:443:5000'
++ nginx -v
++ cut -d/ -f 2
+ local 'NGINX_VERSION=1.10.3 (Ubuntu)'
++ is_spdy_enabled '1.10.3 (Ubuntu)'
++ declare 'desc=detects whether the installed nginx version has spdy support'
++ local 'NGINX_VERSION=1.10.3 (Ubuntu)'
++ local MAJOR_VERSION MINOR_VERSION PATCH_VERSION
++ local HAS_SUPPORT=true
+++ echo '1.10.3 (Ubuntu)'
+++ awk '{split($0,a,"."); print a[1]}'
++ MAJOR_VERSION=1
+++ echo '1.10.3 (Ubuntu)'
+++ awk '{split($0,a,"."); print a[2]}'
++ MINOR_VERSION=10
+++ echo '1.10.3 (Ubuntu)'
+++ awk '{split($0,a,"."); print a[3]}'
++ PATCH_VERSION='3 (Ubuntu)'
++ [[ 1 -ge 2 ]]
++ [[ 1 -eq 1 ]]
++ [[ 10 -ge 10 ]]
++ HAS_SUPPORT=false
++ echo false
+ local SPDY_SUPPORTED=false
+ is_ssl_enabled example
+ declare 'desc=returns 0 if ssl is enabled for given app'
+ local APP=example
+ verify_app_name example
+ declare 'desc=verify app name format and app existence'
+ local APP=example
+ is_valid_app_name example
+ declare 'desc=verify app name format'
+ local APP=example
+ [[ ! -n example ]]
+ [[ ! example =~ ^[a-z].* ]]
+ return 0
+ [[ ! -d /home/dokku/example ]]
+ return 0
+ local APP_SSL_PATH=/home/dokku/example/tls
+ [[ -e /home/dokku/example/tls/server.crt ]]
+ [[ -e /home/dokku/example/tls/server.key ]]
+ return 0
+ local APP_SSL_PATH=/home/dokku/example/tls
++ mktemp
+ local NGINX_CONF_PREPEND=/tmp/tmp.rDGYnXaY5t
+ trap 'rm -f "/tmp/tmp.rDGYnXaY5t"' EXIT
+ read -r line
+ [[ -z www.example.com:example.com:301 ]]
++ echo www.example.com:example.com:301
++ awk -F : '{ print $1 }'
+ local DOMAIN=www.example.com
++ echo www.example.com:example.com:301
++ awk -F : '{ print $2 }'
+ local DEST_DOMAIN=example.com
++ echo www.example.com:example.com:301
++ awk -F : '{ print $3 ? $3 : "301" }'
+ local REDIR_CODE=301
+ dokku_log_info1 'Configuring redirect for www.example.com to  via HTTP 301...'
+ declare 'desc=log info1 formatter'
+ echo '-----> Configuring redirect for www.example.com to  via HTTP 301...'
-----> Configuring redirect for www.example.com to  via HTTP 301...
+ SIGIL_PARAMS=(-f $NGINX_TEMPLATE APP="$APP" DOKKU_ROOT="$DOKKU_ROOT" SPDY_SUPPORTED="$SPDY_SUPPORTED" APP_SSL_PATH="$APP_SSL_PATH" DOMAIN="$DOMAIN" DEST_DOMAIN="$DEST_DOMAIN" REDIR_CODE="$REDIR_CODE" PROXY_PORT_MAP="$PROXY_PORT_MAP")
+ local SIGIL_PARAMS
+ cat -s
+ sigil -f /var/lib/dokku/plugins/enabled/redirect/templates/nginx.conf.sigil APP=example DOKKU_ROOT=/home/dokku SPDY_SUPPORTED=false APP_SSL_PATH=/home/dokku/example/tls DOMAIN=www.example.com DEST_DOMAIN=example.com REDIR_CODE=301 'PROXY_PORT_MAP=http:80:5000 https:443:5000'
+ read -r line
+ [[ -s /tmp/tmp.rDGYnXaY5t ]]
+ cat /home/dokku/example/nginx.conf
+ cat /tmp/tmp.rDGYnXaY5t
+ rm -f /tmp/tmp.rDGYnXaY5t
+ dokku_log_verbose 'Reloading nginx'
+ declare 'desc=log verbose formatter'
+ echo '       Reloading nginx'
       Reloading nginx
+ validate_nginx
+ declare 'desc=validate entire nginx config'
+ local NGINX_LOCATION
++ get_nginx_location
++ declare 'desc=check that nginx is at the expected location and return it'
++ local NGINX_LOCATION
+++ which nginx
++ NGINX_LOCATION=/usr/sbin/nginx
++ [[ -z /usr/sbin/nginx ]]
++ [[ ! -x /usr/sbin/nginx ]]
++ echo /usr/sbin/nginx
+ NGINX_LOCATION=/usr/sbin/nginx
+ [[ -z /usr/sbin/nginx ]]
+ set +e
+ sudo /usr/sbin/nginx -t
+ local exit_code=0
+ set -e
+ [[ 0 -ne 0 ]]
+ restart_nginx
+ declare 'desc=restart nginx for given distros'
+ case "$DOKKU_DISTRO" in
+ sudo /etc/init.d/nginx reload
+ [[ -n example.com
example.dokku-server.com ]]
+ [[ true == \t\r\u\e ]]
+ echo '# THIS FILE IS GENERATED BY DOKKU - DO NOT EDIT, YOUR CHANGES WILL BE OVERWRITTEN'
+ xargs -i echo 'https://{}'
++ sort -u
++ tr ' ' '\n'
++ echo 'example.com
example.dokku-server.com' 'example.com
example.dokku-server.com'
++ rm -rf /tmp/dokku_nginx_template.9F2Vk/nginx.conf.tKUghX /tmp/dokku_nginx_template.9F2Vk
++ rm -rf
+ rm -rf
+ implemented=1
+ [[ 1 -eq 0 ]]
+ [[ 1 -eq 0 ]]
+ dokku_log_verbose done
+ declare 'desc=log verbose formatter'
+ echo '       done'
       done
+ exit_code=0
+ set -e
+ [[ 0 -eq 10 ]]
+ implemented=1
+ [[ 0 -ne 0 ]]
+ for script in '$PLUGIN_ENABLED_PATH/*/commands'
+ set +e
+ /var/lib/dokku/plugins/enabled/repo/commands redirect:set example www.example.com example.com
+ exit_code=10
+ set -e
+ [[ 10 -eq 10 ]]
+ continue
+ for script in '$PLUGIN_ENABLED_PATH/*/commands'
+ set +e
+ /var/lib/dokku/plugins/enabled/shell/commands redirect:set example www.example.com example.com
+ exit_code=10
+ set -e
+ [[ 10 -eq 10 ]]
+ continue
+ for script in '$PLUGIN_ENABLED_PATH/*/commands'
+ set +e
+ /var/lib/dokku/plugins/enabled/ssh-keys/commands redirect:set example www.example.com example.com
+ exit_code=10
+ set -e
+ [[ 10 -eq 10 ]]
+ continue
+ for script in '$PLUGIN_ENABLED_PATH/*/commands'
+ set +e
+ /var/lib/dokku/plugins/enabled/storage/commands redirect:set example www.example.com example.com
+ exit_code=10
+ set -e
+ [[ 10 -eq 10 ]]
+ continue
+ for script in '$PLUGIN_ENABLED_PATH/*/commands'
+ set +e
+ /var/lib/dokku/plugins/enabled/tags/commands redirect:set example www.example.com example.com
+ exit_code=10
+ set -e
+ [[ 10 -eq 10 ]]
+ continue
+ for script in '$PLUGIN_ENABLED_PATH/*/commands'
+ set +e
+ /var/lib/dokku/plugins/enabled/tar/commands redirect:set example www.example.com example.com
+ exit_code=10
+ set -e
+ [[ 10 -eq 10 ]]
+ continue
+ [[ 1 -eq 0 ]]
+ exit 0
agorf commented 6 years ago

@jimhaakman looks like the trace you pasted has no errors and was completed successfully.

I had the same issue. For me the issue was caused because DOKKU_PROXY_PORT_MAP had one entry and then some trailing whitespace (no idea how or why). So the fix was to set it manually with dokku config:set app DOKKU_PROXY_PORT_MAP=http:80:5000 stripping the trailing whitespace.

stphnnnn commented 6 years ago

@agorf stripping the trailing white space on that line solved this issue for me, thank you!

markahesketh commented 6 years ago

Good spot @agorf. This solved it for me too!