Skip to content

Instantly share code, notes, and snippets.

@IlyaSemenov
Created July 21, 2016 09:15
Show Gist options
  • Save IlyaSemenov/92526144e09a3bd2ff3e53ccb747ce45 to your computer and use it in GitHub Desktop.
Save IlyaSemenov/92526144e09a3bd2ff3e53ccb747ce45 to your computer and use it in GitHub Desktop.
Dokku letsencrypt fails to install the cert
+ case "$(lsb_release -si)" in
++ lsb_release -si
+ export DOKKU_DISTRO=ubuntu
+ DOKKU_DISTRO=ubuntu
+ export DOKKU_IMAGE=gliderlabs/herokuish
+ DOKKU_IMAGE=gliderlabs/herokuish
+ export DOKKU_LIB_ROOT=/var/lib/dokku
+ DOKKU_LIB_ROOT=/var/lib/dokku
+ export PLUGIN_PATH=/var/lib/dokku/plugins
+ PLUGIN_PATH=/var/lib/dokku/plugins
+ export PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ export PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ export PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ export PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ export PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ export DOKKU_API_VERSION=1
+ DOKKU_API_VERSION=1
+ export DOKKU_NOT_IMPLEMENTED_EXIT=10
+ DOKKU_NOT_IMPLEMENTED_EXIT=10
+ export DOKKU_VALID_EXIT=0
+ DOKKU_VALID_EXIT=0
+ export DOKKU_LOGS_DIR=/var/log/dokku
+ DOKKU_LOGS_DIR=/var/log/dokku
+ export DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ export DOKKU_CONTAINER_LABEL=dokku
+ DOKKU_CONTAINER_LABEL=dokku
+ export DOKKU_GLOBAL_RUN_ARGS=--label=dokku
+ DOKKU_GLOBAL_RUN_ARGS=--label=dokku
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ parse_args --app myapp letsencrypt myapp
+ declare 'desc=top-level cli arg parser'
+ local next_index=1
+ local skip=false
+ args=("$@")
+ local args
+ for arg in '"$@"'
+ false
+ case "$arg" in
+ export DOKKU_APP_NAME=myapp
+ DOKKU_APP_NAME=myapp
+ skip=true
+ local next_index=2
+ for arg in '"$@"'
+ true
+ skip=false
+ continue
+ for arg in '"$@"'
+ false
+ case "$arg" in
+ local next_index=3
+ for arg in '"$@"'
+ false
+ case "$arg" in
+ local next_index=4
+ return 0
+ args=("$@")
+ [[ --app =~ ^--.* ]]
+ for arg in '"$@"'
+ [[ --app == \-\-\a\p\p ]]
+ shift 2
+ for arg in '"$@"'
+ [[ myapp == \-\-\a\p\p ]]
+ [[ myapp =~ ^--.* ]]
+ break
+ has_tty
+ declare 'desc=return 0 if we have a tty'
++ /usr/bin/tty
+ [[ /dev/pts/1 == \n\o\t\ \a\ \t\t\y ]]
+ return 0
++ id -un
+ [[ dokku != \d\o\k\k\u ]]
++ id -un
+ [[ dokku != \r\o\o\t ]]
+ [[ letsencrypt =~ ^plugin:.* ]]
+ [[ -n --app myapp letsencrypt myapp ]]
+ export -n SSH_ORIGINAL_COMMAND
+ [[ letsencrypt =~ config-* ]]
+ [[ letsencrypt =~ docker-options* ]]
+ set -f
+ /usr/bin/dokku --app myapp letsencrypt myapp
+ case "$(lsb_release -si)" in
++ lsb_release -si
+ export DOKKU_DISTRO=ubuntu
+ DOKKU_DISTRO=ubuntu
+ export DOKKU_IMAGE=gliderlabs/herokuish
+ DOKKU_IMAGE=gliderlabs/herokuish
+ export DOKKU_LIB_ROOT=/var/lib/dokku
+ DOKKU_LIB_ROOT=/var/lib/dokku
+ export PLUGIN_PATH=/var/lib/dokku/plugins
+ PLUGIN_PATH=/var/lib/dokku/plugins
+ export PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ export PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ export PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ export PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ export PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ export DOKKU_API_VERSION=1
+ DOKKU_API_VERSION=1
+ export DOKKU_NOT_IMPLEMENTED_EXIT=10
+ DOKKU_NOT_IMPLEMENTED_EXIT=10
+ export DOKKU_VALID_EXIT=0
+ DOKKU_VALID_EXIT=0
+ export DOKKU_LOGS_DIR=/var/log/dokku
+ DOKKU_LOGS_DIR=/var/log/dokku
+ export DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ export DOKKU_CONTAINER_LABEL=dokku
+ DOKKU_CONTAINER_LABEL=dokku
+ export DOKKU_GLOBAL_RUN_ARGS=--label=dokku
+ DOKKU_GLOBAL_RUN_ARGS=--label=dokku
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ parse_args --app myapp letsencrypt myapp
+ declare 'desc=top-level cli arg parser'
+ local next_index=1
+ local skip=false
+ args=("$@")
+ local args
+ for arg in '"$@"'
+ false
+ case "$arg" in
+ export DOKKU_APP_NAME=myapp
+ DOKKU_APP_NAME=myapp
+ skip=true
+ local next_index=2
+ for arg in '"$@"'
+ true
+ skip=false
+ continue
+ for arg in '"$@"'
+ false
+ case "$arg" in
+ local next_index=3
+ for arg in '"$@"'
+ false
+ case "$arg" in
+ local next_index=4
+ return 0
+ args=("$@")
+ [[ --app =~ ^--.* ]]
+ for arg in '"$@"'
+ [[ --app == \-\-\a\p\p ]]
+ shift 2
+ for arg in '"$@"'
+ [[ myapp == \-\-\a\p\p ]]
+ [[ myapp =~ ^--.* ]]
+ break
+ has_tty
+ declare 'desc=return 0 if we have a tty'
++ /usr/bin/tty
+ [[ /dev/pts/1 == \n\o\t\ \a\ \t\t\y ]]
+ return 0
++ id -un
+ [[ dokku != \d\o\k\k\u ]]
++ id -un
+ [[ dokku != \r\o\o\t ]]
+ [[ letsencrypt =~ ^plugin:.* ]]
+ [[ -n '' ]]
+ dokku_auth letsencrypt myapp
+ declare 'desc=calls user-auth plugin trigger'
+ export SSH_USER=dokku
+ SSH_USER=dokku
+ export SSH_NAME=admin
+ SSH_NAME=admin
+ plugn trigger user-auth dokku admin letsencrypt myapp
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ [[ ! -n '' ]]
+ return 0
+ case "$1" in
+ execute_dokku_cmd letsencrypt myapp
+ declare 'desc=executes dokku sub-commands'
+ local PLUGIN_NAME=letsencrypt
+ local PLUGIN_CMD=letsencrypt
+ local implemented=0
+ local script
+ argv=("$@")
+ local argv
+ case "$PLUGIN_NAME" in
++ readlink -f /var/lib/dokku/plugins/enabled/letsencrypt
+ [[ /var/lib/dokku/plugins/available/letsencrypt == *core-plugins* ]]
+ [[ -x /var/lib/dokku/plugins/enabled/letsencrypt/subcommands/default ]]
+ /var/lib/dokku/plugins/enabled/letsencrypt/subcommands/default letsencrypt myapp
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ source /var/lib/dokku/core-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/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
+ source /var/lib/dokku/plugins/available/letsencrypt/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/core-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/core-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
+ letsencrypt_default_cmd letsencrypt myapp
+ declare 'desc=Validate an app'\''s domains and retrieve a certificate'
+ local app=myapp
+ [[ -z myapp ]]
+ dokku_log_info2 'Let'\''s Encrypt myapp'
+ declare 'desc=log info2 formatter'
+ echo '=====> Let'\''s Encrypt myapp'
=====> Let's Encrypt myapp
++ get_available_port
++ declare 'desc=returns first currently unused port > 1024'
++ true
+++ shuf -i 1025-65535 -n 1
++ local port=36711
++ nc -z 0.0.0.0 36711
++ echo 36711
++ return 0
+ local acme_port=36711
+ letsencrypt_check_email myapp
+ declare 'desc=Check if an e-mail address is provided globally or for the app'
+ local app=myapp
+ verify_app_name myapp
+ declare 'desc=verify app name format and app existence'
+ local APP=myapp
+ [[ ! -n myapp ]]
+ [[ ! myapp =~ ^[a-z].* ]]
+ [[ ! -d /home/dokku/myapp ]]
+ return 0
++ config_export global
++ declare 'desc=returns export command for config variable of specified type (app/global)'
++ local CONFIG_TYPE=global
++ local APP=
++ local ENV_FILE=/home/dokku//ENV
++ [[ global == \g\l\o\b\a\l ]]
++ local ENV_FILE=/home/dokku/ENV
++ [[ ! -f /home/dokku/ENV ]]
++ [[ ! -s /home/dokku/ENV ]]
+++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/ENV
+++ cut '-d ' -f2-
++ local 'VARS=DOKKU_LETSENCRYPT_EMAIL='\''[email protected]'\'''
++ echo 'DOKKU_LETSENCRYPT_EMAIL='\''[email protected]'\'''
++ awk '{print "export " $0}'
++ return 0
+ eval 'export DOKKU_LETSENCRYPT_EMAIL='\''[email protected]'\'''
++ export [email protected]
++ [email protected]
++ config_export app myapp
++ declare 'desc=returns export command for config variable of specified type (app/global)'
++ local CONFIG_TYPE=app
++ local APP=myapp
++ local ENV_FILE=/home/dokku/myapp/ENV
++ [[ app == \g\l\o\b\a\l ]]
++ [[ ! -f /home/dokku/myapp/ENV ]]
++ [[ ! -s /home/dokku/myapp/ENV ]]
+++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/myapp/ENV
+++ cut '-d ' -f2-
++ local 'VARS=ALLOWED_HOSTS='\''myapp.com'\''
DATABASE_URL='\''postgres://postgres:604c8498dd80783da0fdb09fdadbcb29@dokku-postgres-myapp:5432/myapp'\''
DOKKU_APP_RESTORE='\''1'\''
DOKKU_APP_TYPE='\''dockerfile'\''
DOKKU_DOCKERFILE_CMD='\''CMD /app/docker/entrypoint.sh'\''
DOKKU_DOCKERFILE_PORTS='\''80'\''
DOKKU_PROXY_PORT_MAP='\''http:80:80 https:443:80'\''
RETHINKDB_URL='\''rethinkdb://dokku-rethinkdb-myapp:28015'\''
SECRET_KEY='\''976DhtFYxlLHeIodF1nI2IzFAr8CWJT8wTYCFdxuYe6if3L1fb'\''
SENTRY_DSN='\''https://a4e4e9c4cc224cccacc0b30af8bd957a:[email protected]/22'\'''
++ echo 'ALLOWED_HOSTS='\''myapp.com'\''
DATABASE_URL='\''postgres://postgres:604c8498dd80783da0fdb09fdadbcb29@dokku-postgres-myapp:5432/myapp'\''
DOKKU_APP_RESTORE='\''1'\''
DOKKU_APP_TYPE='\''dockerfile'\''
DOKKU_DOCKERFILE_CMD='\''CMD /app/docker/entrypoint.sh'\''
DOKKU_DOCKERFILE_PORTS='\''80'\''
DOKKU_PROXY_PORT_MAP='\''http:80:80 https:443:80'\''
RETHINKDB_URL='\''rethinkdb://dokku-rethinkdb-myapp:28015'\''
SECRET_KEY='\''976DhtFYxlLHeIodF1nI2IzFAr8CWJT8wTYCFdxuYe6if3L1fb'\''
SENTRY_DSN='\''https://a4e4e9c4cc224cccacc0b30af8bd957a:[email protected]/22'\'''
++ awk '{print "export " $0}'
++ return 0
+ eval 'export ALLOWED_HOSTS='\''myapp.com'\''
export DATABASE_URL='\''postgres://postgres:604c8498dd80783da0fdb09fdadbcb29@dokku-postgres-myapp:5432/myapp'\''
export DOKKU_APP_RESTORE='\''1'\''
export DOKKU_APP_TYPE='\''dockerfile'\''
export DOKKU_DOCKERFILE_CMD='\''CMD /app/docker/entrypoint.sh'\''
export DOKKU_DOCKERFILE_PORTS='\''80'\''
export DOKKU_PROXY_PORT_MAP='\''http:80:80 https:443:80'\''
export RETHINKDB_URL='\''rethinkdb://dokku-rethinkdb-myapp:28015'\''
export SECRET_KEY='\''976DhtFYxlLHeIodF1nI2IzFAr8CWJT8wTYCFdxuYe6if3L1fb'\''
export SENTRY_DSN='\''https://a4e4e9c4cc224cccacc0b30af8bd957a:[email protected]/22'\'''
++ export ALLOWED_HOSTS=myapp.com
++ ALLOWED_HOSTS=myapp.com
++ export DATABASE_URL=postgres://postgres:604c8498dd80783da0fdb09fdadbcb29@dokku-postgres-myapp:5432/myapp
++ DATABASE_URL=postgres://postgres:604c8498dd80783da0fdb09fdadbcb29@dokku-postgres-myapp:5432/myapp
++ export DOKKU_APP_RESTORE=1
++ DOKKU_APP_RESTORE=1
++ export DOKKU_APP_TYPE=dockerfile
++ DOKKU_APP_TYPE=dockerfile
++ export 'DOKKU_DOCKERFILE_CMD=CMD /app/docker/entrypoint.sh'
++ DOKKU_DOCKERFILE_CMD='CMD /app/docker/entrypoint.sh'
++ export DOKKU_DOCKERFILE_PORTS=80
++ DOKKU_DOCKERFILE_PORTS=80
++ export 'DOKKU_PROXY_PORT_MAP=http:80:80 https:443:80'
++ DOKKU_PROXY_PORT_MAP='http:80:80 https:443:80'
++ export RETHINKDB_URL=rethinkdb://dokku-rethinkdb-myapp:28015
++ RETHINKDB_URL=rethinkdb://dokku-rethinkdb-myapp:28015
++ export SECRET_KEY=976DhtFYxlLHeIodF1nI2IzFAr8CWJT8wTYCFdxuYe6if3L1fb
++ SECRET_KEY=976DhtFYxlLHeIodF1nI2IzFAr8CWJT8wTYCFdxuYe6if3L1fb
++ export SENTRY_DSN=https://a4e4e9c4cc224cccacc0b30af8bd957a:[email protected]/22
++ SENTRY_DSN=https://a4e4e9c4cc224cccacc0b30af8bd957a:[email protected]/22
+ local [email protected]
+ '[' -z [email protected] ']'
+ letsencrypt_update
+ declare 'desc=update the docker image used for ACME validation'
+ dokku_log_info1 'Updating letsencrypt docker image...'
+ declare 'desc=log info1 formatter'
+ echo '-----> Updating letsencrypt docker image...'
-----> Updating letsencrypt docker image...
+ docker pull dokkupaas/letsencrypt-simp_le:latest
latest: Pulling from dokkupaas/letsencrypt-simp_le


420890c9e918: Already exists


e4a2ae244258: Already exists


5c6ac6d1c950: Already exists
Digest: sha256:18a19b34beceba79dd5be458abe7e132fc7486da1da19cc4d0395ad4578031ef
Status: Image is up to date for dokkupaas/letsencrypt-simp_le:latest
+ dokku_log_verbose 'done updating'
+ declare 'desc=log verbose formatter'
+ echo ' done updating'
done updating
+ letsencrypt_acmeproxy_on myapp 36711
+ declare 'desc=enable ACME proxy for an app'
+ local app=myapp
+ verify_app_name myapp
+ declare 'desc=verify app name format and app existence'
+ local APP=myapp
+ [[ ! -n myapp ]]
+ [[ ! myapp =~ ^[a-z].* ]]
+ [[ ! -d /home/dokku/myapp ]]
+ return 0
+ local acme_port=36711
+ local app_root=/home/dokku/myapp
+ local app_config_dir=/home/dokku/myapp/nginx.conf.d
+ dokku_log_info1 'Enabling ACME proxy for myapp...'
+ declare 'desc=log info1 formatter'
+ echo '-----> Enabling ACME proxy for myapp...'
-----> Enabling ACME proxy for myapp...
+ [[ -d /home/dokku/myapp/nginx.conf.d ]]
+ sigil -f /var/lib/dokku/plugins/available/letsencrypt/templates/letsencrypt.conf.sigil ACME_PORT=36711
+ restart_nginx
+ declare 'desc=restart nginx for given distros'
+ case "$DOKKU_DISTRO" in
+ sudo /etc/init.d/nginx reload
+ letsencrypt_acme myapp 36711
+ declare 'desc=perform actual ACME validation procedure'
+ local app=myapp
+ local acme_port=36711
+ letsencrypt_create_root myapp
+ declare 'desc=Ensure the let'\''s encrypt root directory exists'
+ local app=myapp
+ verify_app_name myapp
+ declare 'desc=verify app name format and app existence'
+ local APP=myapp
+ [[ ! -n myapp ]]
+ [[ ! myapp =~ ^[a-z].* ]]
+ [[ ! -d /home/dokku/myapp ]]
+ return 0
+ local app_root=/home/dokku/myapp
+ local le_root=/home/dokku/myapp/letsencrypt
+ mkdir -p /home/dokku/myapp/letsencrypt
+ dokku_log_info1 'Getting letsencrypt certificate for myapp...'
+ declare 'desc=log info1 formatter'
+ echo '-----> Getting letsencrypt certificate for myapp...'
-----> Getting letsencrypt certificate for myapp...
++ letsencrypt_configure_and_get_dir myapp
++ declare 'desc=assemble simp_le command line arguments and create a config hash directory for them'
++ local app=myapp
++ verify_app_name myapp
++ declare 'desc=verify app name format and app existence'
++ local APP=myapp
++ [[ ! -n myapp ]]
++ [[ ! myapp =~ ^[a-z].* ]]
++ [[ ! -d /home/dokku/myapp ]]
++ return 0
++ local app_root=/home/dokku/myapp
++ local le_root=/home/dokku/myapp/letsencrypt
+++ config_export global
+++ declare 'desc=returns export command for config variable of specified type (app/global)'
+++ local CONFIG_TYPE=global
+++ local APP=
+++ local ENV_FILE=/home/dokku//ENV
+++ [[ global == \g\l\o\b\a\l ]]
+++ local ENV_FILE=/home/dokku/ENV
+++ [[ ! -f /home/dokku/ENV ]]
+++ [[ ! -s /home/dokku/ENV ]]
++++ cut '-d ' -f2-
++++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/ENV
+++ local 'VARS=DOKKU_LETSENCRYPT_EMAIL='\''[email protected]'\'''
+++ awk '{print "export " $0}'
+++ echo 'DOKKU_LETSENCRYPT_EMAIL='\''[email protected]'\'''
+++ return 0
++ eval 'export DOKKU_LETSENCRYPT_EMAIL='\''[email protected]'\'''
+++ export [email protected]
+++ [email protected]
+++ config_export app myapp
+++ declare 'desc=returns export command for config variable of specified type (app/global)'
+++ local CONFIG_TYPE=app
+++ local APP=myapp
+++ local ENV_FILE=/home/dokku/myapp/ENV
+++ [[ app == \g\l\o\b\a\l ]]
+++ [[ ! -f /home/dokku/myapp/ENV ]]
+++ [[ ! -s /home/dokku/myapp/ENV ]]
++++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/myapp/ENV
++++ cut '-d ' -f2-
+++ local 'VARS=ALLOWED_HOSTS='\''myapp.com'\''
DATABASE_URL='\''postgres://postgres:604c8498dd80783da0fdb09fdadbcb29@dokku-postgres-myapp:5432/myapp'\''
DOKKU_APP_RESTORE='\''1'\''
DOKKU_APP_TYPE='\''dockerfile'\''
DOKKU_DOCKERFILE_CMD='\''CMD /app/docker/entrypoint.sh'\''
DOKKU_DOCKERFILE_PORTS='\''80'\''
DOKKU_PROXY_PORT_MAP='\''http:80:80 https:443:80'\''
RETHINKDB_URL='\''rethinkdb://dokku-rethinkdb-myapp:28015'\''
SECRET_KEY='\''976DhtFYxlLHeIodF1nI2IzFAr8CWJT8wTYCFdxuYe6if3L1fb'\''
SENTRY_DSN='\''https://a4e4e9c4cc224cccacc0b30af8bd957a:[email protected]/22'\'''
+++ echo 'ALLOWED_HOSTS='\''myapp.com'\''
DATABASE_URL='\''postgres://postgres:604c8498dd80783da0fdb09fdadbcb29@dokku-postgres-myapp:5432/myapp'\''
DOKKU_APP_RESTORE='\''1'\''
DOKKU_APP_TYPE='\''dockerfile'\''
DOKKU_DOCKERFILE_CMD='\''CMD /app/docker/entrypoint.sh'\''
DOKKU_DOCKERFILE_PORTS='\''80'\''
DOKKU_PROXY_PORT_MAP='\''http:80:80 https:443:80'\''
RETHINKDB_URL='\''rethinkdb://dokku-rethinkdb-myapp:28015'\''
SECRET_KEY='\''976DhtFYxlLHeIodF1nI2IzFAr8CWJT8wTYCFdxuYe6if3L1fb'\''
SENTRY_DSN='\''https://a4e4e9c4cc224cccacc0b30af8bd957a:[email protected]/22'\'''
+++ awk '{print "export " $0}'
+++ return 0
++ eval 'export ALLOWED_HOSTS='\''myapp.com'\''
export DATABASE_URL='\''postgres://postgres:604c8498dd80783da0fdb09fdadbcb29@dokku-postgres-myapp:5432/myapp'\''
export DOKKU_APP_RESTORE='\''1'\''
export DOKKU_APP_TYPE='\''dockerfile'\''
export DOKKU_DOCKERFILE_CMD='\''CMD /app/docker/entrypoint.sh'\''
export DOKKU_DOCKERFILE_PORTS='\''80'\''
export DOKKU_PROXY_PORT_MAP='\''http:80:80 https:443:80'\''
export RETHINKDB_URL='\''rethinkdb://dokku-rethinkdb-myapp:28015'\''
export SECRET_KEY='\''976DhtFYxlLHeIodF1nI2IzFAr8CWJT8wTYCFdxuYe6if3L1fb'\''
export SENTRY_DSN='\''https://a4e4e9c4cc224cccacc0b30af8bd957a:[email protected]/22'\'''
+++ export ALLOWED_HOSTS=myapp.com
+++ ALLOWED_HOSTS=myapp.com
+++ export DATABASE_URL=postgres://postgres:604c8498dd80783da0fdb09fdadbcb29@dokku-postgres-myapp:5432/myapp
+++ DATABASE_URL=postgres://postgres:604c8498dd80783da0fdb09fdadbcb29@dokku-postgres-myapp:5432/myapp
+++ export DOKKU_APP_RESTORE=1
+++ DOKKU_APP_RESTORE=1
+++ export DOKKU_APP_TYPE=dockerfile
+++ DOKKU_APP_TYPE=dockerfile
+++ export 'DOKKU_DOCKERFILE_CMD=CMD /app/docker/entrypoint.sh'
+++ DOKKU_DOCKERFILE_CMD='CMD /app/docker/entrypoint.sh'
+++ export DOKKU_DOCKERFILE_PORTS=80
+++ DOKKU_DOCKERFILE_PORTS=80
+++ export 'DOKKU_PROXY_PORT_MAP=http:80:80 https:443:80'
+++ DOKKU_PROXY_PORT_MAP='http:80:80 https:443:80'
+++ export RETHINKDB_URL=rethinkdb://dokku-rethinkdb-myapp:28015
+++ RETHINKDB_URL=rethinkdb://dokku-rethinkdb-myapp:28015
+++ export SECRET_KEY=976DhtFYxlLHeIodF1nI2IzFAr8CWJT8wTYCFdxuYe6if3L1fb
+++ SECRET_KEY=976DhtFYxlLHeIodF1nI2IzFAr8CWJT8wTYCFdxuYe6if3L1fb
+++ export SENTRY_DSN=https://a4e4e9c4cc224cccacc0b30af8bd957a:[email protected]/22
+++ SENTRY_DSN=https://a4e4e9c4cc224cccacc0b30af8bd957a:[email protected]/22
++ local server=default
++ '[' -z default ']'
++ '[' default == default ']'
++ server=https://acme-v01.api.letsencrypt.org/directory
+++ get_app_domains myapp
+++ declare 'desc=return app domains'
+++ verify_app_name myapp
+++ declare 'desc=verify app name format and app existence'
+++ local APP=myapp
+++ [[ ! -n myapp ]]
+++ [[ ! myapp =~ ^[a-z].* ]]
+++ [[ ! -d /home/dokku/myapp ]]
+++ return 0
+++ local APP=myapp
+++ local APP_VHOST_FILE=/home/dokku/myapp/VHOST
+++ local GLOBAL_VHOST_PATH=/home/dokku/VHOST
+++ local GLOBAL_HOSTNAME_PATH=/home/dokku/HOSTNAME
++++ is_app_vhost_enabled myapp
++++ 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=myapp
++++ verify_app_name myapp
++++ declare 'desc=verify app name format and app existence'
++++ local APP=myapp
++++ [[ ! -n myapp ]]
++++ [[ ! myapp =~ ^[a-z].* ]]
++++ [[ ! -d /home/dokku/myapp ]]
++++ return 0
+++++ config_get myapp NO_VHOST
+++++ declare 'desc=get value of given config var'
+++++ [[ myapp == \c\o\n\f\i\g\:\g\e\t ]]
+++++ set -- config:get myapp NO_VHOST
+++++ config_parse_args config:get myapp NO_VHOST
+++++ declare 'desc=parse config plugin args'
+++++ unset APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
+++++ for var in '"$@"'
+++++ [[ config:get == \-\-\g\l\o\b\a\l ]]
+++++ [[ config:get == \-\-\n\o\-\r\e\s\t\a\r\t ]]
+++++ [[ config:get == \-\-\e\x\p\o\r\t ]]
+++++ [[ config:get == \-\-\s\h\e\l\l ]]
+++++ for var in '"$@"'
+++++ [[ myapp == \-\-\g\l\o\b\a\l ]]
+++++ [[ myapp == \-\-\n\o\-\r\e\s\t\a\r\t ]]
+++++ [[ myapp == \-\-\e\x\p\o\r\t ]]
+++++ [[ myapp == \-\-\s\h\e\l\l ]]
+++++ for var in '"$@"'
+++++ [[ NO_VHOST == \-\-\g\l\o\b\a\l ]]
+++++ [[ NO_VHOST == \-\-\n\o\-\r\e\s\t\a\r\t ]]
+++++ [[ NO_VHOST == \-\-\e\x\p\o\r\t ]]
+++++ [[ NO_VHOST == \-\-\s\h\e\l\l ]]
+++++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
++++++ get_sanitized_config_args config:get myapp NO_VHOST
++++++ local 'desc=return sanitized arguments for config plugin'
++++++ SANITIZED_ARGS=("$@")
++++++ local SANITIZED_ARGS
++++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
++++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
++++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
++++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
++++++ echo config:get myapp NO_VHOST
+++++ local SANITIZED_ARGS
+++++ set -- config:get myapp NO_VHOST
+++++ DOKKU_CONFIG_TYPE=app
+++++ DOKKU_CONFIG_RESTART=true
+++++ [[ app == \a\p\p ]]
+++++ [[ -z myapp ]]
+++++ verify_app_name myapp
+++++ declare 'desc=verify app name format and app existence'
+++++ local APP=myapp
+++++ [[ ! -n myapp ]]
+++++ [[ ! myapp =~ ^[a-z].* ]]
+++++ [[ ! -d /home/dokku/myapp ]]
+++++ return 0
+++++ APP=myapp
+++++ ENV_FILE=/home/dokku/myapp/ENV
+++++ export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
+++++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
++++++ get_sanitized_config_args config:get myapp NO_VHOST
++++++ local 'desc=return sanitized arguments for config plugin'
++++++ SANITIZED_ARGS=("$@")
++++++ local SANITIZED_ARGS
++++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
++++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
++++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
++++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
++++++ echo config:get myapp NO_VHOST
+++++ local SANITIZED_ARGS
+++++ set -- config:get myapp NO_VHOST
+++++ [[ -z myapp ]]
+++++ config_create /home/dokku/myapp/ENV
+++++ declare 'desc=create config env file'
+++++ local ENV_FILE=/home/dokku/myapp/ENV
+++++ [[ -f /home/dokku/myapp/ENV ]]
+++++ [[ ! -s /home/dokku/myapp/ENV ]]
+++++ local KEY=NO_VHOST
+++++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/myapp/ENV
+++++ sed -e 's/^'\''//' -e 's/'\''$//'
+++++ cut -d= -f2-
+++++ grep '^export NO_VHOST='
++++ local NO_VHOST=
++++ local APP_VHOST_ENABLED=true
++++ [[ '' == \1 ]]
++++ echo true
+++ [[ true == \t\r\u\e ]]
+++ [[ -f /home/dokku/myapp/VHOST ]]
+++ cat /home/dokku/myapp/VHOST
++ local 'domains=myapp.com
www.myapp.com'
++ local domain_args=
++ for domain in '$domains'
++ dokku_log_verbose ' - Domain '\''myapp.com'\'''
++ declare 'desc=log verbose formatter'
++ echo ' - Domain '\''myapp.com'\'''
- Domain 'myapp.com'
++ domain_args=' -d myapp.com'
++ for domain in '$domains'
++ dokku_log_verbose ' - Domain '\''www.myapp.com'\'''
++ declare 'desc=log verbose formatter'
++ echo ' - Domain '\''www.myapp.com'\'''
- Domain 'www.myapp.com'
++ domain_args=' -d myapp.com -d www.myapp.com'
++ local 'config=--server https://acme-v01.api.letsencrypt.org/directory --email [email protected] -d myapp.com -d www.myapp.com'
+++ echo '--server https://acme-v01.api.letsencrypt.org/directory --email [email protected] -d myapp.com -d www.myapp.com'
+++ sha1sum
+++ awk '{print $1}'
++ local config_hash=11a26553fcb4fb877fae237b3e1471fa54210c2a
++ local config_dir=/home/dokku/myapp/letsencrypt/certs/11a26553fcb4fb877fae237b3e1471fa54210c2a
++ mkdir -p /home/dokku/myapp/letsencrypt/certs/11a26553fcb4fb877fae237b3e1471fa54210c2a
++ echo '--server https://acme-v01.api.letsencrypt.org/directory --email [email protected] -d myapp.com -d www.myapp.com'
++ echo /home/dokku/myapp/letsencrypt/certs/11a26553fcb4fb877fae237b3e1471fa54210c2a
+ local config_dir=/home/dokku/myapp/letsencrypt/certs/11a26553fcb4fb877fae237b3e1471fa54210c2a
+ read -r -a config
++ config_export global
++ declare 'desc=returns export command for config variable of specified type (app/global)'
++ local CONFIG_TYPE=global
++ local APP=
++ local ENV_FILE=/home/dokku//ENV
++ [[ global == \g\l\o\b\a\l ]]
++ local ENV_FILE=/home/dokku/ENV
++ [[ ! -f /home/dokku/ENV ]]
++ [[ ! -s /home/dokku/ENV ]]
+++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/ENV
+++ cut '-d ' -f2-
++ local 'VARS=DOKKU_LETSENCRYPT_EMAIL='\''[email protected]'\'''
++ echo 'DOKKU_LETSENCRYPT_EMAIL='\''[email protected]'\'''
++ awk '{print "export " $0}'
++ return 0
+ eval 'export DOKKU_LETSENCRYPT_EMAIL='\''[email protected]'\'''
++ export [email protected]
++ [email protected]
++ config_export app myapp
++ declare 'desc=returns export command for config variable of specified type (app/global)'
++ local CONFIG_TYPE=app
++ local APP=myapp
++ local ENV_FILE=/home/dokku/myapp/ENV
++ [[ app == \g\l\o\b\a\l ]]
++ [[ ! -f /home/dokku/myapp/ENV ]]
++ [[ ! -s /home/dokku/myapp/ENV ]]
+++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/myapp/ENV
+++ cut '-d ' -f2-
++ local 'VARS=ALLOWED_HOSTS='\''myapp.com'\''
DATABASE_URL='\''postgres://postgres:604c8498dd80783da0fdb09fdadbcb29@dokku-postgres-myapp:5432/myapp'\''
DOKKU_APP_RESTORE='\''1'\''
DOKKU_APP_TYPE='\''dockerfile'\''
DOKKU_DOCKERFILE_CMD='\''CMD /app/docker/entrypoint.sh'\''
DOKKU_DOCKERFILE_PORTS='\''80'\''
DOKKU_PROXY_PORT_MAP='\''http:80:80 https:443:80'\''
RETHINKDB_URL='\''rethinkdb://dokku-rethinkdb-myapp:28015'\''
SECRET_KEY='\''976DhtFYxlLHeIodF1nI2IzFAr8CWJT8wTYCFdxuYe6if3L1fb'\''
SENTRY_DSN='\''https://a4e4e9c4cc224cccacc0b30af8bd957a:[email protected]/22'\'''
++ echo 'ALLOWED_HOSTS='\''myapp.com'\''
DATABASE_URL='\''postgres://postgres:604c8498dd80783da0fdb09fdadbcb29@dokku-postgres-myapp:5432/myapp'\''
DOKKU_APP_RESTORE='\''1'\''
DOKKU_APP_TYPE='\''dockerfile'\''
DOKKU_DOCKERFILE_CMD='\''CMD /app/docker/entrypoint.sh'\''
DOKKU_DOCKERFILE_PORTS='\''80'\''
DOKKU_PROXY_PORT_MAP='\''http:80:80 https:443:80'\''
RETHINKDB_URL='\''rethinkdb://dokku-rethinkdb-myapp:28015'\''
SECRET_KEY='\''976DhtFYxlLHeIodF1nI2IzFAr8CWJT8wTYCFdxuYe6if3L1fb'\''
SENTRY_DSN='\''https://a4e4e9c4cc224cccacc0b30af8bd957a:[email protected]/22'\'''
++ awk '{print "export " $0}'
++ return 0
+ eval 'export ALLOWED_HOSTS='\''myapp.com'\''
export DATABASE_URL='\''postgres://postgres:604c8498dd80783da0fdb09fdadbcb29@dokku-postgres-myapp:5432/myapp'\''
export DOKKU_APP_RESTORE='\''1'\''
export DOKKU_APP_TYPE='\''dockerfile'\''
export DOKKU_DOCKERFILE_CMD='\''CMD /app/docker/entrypoint.sh'\''
export DOKKU_DOCKERFILE_PORTS='\''80'\''
export DOKKU_PROXY_PORT_MAP='\''http:80:80 https:443:80'\''
export RETHINKDB_URL='\''rethinkdb://dokku-rethinkdb-myapp:28015'\''
export SECRET_KEY='\''976DhtFYxlLHeIodF1nI2IzFAr8CWJT8wTYCFdxuYe6if3L1fb'\''
export SENTRY_DSN='\''https://a4e4e9c4cc224cccacc0b30af8bd957a:[email protected]/22'\'''
++ export ALLOWED_HOSTS=myapp.com
++ ALLOWED_HOSTS=myapp.com
++ export DATABASE_URL=postgres://postgres:604c8498dd80783da0fdb09fdadbcb29@dokku-postgres-myapp:5432/myapp
++ DATABASE_URL=postgres://postgres:604c8498dd80783da0fdb09fdadbcb29@dokku-postgres-myapp:5432/myapp
++ export DOKKU_APP_RESTORE=1
++ DOKKU_APP_RESTORE=1
++ export DOKKU_APP_TYPE=dockerfile
++ DOKKU_APP_TYPE=dockerfile
++ export 'DOKKU_DOCKERFILE_CMD=CMD /app/docker/entrypoint.sh'
++ DOKKU_DOCKERFILE_CMD='CMD /app/docker/entrypoint.sh'
++ export DOKKU_DOCKERFILE_PORTS=80
++ DOKKU_DOCKERFILE_PORTS=80
++ export 'DOKKU_PROXY_PORT_MAP=http:80:80 https:443:80'
++ DOKKU_PROXY_PORT_MAP='http:80:80 https:443:80'
++ export RETHINKDB_URL=rethinkdb://dokku-rethinkdb-myapp:28015
++ RETHINKDB_URL=rethinkdb://dokku-rethinkdb-myapp:28015
++ export SECRET_KEY=976DhtFYxlLHeIodF1nI2IzFAr8CWJT8wTYCFdxuYe6if3L1fb
++ SECRET_KEY=976DhtFYxlLHeIodF1nI2IzFAr8CWJT8wTYCFdxuYe6if3L1fb
++ export SENTRY_DSN=https://a4e4e9c4cc224cccacc0b30af8bd957a:[email protected]/22
++ SENTRY_DSN=https://a4e4e9c4cc224cccacc0b30af8bd957a:[email protected]/22
+ local graceperiod=2592000
+ set +e
+ docker run --rm -p 36711:80 -v /home/dokku/myapp/letsencrypt/certs/11a26553fcb4fb877fae237b3e1471fa54210c2a:/certs dokkupaas/letsencrypt-simp_le:latest -f account_key.json -f fullchain.pem -f chain.pem -f cert.pem -f key.pem --valid_min 2592000 --server https://acme-v01.api.letsencrypt.org/directory --email [email protected] -d myapp.com -d www.myapp.com
darkhttpd/1.11, copyright (c) 2003-2015 Emil Mikulic.
listening on: http://0.0.0.0:80/
2016-07-21 09:13:30,612:INFO:__main__:1383: Certificates already exist and renewal is not necessary, exiting with status code 1.
+ local simple_result=1
+ set -e
+ [[ 1 == 0 ]]
+ [[ 1 == 1 ]]
+ dokku_log_info1 'No renewal necessary'
+ declare 'desc=log info1 formatter'
+ echo '-----> No renewal necessary'
-----> No renewal necessary
+ letsencrypt_link myapp /home/dokku/myapp/letsencrypt/certs/11a26553fcb4fb877fae237b3e1471fa54210c2a
+ declare 'desc=symlink let'\''s encrypt certificates so they can be found by dokku'
+ local app=myapp
+ verify_app_name myapp
+ declare 'desc=verify app name format and app existence'
+ local APP=myapp
+ [[ ! -n myapp ]]
+ [[ ! myapp =~ ^[a-z].* ]]
+ [[ ! -d /home/dokku/myapp ]]
+ return 0
+ local config_dir=/home/dokku/myapp/letsencrypt/certs/11a26553fcb4fb877fae237b3e1471fa54210c2a
+ local app_root=/home/dokku/myapp
+ local le_root=/home/dokku/myapp/letsencrypt
+ dokku_log_info1 'Installing let'\''s encrypt certificates'
+ declare 'desc=log info1 formatter'
+ echo '-----> Installing let'\''s encrypt certificates'
-----> Installing let's encrypt certificates
+ ln -nsf /home/dokku/myapp/letsencrypt/certs/11a26553fcb4fb877fae237b3e1471fa54210c2a /home/dokku/myapp/letsencrypt/certs/current
+ dokku certs:add myapp /home/dokku/myapp/letsencrypt/certs/current/fullchain.pem /home/dokku/myapp/letsencrypt/certs/current/key.pem
+ case "$(lsb_release -si)" in
++ lsb_release -si
+ export DOKKU_DISTRO=ubuntu
+ DOKKU_DISTRO=ubuntu
+ export DOKKU_IMAGE=gliderlabs/herokuish
+ DOKKU_IMAGE=gliderlabs/herokuish
+ export DOKKU_LIB_ROOT=/var/lib/dokku
+ DOKKU_LIB_ROOT=/var/lib/dokku
+ export PLUGIN_PATH=/var/lib/dokku/plugins
+ PLUGIN_PATH=/var/lib/dokku/plugins
+ export PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ export PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ export PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ export PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ export PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ export DOKKU_API_VERSION=1
+ DOKKU_API_VERSION=1
+ export DOKKU_NOT_IMPLEMENTED_EXIT=10
+ DOKKU_NOT_IMPLEMENTED_EXIT=10
+ export DOKKU_VALID_EXIT=0
+ DOKKU_VALID_EXIT=0
+ export DOKKU_LOGS_DIR=/var/log/dokku
+ DOKKU_LOGS_DIR=/var/log/dokku
+ export DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ export DOKKU_CONTAINER_LABEL=dokku
+ DOKKU_CONTAINER_LABEL=dokku
+ export DOKKU_GLOBAL_RUN_ARGS=--label=dokku
+ DOKKU_GLOBAL_RUN_ARGS=--label=dokku
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ parse_args certs:add myapp /home/dokku/myapp/letsencrypt/certs/current/fullchain.pem /home/dokku/myapp/letsencrypt/certs/current/key.pem
+ declare 'desc=top-level cli arg parser'
+ local next_index=1
+ local skip=false
+ args=("$@")
+ local args
+ for arg in '"$@"'
+ false
+ case "$arg" in
+ local next_index=2
+ for arg in '"$@"'
+ false
+ case "$arg" in
+ local next_index=3
+ for arg in '"$@"'
+ false
+ case "$arg" in
+ local next_index=4
+ for arg in '"$@"'
+ false
+ case "$arg" in
+ local next_index=5
+ return 0
+ args=("$@")
+ [[ certs:add =~ ^--.* ]]
+ has_tty
+ declare 'desc=return 0 if we have a tty'
++ /usr/bin/tty
+ [[ /dev/pts/1 == \n\o\t\ \a\ \t\t\y ]]
+ return 0
++ id -un
+ [[ dokku != \d\o\k\k\u ]]
++ id -un
+ [[ dokku != \r\o\o\t ]]
+ [[ certs:add =~ ^plugin:.* ]]
+ [[ -n '' ]]
+ dokku_auth certs:add myapp /home/dokku/myapp/letsencrypt/certs/current/fullchain.pem /home/dokku/myapp/letsencrypt/certs/current/key.pem
+ declare 'desc=calls user-auth plugin trigger'
+ export SSH_USER=dokku
+ SSH_USER=dokku
+ export SSH_NAME=admin
+ SSH_NAME=admin
+ plugn trigger user-auth dokku admin certs:add myapp /home/dokku/myapp/letsencrypt/certs/current/fullchain.pem /home/dokku/myapp/letsencrypt/certs/current/key.pem
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ [[ ! -n '' ]]
+ return 0
+ case "$1" in
+ execute_dokku_cmd certs:add myapp /home/dokku/myapp/letsencrypt/certs/current/fullchain.pem /home/dokku/myapp/letsencrypt/certs/current/key.pem
+ declare 'desc=executes dokku sub-commands'
+ local PLUGIN_NAME=certs:add
+ local PLUGIN_CMD=certs:add
+ local implemented=0
+ local script
+ argv=("$@")
+ local argv
+ case "$PLUGIN_NAME" in
++ readlink -f /var/lib/dokku/plugins/enabled/certs
+ [[ /var/lib/dokku/core-plugins/available/certs == *core-plugins* ]]
+ [[ certs:add == \c\e\r\t\s\:\a\d\d ]]
+ shift 1
+ [[ ! -z myapp ]]
+ [[ certs:add == config* ]]
+ set -- myapp myapp /home/dokku/myapp/letsencrypt/certs/current/fullchain.pem /home/dokku/myapp/letsencrypt/certs/current/key.pem
+ set -- certs:add myapp myapp /home/dokku/myapp/letsencrypt/certs/current/fullchain.pem /home/dokku/myapp/letsencrypt/certs/current/key.pem
+ [[ -x /var/lib/dokku/plugins/enabled/certs:add/subcommands/default ]]
+ [[ -x /var/lib/dokku/plugins/enabled/certs:add/subcommands/certs:add ]]
+ [[ -x /var/lib/dokku/plugins/enabled/certs/subcommands/add ]]
+ /var/lib/dokku/plugins/enabled/certs/subcommands/add certs:add myapp myapp /home/dokku/myapp/letsencrypt/certs/current/fullchain.pem /home/dokku/myapp/letsencrypt/certs/current/key.pem
+ 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
+ certs_set certs:add myapp myapp /home/dokku/myapp/letsencrypt/certs/current/fullchain.pem /home/dokku/myapp/letsencrypt/certs/current/key.pem
+ declare 'desc=imports an SSL cert/key combo either on STDIN via a tarball or from specified cert/key filenames'
+ local cmd=certs:add
+ [[ -z myapp ]]
+ verify_app_name myapp
+ declare 'desc=verify app name format and app existence'
+ local APP=myapp
+ [[ ! -n myapp ]]
+ [[ ! myapp =~ ^[a-z].* ]]
+ [[ ! -d /home/dokku/myapp ]]
+ return 0
+ local APP=myapp
+ local CRT_FILE=myapp
+ local KEY_FILE=/home/dokku/myapp/letsencrypt/certs/current/fullchain.pem
+ local APP_SSL_PATH=/home/dokku/myapp/tls
+ is_file_import myapp /home/dokku/myapp/letsencrypt/certs/current/fullchain.pem
+ declare 'desc=determines if we have passed in a file and key path for a file import'
+ local CRT_FILE=myapp
+ local KEY_FILE=/home/dokku/myapp/letsencrypt/certs/current/fullchain.pem
+ [[ -n myapp ]]
+ [[ -n /home/dokku/myapp/letsencrypt/certs/current/fullchain.pem ]]
+ [[ ! -f myapp ]]
+ dokku_log_fail 'CRT file specified not found, please check file paths'
+ declare 'desc=log fail formatter'
+ echo 'CRT file specified not found, please check file paths'
CRT file specified not found, please check file paths
+ exit 1
+ nginx_build_config myapp
+ declare 'desc=build nginx config to proxy app containers using sigil'
+ local APP=myapp
+ verify_app_name myapp
+ declare 'desc=verify app name format and app existence'
+ local APP=myapp
+ [[ ! -n myapp ]]
+ [[ ! myapp =~ ^[a-z].* ]]
+ [[ ! -d /home/dokku/myapp ]]
+ return 0
+ local DOKKU_APP_LISTEN_PORT=
+ local DOKKU_APP_LISTEN_IP=
+ local VHOST_PATH=/home/dokku/myapp/VHOST
+ local URLS_PATH=/home/dokku/myapp/URLS
+ local NGINX_TEMPLATE_NAME=nginx.conf.sigil
+ local DEFAULT_NGINX_TEMPLATE=/var/lib/dokku/plugins/available/nginx-vhosts/templates/nginx.conf.sigil
+ local NGINX_TEMPLATE=/var/lib/dokku/plugins/available/nginx-vhosts/templates/nginx.conf.sigil
+ local SCHEME=http
+ local NGINX_TEMPLATE_SOURCE=built-in
+ local APP_SSL_PATH=/home/dokku/myapp/tls
++ get_app_raw_tcp_ports myapp
++ 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=myapp
++ verify_app_name myapp
++ declare 'desc=verify app name format and app existence'
++ local APP=myapp
++ [[ ! -n myapp ]]
++ [[ ! myapp =~ ^[a-z].* ]]
++ [[ ! -d /home/dokku/myapp ]]
++ return 0
+++ config_get myapp DOKKU_DOCKERFILE_PORTS
+++ declare 'desc=get value of given config var'
+++ [[ myapp == \c\o\n\f\i\g\:\g\e\t ]]
+++ set -- config:get myapp DOKKU_DOCKERFILE_PORTS
+++ config_parse_args config:get myapp DOKKU_DOCKERFILE_PORTS
+++ declare 'desc=parse config plugin args'
+++ unset APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
+++ for var in '"$@"'
+++ [[ config:get == \-\-\g\l\o\b\a\l ]]
+++ [[ config:get == \-\-\n\o\-\r\e\s\t\a\r\t ]]
+++ [[ config:get == \-\-\e\x\p\o\r\t ]]
+++ [[ config:get == \-\-\s\h\e\l\l ]]
+++ for var in '"$@"'
+++ [[ myapp == \-\-\g\l\o\b\a\l ]]
+++ [[ myapp == \-\-\n\o\-\r\e\s\t\a\r\t ]]
+++ [[ myapp == \-\-\e\x\p\o\r\t ]]
+++ [[ myapp == \-\-\s\h\e\l\l ]]
+++ for var in '"$@"'
+++ [[ DOKKU_DOCKERFILE_PORTS == \-\-\g\l\o\b\a\l ]]
+++ [[ DOKKU_DOCKERFILE_PORTS == \-\-\n\o\-\r\e\s\t\a\r\t ]]
+++ [[ DOKKU_DOCKERFILE_PORTS == \-\-\e\x\p\o\r\t ]]
+++ [[ DOKKU_DOCKERFILE_PORTS == \-\-\s\h\e\l\l ]]
+++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
++++ get_sanitized_config_args config:get myapp DOKKU_DOCKERFILE_PORTS
++++ local 'desc=return sanitized arguments for config plugin'
++++ SANITIZED_ARGS=("$@")
++++ local SANITIZED_ARGS
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
++++ echo config:get myapp DOKKU_DOCKERFILE_PORTS
+++ local SANITIZED_ARGS
+++ set -- config:get myapp DOKKU_DOCKERFILE_PORTS
+++ DOKKU_CONFIG_TYPE=app
+++ DOKKU_CONFIG_RESTART=true
+++ [[ app == \a\p\p ]]
+++ [[ -z myapp ]]
+++ verify_app_name myapp
+++ declare 'desc=verify app name format and app existence'
+++ local APP=myapp
+++ [[ ! -n myapp ]]
+++ [[ ! myapp =~ ^[a-z].* ]]
+++ [[ ! -d /home/dokku/myapp ]]
+++ return 0
+++ APP=myapp
+++ ENV_FILE=/home/dokku/myapp/ENV
+++ export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
+++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
++++ get_sanitized_config_args config:get myapp DOKKU_DOCKERFILE_PORTS
++++ local 'desc=return sanitized arguments for config plugin'
++++ SANITIZED_ARGS=("$@")
++++ local SANITIZED_ARGS
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
++++ echo config:get myapp DOKKU_DOCKERFILE_PORTS
+++ local SANITIZED_ARGS
+++ set -- config:get myapp DOKKU_DOCKERFILE_PORTS
+++ [[ -z myapp ]]
+++ config_create /home/dokku/myapp/ENV
+++ declare 'desc=create config env file'
+++ local ENV_FILE=/home/dokku/myapp/ENV
+++ [[ -f /home/dokku/myapp/ENV ]]
+++ [[ ! -s /home/dokku/myapp/ENV ]]
+++ local KEY=DOKKU_DOCKERFILE_PORTS
+++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/myapp/ENV
+++ sed -e 's/^'\''//' -e 's/'\''$//'
+++ cut -d= -f2-
+++ grep '^export DOKKU_DOCKERFILE_PORTS='
++ local DOCKERFILE_PORTS=80
++ for p in '$DOCKERFILE_PORTS'
++ [[ ! 80 =~ .*udp.* ]]
++ p=80
++ raw_tcp_ports+='80 '
+++ echo '80 '
+++ xargs
++ local raw_tcp_ports=80
++ echo 80
+ local RAW_TCP_PORTS=80
++ config_get myapp DOKKU_DISABLE_PROXY
++ declare 'desc=get value of given config var'
++ [[ myapp == \c\o\n\f\i\g\:\g\e\t ]]
++ set -- config:get myapp DOKKU_DISABLE_PROXY
++ config_parse_args config:get myapp DOKKU_DISABLE_PROXY
++ declare 'desc=parse config plugin args'
++ unset APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
++ for var in '"$@"'
++ [[ config:get == \-\-\g\l\o\b\a\l ]]
++ [[ config:get == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ config:get == \-\-\e\x\p\o\r\t ]]
++ [[ config:get == \-\-\s\h\e\l\l ]]
++ for var in '"$@"'
++ [[ myapp == \-\-\g\l\o\b\a\l ]]
++ [[ myapp == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ myapp == \-\-\e\x\p\o\r\t ]]
++ [[ myapp == \-\-\s\h\e\l\l ]]
++ for var in '"$@"'
++ [[ DOKKU_DISABLE_PROXY == \-\-\g\l\o\b\a\l ]]
++ [[ DOKKU_DISABLE_PROXY == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ DOKKU_DISABLE_PROXY == \-\-\e\x\p\o\r\t ]]
++ [[ DOKKU_DISABLE_PROXY == \-\-\s\h\e\l\l ]]
++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
+++ get_sanitized_config_args config:get myapp DOKKU_DISABLE_PROXY
+++ local 'desc=return sanitized arguments for config plugin'
+++ SANITIZED_ARGS=("$@")
+++ local SANITIZED_ARGS
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
+++ echo config:get myapp DOKKU_DISABLE_PROXY
++ local SANITIZED_ARGS
++ set -- config:get myapp DOKKU_DISABLE_PROXY
++ DOKKU_CONFIG_TYPE=app
++ DOKKU_CONFIG_RESTART=true
++ [[ app == \a\p\p ]]
++ [[ -z myapp ]]
++ verify_app_name myapp
++ declare 'desc=verify app name format and app existence'
++ local APP=myapp
++ [[ ! -n myapp ]]
++ [[ ! myapp =~ ^[a-z].* ]]
++ [[ ! -d /home/dokku/myapp ]]
++ return 0
++ APP=myapp
++ ENV_FILE=/home/dokku/myapp/ENV
++ export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
+++ get_sanitized_config_args config:get myapp DOKKU_DISABLE_PROXY
+++ local 'desc=return sanitized arguments for config plugin'
+++ SANITIZED_ARGS=("$@")
+++ local SANITIZED_ARGS
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
+++ echo config:get myapp DOKKU_DISABLE_PROXY
++ local SANITIZED_ARGS
++ set -- config:get myapp DOKKU_DISABLE_PROXY
++ [[ -z myapp ]]
++ config_create /home/dokku/myapp/ENV
++ declare 'desc=create config env file'
++ local ENV_FILE=/home/dokku/myapp/ENV
++ [[ -f /home/dokku/myapp/ENV ]]
++ [[ ! -s /home/dokku/myapp/ENV ]]
++ local KEY=DOKKU_DISABLE_PROXY
++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/myapp/ENV
++ sed -e 's/^'\''//' -e 's/'\''$//'
++ cut -d= -f2-
++ grep '^export DOKKU_DISABLE_PROXY='
+ local DOKKU_DISABLE_PROXY=
++ is_app_vhost_enabled myapp
++ 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=myapp
++ verify_app_name myapp
++ declare 'desc=verify app name format and app existence'
++ local APP=myapp
++ [[ ! -n myapp ]]
++ [[ ! myapp =~ ^[a-z].* ]]
++ [[ ! -d /home/dokku/myapp ]]
++ return 0
+++ config_get myapp NO_VHOST
+++ declare 'desc=get value of given config var'
+++ [[ myapp == \c\o\n\f\i\g\:\g\e\t ]]
+++ set -- config:get myapp NO_VHOST
+++ config_parse_args config:get myapp NO_VHOST
+++ declare 'desc=parse config plugin args'
+++ unset APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
+++ for var in '"$@"'
+++ [[ config:get == \-\-\g\l\o\b\a\l ]]
+++ [[ config:get == \-\-\n\o\-\r\e\s\t\a\r\t ]]
+++ [[ config:get == \-\-\e\x\p\o\r\t ]]
+++ [[ config:get == \-\-\s\h\e\l\l ]]
+++ for var in '"$@"'
+++ [[ myapp == \-\-\g\l\o\b\a\l ]]
+++ [[ myapp == \-\-\n\o\-\r\e\s\t\a\r\t ]]
+++ [[ myapp == \-\-\e\x\p\o\r\t ]]
+++ [[ myapp == \-\-\s\h\e\l\l ]]
+++ for var in '"$@"'
+++ [[ NO_VHOST == \-\-\g\l\o\b\a\l ]]
+++ [[ NO_VHOST == \-\-\n\o\-\r\e\s\t\a\r\t ]]
+++ [[ NO_VHOST == \-\-\e\x\p\o\r\t ]]
+++ [[ NO_VHOST == \-\-\s\h\e\l\l ]]
+++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
++++ get_sanitized_config_args config:get myapp NO_VHOST
++++ local 'desc=return sanitized arguments for config plugin'
++++ SANITIZED_ARGS=("$@")
++++ local SANITIZED_ARGS
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
++++ echo config:get myapp NO_VHOST
+++ local SANITIZED_ARGS
+++ set -- config:get myapp NO_VHOST
+++ DOKKU_CONFIG_TYPE=app
+++ DOKKU_CONFIG_RESTART=true
+++ [[ app == \a\p\p ]]
+++ [[ -z myapp ]]
+++ verify_app_name myapp
+++ declare 'desc=verify app name format and app existence'
+++ local APP=myapp
+++ [[ ! -n myapp ]]
+++ [[ ! myapp =~ ^[a-z].* ]]
+++ [[ ! -d /home/dokku/myapp ]]
+++ return 0
+++ APP=myapp
+++ ENV_FILE=/home/dokku/myapp/ENV
+++ export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
+++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
++++ get_sanitized_config_args config:get myapp NO_VHOST
++++ local 'desc=return sanitized arguments for config plugin'
++++ SANITIZED_ARGS=("$@")
++++ local SANITIZED_ARGS
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
++++ echo config:get myapp NO_VHOST
+++ local SANITIZED_ARGS
+++ set -- config:get myapp NO_VHOST
+++ [[ -z myapp ]]
+++ config_create /home/dokku/myapp/ENV
+++ declare 'desc=create config env file'
+++ local ENV_FILE=/home/dokku/myapp/ENV
+++ [[ -f /home/dokku/myapp/ENV ]]
+++ [[ ! -s /home/dokku/myapp/ENV ]]
+++ local KEY=NO_VHOST
+++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/myapp/ENV
+++ sed -e 's/^'\''//' -e 's/'\''$//'
+++ cut -d= -f2-
+++ grep '^export NO_VHOST='
++ local NO_VHOST=
++ local APP_VHOST_ENABLED=true
++ [[ '' == \1 ]]
++ echo true
+ local IS_APP_VHOST_ENABLED=true
+ [[ -z '' ]]
+ [[ -z '' ]]
+ [[ -z '' ]]
+ shopt -s nullglob
+ local DOKKU_APP_IP_FILE
+ for DOKKU_APP_IP_FILE in '$DOKKU_ROOT/$APP/IP.web.*'
+ local DOKKU_APP_PORT_FILE=/home/dokku/myapp/PORT.web.1
+ local DOKKU_APP_LISTENER_IP=172.17.0.4
+ local DOKKU_APP_LISTENER_PORT=80
+ local 'DOKKU_APP_LISTENERS+=172.17.0.4:80 '
++ echo '172.17.0.4:80 '
++ xargs
+ local DOKKU_APP_LISTENERS=172.17.0.4:80
+ shopt -u nullglob
+ configure_nginx_ports myapp
+ declare 'desc=configure nginx listening ports'
+ local APP=myapp
+ verify_app_name myapp
+ declare 'desc=verify app name format and app existence'
+ local APP=myapp
+ [[ ! -n myapp ]]
+ [[ ! myapp =~ ^[a-z].* ]]
+ [[ ! -d /home/dokku/myapp ]]
+ return 0
++ get_app_raw_tcp_ports myapp
++ 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=myapp
++ verify_app_name myapp
++ declare 'desc=verify app name format and app existence'
++ local APP=myapp
++ [[ ! -n myapp ]]
++ [[ ! myapp =~ ^[a-z].* ]]
++ [[ ! -d /home/dokku/myapp ]]
++ return 0
+++ config_get myapp DOKKU_DOCKERFILE_PORTS
+++ declare 'desc=get value of given config var'
+++ [[ myapp == \c\o\n\f\i\g\:\g\e\t ]]
+++ set -- config:get myapp DOKKU_DOCKERFILE_PORTS
+++ config_parse_args config:get myapp DOKKU_DOCKERFILE_PORTS
+++ declare 'desc=parse config plugin args'
+++ unset APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
+++ for var in '"$@"'
+++ [[ config:get == \-\-\g\l\o\b\a\l ]]
+++ [[ config:get == \-\-\n\o\-\r\e\s\t\a\r\t ]]
+++ [[ config:get == \-\-\e\x\p\o\r\t ]]
+++ [[ config:get == \-\-\s\h\e\l\l ]]
+++ for var in '"$@"'
+++ [[ myapp == \-\-\g\l\o\b\a\l ]]
+++ [[ myapp == \-\-\n\o\-\r\e\s\t\a\r\t ]]
+++ [[ myapp == \-\-\e\x\p\o\r\t ]]
+++ [[ myapp == \-\-\s\h\e\l\l ]]
+++ for var in '"$@"'
+++ [[ DOKKU_DOCKERFILE_PORTS == \-\-\g\l\o\b\a\l ]]
+++ [[ DOKKU_DOCKERFILE_PORTS == \-\-\n\o\-\r\e\s\t\a\r\t ]]
+++ [[ DOKKU_DOCKERFILE_PORTS == \-\-\e\x\p\o\r\t ]]
+++ [[ DOKKU_DOCKERFILE_PORTS == \-\-\s\h\e\l\l ]]
+++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
++++ get_sanitized_config_args config:get myapp DOKKU_DOCKERFILE_PORTS
++++ local 'desc=return sanitized arguments for config plugin'
++++ SANITIZED_ARGS=("$@")
++++ local SANITIZED_ARGS
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
++++ echo config:get myapp DOKKU_DOCKERFILE_PORTS
+++ local SANITIZED_ARGS
+++ set -- config:get myapp DOKKU_DOCKERFILE_PORTS
+++ DOKKU_CONFIG_TYPE=app
+++ DOKKU_CONFIG_RESTART=true
+++ [[ app == \a\p\p ]]
+++ [[ -z myapp ]]
+++ verify_app_name myapp
+++ declare 'desc=verify app name format and app existence'
+++ local APP=myapp
+++ [[ ! -n myapp ]]
+++ [[ ! myapp =~ ^[a-z].* ]]
+++ [[ ! -d /home/dokku/myapp ]]
+++ return 0
+++ APP=myapp
+++ ENV_FILE=/home/dokku/myapp/ENV
+++ export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
+++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
++++ get_sanitized_config_args config:get myapp DOKKU_DOCKERFILE_PORTS
++++ local 'desc=return sanitized arguments for config plugin'
++++ SANITIZED_ARGS=("$@")
++++ local SANITIZED_ARGS
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
++++ echo config:get myapp DOKKU_DOCKERFILE_PORTS
+++ local SANITIZED_ARGS
+++ set -- config:get myapp DOKKU_DOCKERFILE_PORTS
+++ [[ -z myapp ]]
+++ config_create /home/dokku/myapp/ENV
+++ declare 'desc=create config env file'
+++ local ENV_FILE=/home/dokku/myapp/ENV
+++ [[ -f /home/dokku/myapp/ENV ]]
+++ [[ ! -s /home/dokku/myapp/ENV ]]
+++ local KEY=DOKKU_DOCKERFILE_PORTS
+++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/myapp/ENV
+++ grep '^export DOKKU_DOCKERFILE_PORTS='
+++ sed -e 's/^'\''//' -e 's/'\''$//'
+++ cut -d= -f2-
++ local DOCKERFILE_PORTS=80
++ for p in '$DOCKERFILE_PORTS'
++ [[ ! 80 =~ .*udp.* ]]
++ p=80
++ raw_tcp_ports+='80 '
+++ echo '80 '
+++ xargs
++ local raw_tcp_ports=80
++ echo 80
+ local RAW_TCP_PORTS=80
++ config_get myapp DOKKU_NGINX_PORT
++ declare 'desc=get value of given config var'
++ [[ myapp == \c\o\n\f\i\g\:\g\e\t ]]
++ set -- config:get myapp DOKKU_NGINX_PORT
++ config_parse_args config:get myapp DOKKU_NGINX_PORT
++ declare 'desc=parse config plugin args'
++ unset APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
++ for var in '"$@"'
++ [[ config:get == \-\-\g\l\o\b\a\l ]]
++ [[ config:get == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ config:get == \-\-\e\x\p\o\r\t ]]
++ [[ config:get == \-\-\s\h\e\l\l ]]
++ for var in '"$@"'
++ [[ myapp == \-\-\g\l\o\b\a\l ]]
++ [[ myapp == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ myapp == \-\-\e\x\p\o\r\t ]]
++ [[ myapp == \-\-\s\h\e\l\l ]]
++ for var in '"$@"'
++ [[ DOKKU_NGINX_PORT == \-\-\g\l\o\b\a\l ]]
++ [[ DOKKU_NGINX_PORT == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ DOKKU_NGINX_PORT == \-\-\e\x\p\o\r\t ]]
++ [[ DOKKU_NGINX_PORT == \-\-\s\h\e\l\l ]]
++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
+++ get_sanitized_config_args config:get myapp DOKKU_NGINX_PORT
+++ local 'desc=return sanitized arguments for config plugin'
+++ SANITIZED_ARGS=("$@")
+++ local SANITIZED_ARGS
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
+++ echo config:get myapp DOKKU_NGINX_PORT
++ local SANITIZED_ARGS
++ set -- config:get myapp DOKKU_NGINX_PORT
++ DOKKU_CONFIG_TYPE=app
++ DOKKU_CONFIG_RESTART=true
++ [[ app == \a\p\p ]]
++ [[ -z myapp ]]
++ verify_app_name myapp
++ declare 'desc=verify app name format and app existence'
++ local APP=myapp
++ [[ ! -n myapp ]]
++ [[ ! myapp =~ ^[a-z].* ]]
++ [[ ! -d /home/dokku/myapp ]]
++ return 0
++ APP=myapp
++ ENV_FILE=/home/dokku/myapp/ENV
++ export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
+++ get_sanitized_config_args config:get myapp DOKKU_NGINX_PORT
+++ local 'desc=return sanitized arguments for config plugin'
+++ SANITIZED_ARGS=("$@")
+++ local SANITIZED_ARGS
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
+++ echo config:get myapp DOKKU_NGINX_PORT
++ local SANITIZED_ARGS
++ set -- config:get myapp DOKKU_NGINX_PORT
++ [[ -z myapp ]]
++ config_create /home/dokku/myapp/ENV
++ declare 'desc=create config env file'
++ local ENV_FILE=/home/dokku/myapp/ENV
++ [[ -f /home/dokku/myapp/ENV ]]
++ [[ ! -s /home/dokku/myapp/ENV ]]
++ local KEY=DOKKU_NGINX_PORT
++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/myapp/ENV
++ sed -e 's/^'\''//' -e 's/'\''$//'
++ cut -d= -f2-
++ grep '^export DOKKU_NGINX_PORT='
+ local DOKKU_NGINX_PORT=
++ config_get myapp DOKKU_NGINX_SSL_PORT
++ declare 'desc=get value of given config var'
++ [[ myapp == \c\o\n\f\i\g\:\g\e\t ]]
++ set -- config:get myapp DOKKU_NGINX_SSL_PORT
++ config_parse_args config:get myapp DOKKU_NGINX_SSL_PORT
++ declare 'desc=parse config plugin args'
++ unset APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
++ for var in '"$@"'
++ [[ config:get == \-\-\g\l\o\b\a\l ]]
++ [[ config:get == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ config:get == \-\-\e\x\p\o\r\t ]]
++ [[ config:get == \-\-\s\h\e\l\l ]]
++ for var in '"$@"'
++ [[ myapp == \-\-\g\l\o\b\a\l ]]
++ [[ myapp == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ myapp == \-\-\e\x\p\o\r\t ]]
++ [[ myapp == \-\-\s\h\e\l\l ]]
++ for var in '"$@"'
++ [[ DOKKU_NGINX_SSL_PORT == \-\-\g\l\o\b\a\l ]]
++ [[ DOKKU_NGINX_SSL_PORT == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ DOKKU_NGINX_SSL_PORT == \-\-\e\x\p\o\r\t ]]
++ [[ DOKKU_NGINX_SSL_PORT == \-\-\s\h\e\l\l ]]
++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
+++ get_sanitized_config_args config:get myapp DOKKU_NGINX_SSL_PORT
+++ local 'desc=return sanitized arguments for config plugin'
+++ SANITIZED_ARGS=("$@")
+++ local SANITIZED_ARGS
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
+++ echo config:get myapp DOKKU_NGINX_SSL_PORT
++ local SANITIZED_ARGS
++ set -- config:get myapp DOKKU_NGINX_SSL_PORT
++ DOKKU_CONFIG_TYPE=app
++ DOKKU_CONFIG_RESTART=true
++ [[ app == \a\p\p ]]
++ [[ -z myapp ]]
++ verify_app_name myapp
++ declare 'desc=verify app name format and app existence'
++ local APP=myapp
++ [[ ! -n myapp ]]
++ [[ ! myapp =~ ^[a-z].* ]]
++ [[ ! -d /home/dokku/myapp ]]
++ return 0
++ APP=myapp
++ ENV_FILE=/home/dokku/myapp/ENV
++ export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
+++ get_sanitized_config_args config:get myapp DOKKU_NGINX_SSL_PORT
+++ local 'desc=return sanitized arguments for config plugin'
+++ SANITIZED_ARGS=("$@")
+++ local SANITIZED_ARGS
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
+++ echo config:get myapp DOKKU_NGINX_SSL_PORT
++ local SANITIZED_ARGS
++ set -- config:get myapp DOKKU_NGINX_SSL_PORT
++ [[ -z myapp ]]
++ config_create /home/dokku/myapp/ENV
++ declare 'desc=create config env file'
++ local ENV_FILE=/home/dokku/myapp/ENV
++ [[ -f /home/dokku/myapp/ENV ]]
++ [[ ! -s /home/dokku/myapp/ENV ]]
++ local KEY=DOKKU_NGINX_SSL_PORT
++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/myapp/ENV
++ sed -e 's/^'\''//' -e 's/'\''$//'
++ cut -d= -f2-
++ grep '^export DOKKU_NGINX_SSL_PORT='
+ local DOKKU_NGINX_SSL_PORT=
++ config_get myapp DOKKU_PROXY_PORT_MAP
++ declare 'desc=get value of given config var'
++ [[ myapp == \c\o\n\f\i\g\:\g\e\t ]]
++ set -- config:get myapp DOKKU_PROXY_PORT_MAP
++ config_parse_args config:get myapp DOKKU_PROXY_PORT_MAP
++ declare 'desc=parse config plugin args'
++ unset APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
++ for var in '"$@"'
++ [[ config:get == \-\-\g\l\o\b\a\l ]]
++ [[ config:get == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ config:get == \-\-\e\x\p\o\r\t ]]
++ [[ config:get == \-\-\s\h\e\l\l ]]
++ for var in '"$@"'
++ [[ myapp == \-\-\g\l\o\b\a\l ]]
++ [[ myapp == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ myapp == \-\-\e\x\p\o\r\t ]]
++ [[ myapp == \-\-\s\h\e\l\l ]]
++ for var in '"$@"'
++ [[ DOKKU_PROXY_PORT_MAP == \-\-\g\l\o\b\a\l ]]
++ [[ DOKKU_PROXY_PORT_MAP == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ DOKKU_PROXY_PORT_MAP == \-\-\e\x\p\o\r\t ]]
++ [[ DOKKU_PROXY_PORT_MAP == \-\-\s\h\e\l\l ]]
++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
+++ get_sanitized_config_args config:get myapp DOKKU_PROXY_PORT_MAP
+++ local 'desc=return sanitized arguments for config plugin'
+++ SANITIZED_ARGS=("$@")
+++ local SANITIZED_ARGS
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
+++ echo config:get myapp DOKKU_PROXY_PORT_MAP
++ local SANITIZED_ARGS
++ set -- config:get myapp DOKKU_PROXY_PORT_MAP
++ DOKKU_CONFIG_TYPE=app
++ DOKKU_CONFIG_RESTART=true
++ [[ app == \a\p\p ]]
++ [[ -z myapp ]]
++ verify_app_name myapp
++ declare 'desc=verify app name format and app existence'
++ local APP=myapp
++ [[ ! -n myapp ]]
++ [[ ! myapp =~ ^[a-z].* ]]
++ [[ ! -d /home/dokku/myapp ]]
++ return 0
++ APP=myapp
++ ENV_FILE=/home/dokku/myapp/ENV
++ export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
+++ get_sanitized_config_args config:get myapp DOKKU_PROXY_PORT_MAP
+++ local 'desc=return sanitized arguments for config plugin'
+++ SANITIZED_ARGS=("$@")
+++ local SANITIZED_ARGS
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
+++ echo config:get myapp DOKKU_PROXY_PORT_MAP
++ local SANITIZED_ARGS
++ set -- config:get myapp DOKKU_PROXY_PORT_MAP
++ [[ -z myapp ]]
++ config_create /home/dokku/myapp/ENV
++ declare 'desc=create config env file'
++ local ENV_FILE=/home/dokku/myapp/ENV
++ [[ -f /home/dokku/myapp/ENV ]]
++ [[ ! -s /home/dokku/myapp/ENV ]]
++ local KEY=DOKKU_PROXY_PORT_MAP
++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/myapp/ENV
++ sed -e 's/^'\''//' -e 's/'\''$//'
++ cut -d= -f2-
++ grep '^export DOKKU_PROXY_PORT_MAP='
+ local 'DOKKU_PROXY_PORT_MAP=http:80:80 https:443:80'
++ is_app_vhost_enabled myapp
++ 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=myapp
++ verify_app_name myapp
++ declare 'desc=verify app name format and app existence'
++ local APP=myapp
++ [[ ! -n myapp ]]
++ [[ ! myapp =~ ^[a-z].* ]]
++ [[ ! -d /home/dokku/myapp ]]
++ return 0
+++ config_get myapp NO_VHOST
+++ declare 'desc=get value of given config var'
+++ [[ myapp == \c\o\n\f\i\g\:\g\e\t ]]
+++ set -- config:get myapp NO_VHOST
+++ config_parse_args config:get myapp NO_VHOST
+++ declare 'desc=parse config plugin args'
+++ unset APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
+++ for var in '"$@"'
+++ [[ config:get == \-\-\g\l\o\b\a\l ]]
+++ [[ config:get == \-\-\n\o\-\r\e\s\t\a\r\t ]]
+++ [[ config:get == \-\-\e\x\p\o\r\t ]]
+++ [[ config:get == \-\-\s\h\e\l\l ]]
+++ for var in '"$@"'
+++ [[ myapp == \-\-\g\l\o\b\a\l ]]
+++ [[ myapp == \-\-\n\o\-\r\e\s\t\a\r\t ]]
+++ [[ myapp == \-\-\e\x\p\o\r\t ]]
+++ [[ myapp == \-\-\s\h\e\l\l ]]
+++ for var in '"$@"'
+++ [[ NO_VHOST == \-\-\g\l\o\b\a\l ]]
+++ [[ NO_VHOST == \-\-\n\o\-\r\e\s\t\a\r\t ]]
+++ [[ NO_VHOST == \-\-\e\x\p\o\r\t ]]
+++ [[ NO_VHOST == \-\-\s\h\e\l\l ]]
+++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
++++ get_sanitized_config_args config:get myapp NO_VHOST
++++ local 'desc=return sanitized arguments for config plugin'
++++ SANITIZED_ARGS=("$@")
++++ local SANITIZED_ARGS
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
++++ echo config:get myapp NO_VHOST
+++ local SANITIZED_ARGS
+++ set -- config:get myapp NO_VHOST
+++ DOKKU_CONFIG_TYPE=app
+++ DOKKU_CONFIG_RESTART=true
+++ [[ app == \a\p\p ]]
+++ [[ -z myapp ]]
+++ verify_app_name myapp
+++ declare 'desc=verify app name format and app existence'
+++ local APP=myapp
+++ [[ ! -n myapp ]]
+++ [[ ! myapp =~ ^[a-z].* ]]
+++ [[ ! -d /home/dokku/myapp ]]
+++ return 0
+++ APP=myapp
+++ ENV_FILE=/home/dokku/myapp/ENV
+++ export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
+++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
++++ get_sanitized_config_args config:get myapp NO_VHOST
++++ local 'desc=return sanitized arguments for config plugin'
++++ SANITIZED_ARGS=("$@")
++++ local SANITIZED_ARGS
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
++++ echo config:get myapp NO_VHOST
+++ local SANITIZED_ARGS
+++ set -- config:get myapp NO_VHOST
+++ [[ -z myapp ]]
+++ config_create /home/dokku/myapp/ENV
+++ declare 'desc=create config env file'
+++ local ENV_FILE=/home/dokku/myapp/ENV
+++ [[ -f /home/dokku/myapp/ENV ]]
+++ [[ ! -s /home/dokku/myapp/ENV ]]
+++ local KEY=NO_VHOST
+++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/myapp/ENV
+++ sed -e 's/^'\''//' -e 's/'\''$//'
+++ cut -d= -f2-
+++ grep '^export NO_VHOST='
++ local NO_VHOST=
++ local APP_VHOST_ENABLED=true
++ [[ '' == \1 ]]
++ echo true
+ local IS_APP_VHOST_ENABLED=true
+ local UPSTREAM_PORT=5000
+ [[ -z '' ]]
+ [[ -z 80 ]]
+ [[ -z '' ]]
+ is_ssl_enabled myapp
+ declare 'desc=returns 0 if ssl is enabled for given app'
+ local APP=myapp
+ verify_app_name myapp
+ declare 'desc=verify app name format and app existence'
+ local APP=myapp
+ [[ ! -n myapp ]]
+ [[ ! myapp =~ ^[a-z].* ]]
+ [[ ! -d /home/dokku/myapp ]]
+ return 0
+ local APP_SSL_PATH=/home/dokku/myapp/tls
+ [[ -e /home/dokku/myapp/tls/server.crt ]]
+ [[ -e /home/dokku/myapp/tls/server.key ]]
+ return 0
+ [[ -z 80 ]]
+ [[ -z http:80:80 https:443:80 ]]
++ config_get myapp DOKKU_NGINX_PORT
++ declare 'desc=get value of given config var'
++ [[ myapp == \c\o\n\f\i\g\:\g\e\t ]]
++ set -- config:get myapp DOKKU_NGINX_PORT
++ config_parse_args config:get myapp DOKKU_NGINX_PORT
++ declare 'desc=parse config plugin args'
++ unset APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
++ for var in '"$@"'
++ [[ config:get == \-\-\g\l\o\b\a\l ]]
++ [[ config:get == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ config:get == \-\-\e\x\p\o\r\t ]]
++ [[ config:get == \-\-\s\h\e\l\l ]]
++ for var in '"$@"'
++ [[ myapp == \-\-\g\l\o\b\a\l ]]
++ [[ myapp == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ myapp == \-\-\e\x\p\o\r\t ]]
++ [[ myapp == \-\-\s\h\e\l\l ]]
++ for var in '"$@"'
++ [[ DOKKU_NGINX_PORT == \-\-\g\l\o\b\a\l ]]
++ [[ DOKKU_NGINX_PORT == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ DOKKU_NGINX_PORT == \-\-\e\x\p\o\r\t ]]
++ [[ DOKKU_NGINX_PORT == \-\-\s\h\e\l\l ]]
++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
+++ get_sanitized_config_args config:get myapp DOKKU_NGINX_PORT
+++ local 'desc=return sanitized arguments for config plugin'
+++ SANITIZED_ARGS=("$@")
+++ local SANITIZED_ARGS
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
+++ echo config:get myapp DOKKU_NGINX_PORT
++ local SANITIZED_ARGS
++ set -- config:get myapp DOKKU_NGINX_PORT
++ DOKKU_CONFIG_TYPE=app
++ DOKKU_CONFIG_RESTART=true
++ [[ app == \a\p\p ]]
++ [[ -z myapp ]]
++ verify_app_name myapp
++ declare 'desc=verify app name format and app existence'
++ local APP=myapp
++ [[ ! -n myapp ]]
++ [[ ! myapp =~ ^[a-z].* ]]
++ [[ ! -d /home/dokku/myapp ]]
++ return 0
++ APP=myapp
++ ENV_FILE=/home/dokku/myapp/ENV
++ export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
+++ get_sanitized_config_args config:get myapp DOKKU_NGINX_PORT
+++ local 'desc=return sanitized arguments for config plugin'
+++ SANITIZED_ARGS=("$@")
+++ local SANITIZED_ARGS
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
+++ echo config:get myapp DOKKU_NGINX_PORT
++ local SANITIZED_ARGS
++ set -- config:get myapp DOKKU_NGINX_PORT
++ [[ -z myapp ]]
++ config_create /home/dokku/myapp/ENV
++ declare 'desc=create config env file'
++ local ENV_FILE=/home/dokku/myapp/ENV
++ [[ -f /home/dokku/myapp/ENV ]]
++ [[ ! -s /home/dokku/myapp/ENV ]]
++ local KEY=DOKKU_NGINX_PORT
++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/myapp/ENV
++ grep '^export DOKKU_NGINX_PORT='
++ sed -e 's/^'\''//' -e 's/'\''$//'
++ cut -d= -f2-
+ local NGINX_PORT=
++ config_get myapp DOKKU_NGINX_SSL_PORT
++ declare 'desc=get value of given config var'
++ [[ myapp == \c\o\n\f\i\g\:\g\e\t ]]
++ set -- config:get myapp DOKKU_NGINX_SSL_PORT
++ config_parse_args config:get myapp DOKKU_NGINX_SSL_PORT
++ declare 'desc=parse config plugin args'
++ unset APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
++ for var in '"$@"'
++ [[ config:get == \-\-\g\l\o\b\a\l ]]
++ [[ config:get == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ config:get == \-\-\e\x\p\o\r\t ]]
++ [[ config:get == \-\-\s\h\e\l\l ]]
++ for var in '"$@"'
++ [[ myapp == \-\-\g\l\o\b\a\l ]]
++ [[ myapp == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ myapp == \-\-\e\x\p\o\r\t ]]
++ [[ myapp == \-\-\s\h\e\l\l ]]
++ for var in '"$@"'
++ [[ DOKKU_NGINX_SSL_PORT == \-\-\g\l\o\b\a\l ]]
++ [[ DOKKU_NGINX_SSL_PORT == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ DOKKU_NGINX_SSL_PORT == \-\-\e\x\p\o\r\t ]]
++ [[ DOKKU_NGINX_SSL_PORT == \-\-\s\h\e\l\l ]]
++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
+++ get_sanitized_config_args config:get myapp DOKKU_NGINX_SSL_PORT
+++ local 'desc=return sanitized arguments for config plugin'
+++ SANITIZED_ARGS=("$@")
+++ local SANITIZED_ARGS
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
+++ echo config:get myapp DOKKU_NGINX_SSL_PORT
++ local SANITIZED_ARGS
++ set -- config:get myapp DOKKU_NGINX_SSL_PORT
++ DOKKU_CONFIG_TYPE=app
++ DOKKU_CONFIG_RESTART=true
++ [[ app == \a\p\p ]]
++ [[ -z myapp ]]
++ verify_app_name myapp
++ declare 'desc=verify app name format and app existence'
++ local APP=myapp
++ [[ ! -n myapp ]]
++ [[ ! myapp =~ ^[a-z].* ]]
++ [[ ! -d /home/dokku/myapp ]]
++ return 0
++ APP=myapp
++ ENV_FILE=/home/dokku/myapp/ENV
++ export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
+++ get_sanitized_config_args config:get myapp DOKKU_NGINX_SSL_PORT
+++ local 'desc=return sanitized arguments for config plugin'
+++ SANITIZED_ARGS=("$@")
+++ local SANITIZED_ARGS
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
+++ echo config:get myapp DOKKU_NGINX_SSL_PORT
++ local SANITIZED_ARGS
++ set -- config:get myapp DOKKU_NGINX_SSL_PORT
++ [[ -z myapp ]]
++ config_create /home/dokku/myapp/ENV
++ declare 'desc=create config env file'
++ local ENV_FILE=/home/dokku/myapp/ENV
++ [[ -f /home/dokku/myapp/ENV ]]
++ [[ ! -s /home/dokku/myapp/ENV ]]
++ local KEY=DOKKU_NGINX_SSL_PORT
++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/myapp/ENV
++ sed -e 's/^'\''//' -e 's/'\''$//'
++ cut -d= -f2-
++ grep '^export DOKKU_NGINX_SSL_PORT='
+ local NGINX_SSL_PORT=
++ config_get myapp DOKKU_PROXY_PORT_MAP
++ declare 'desc=get value of given config var'
++ [[ myapp == \c\o\n\f\i\g\:\g\e\t ]]
++ set -- config:get myapp DOKKU_PROXY_PORT_MAP
++ config_parse_args config:get myapp DOKKU_PROXY_PORT_MAP
++ declare 'desc=parse config plugin args'
++ unset APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
++ for var in '"$@"'
++ [[ config:get == \-\-\g\l\o\b\a\l ]]
++ [[ config:get == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ config:get == \-\-\e\x\p\o\r\t ]]
++ [[ config:get == \-\-\s\h\e\l\l ]]
++ for var in '"$@"'
++ [[ myapp == \-\-\g\l\o\b\a\l ]]
++ [[ myapp == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ myapp == \-\-\e\x\p\o\r\t ]]
++ [[ myapp == \-\-\s\h\e\l\l ]]
++ for var in '"$@"'
++ [[ DOKKU_PROXY_PORT_MAP == \-\-\g\l\o\b\a\l ]]
++ [[ DOKKU_PROXY_PORT_MAP == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ DOKKU_PROXY_PORT_MAP == \-\-\e\x\p\o\r\t ]]
++ [[ DOKKU_PROXY_PORT_MAP == \-\-\s\h\e\l\l ]]
++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
+++ get_sanitized_config_args config:get myapp DOKKU_PROXY_PORT_MAP
+++ local 'desc=return sanitized arguments for config plugin'
+++ SANITIZED_ARGS=("$@")
+++ local SANITIZED_ARGS
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
+++ echo config:get myapp DOKKU_PROXY_PORT_MAP
++ local SANITIZED_ARGS
++ set -- config:get myapp DOKKU_PROXY_PORT_MAP
++ DOKKU_CONFIG_TYPE=app
++ DOKKU_CONFIG_RESTART=true
++ [[ app == \a\p\p ]]
++ [[ -z myapp ]]
++ verify_app_name myapp
++ declare 'desc=verify app name format and app existence'
++ local APP=myapp
++ [[ ! -n myapp ]]
++ [[ ! myapp =~ ^[a-z].* ]]
++ [[ ! -d /home/dokku/myapp ]]
++ return 0
++ APP=myapp
++ ENV_FILE=/home/dokku/myapp/ENV
++ export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
+++ get_sanitized_config_args config:get myapp DOKKU_PROXY_PORT_MAP
+++ local 'desc=return sanitized arguments for config plugin'
+++ SANITIZED_ARGS=("$@")
+++ local SANITIZED_ARGS
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
+++ echo config:get myapp DOKKU_PROXY_PORT_MAP
++ local SANITIZED_ARGS
++ set -- config:get myapp DOKKU_PROXY_PORT_MAP
++ [[ -z myapp ]]
++ config_create /home/dokku/myapp/ENV
++ declare 'desc=create config env file'
++ local ENV_FILE=/home/dokku/myapp/ENV
++ [[ -f /home/dokku/myapp/ENV ]]
++ [[ ! -s /home/dokku/myapp/ENV ]]
++ local KEY=DOKKU_PROXY_PORT_MAP
++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/myapp/ENV
++ grep '^export DOKKU_PROXY_PORT_MAP='
++ sed -e 's/^'\''//' -e 's/'\''$//'
++ cut -d= -f2-
+ local 'PROXY_PORT_MAP=http:80:80 https:443:80'
+ local PORT_MAP
+ for PORT_MAP in '$PROXY_PORT_MAP'
++ awk -F : '{ print $3 }'
+ local PROXY_UPSTREAM_PORT=80
++ is_val_in_list 80 '' ' '
++ declare 'desc=return true if value (80) is in list () separated by delimiter ( ); delimiter defaults to comma'
++ local value=80 list= 'delimiter= '
++ local 'IFS= ' val_in_list=false
++ echo false
+ [[ false == \f\a\l\s\e ]]
+ local 'PROXY_UPSTREAM_PORTS+=80 '
+ for PORT_MAP in '$PROXY_PORT_MAP'
++ awk -F : '{ print $3 }'
+ local PROXY_UPSTREAM_PORT=80
++ is_val_in_list 80 '80 ' ' '
++ declare 'desc=return true if value (80) is in list (80 ) separated by delimiter ( ); delimiter defaults to comma'
++ local value=80 'list=80 ' 'delimiter= '
++ local 'IFS= ' val_in_list=false
++ for val in '$list'
++ [[ 80 == \8\0 ]]
++ val_in_list=true
++ echo true
+ [[ true == \f\a\l\s\e ]]
++ echo '80 '
++ xargs
+ local PROXY_UPSTREAM_PORTS=80
++ mktemp -d /tmp/dokku_nginx_template.XXXXX
+ local NGINX_BUILD_CONFIG_TMP_WORK_DIR=/tmp/dokku_nginx_template.IPx2u
++ mktemp --tmpdir=/tmp/dokku_nginx_template.IPx2u nginx.conf.XXXXXX
+ local NGINX_CONF=/tmp/dokku_nginx_template.IPx2u/nginx.conf.iR4dPq
+ local CUSTOM_NGINX_TEMPLATE=/tmp/dokku_nginx_template.IPx2u/nginx.conf.sigil
+ trap 'rm -rf $NGINX_CONF $NGINX_BUILD_CONFIG_TMP_WORK_DIR > /dev/null' RETURN INT TERM EXIT
+ get_custom_nginx_template myapp /tmp/dokku_nginx_template.IPx2u/nginx.conf.sigil
+ declare 'desc=attempts to copy custom nginx template from app image'
+ local APP=myapp
+ verify_app_name myapp
+ declare 'desc=verify app name format and app existence'
+ local APP=myapp
+ [[ ! -n myapp ]]
+ [[ ! myapp =~ ^[a-z].* ]]
+ [[ ! -d /home/dokku/myapp ]]
+ return 0
+ local DESTINATION=/tmp/dokku_nginx_template.IPx2u/nginx.conf.sigil
++ get_running_image_tag myapp
++ declare 'desc=retrieve current image tag for a given app. returns empty string if no deployed containers are found'
++ local APP=myapp
++ [[ ! -n myapp ]]
++ verify_app_name myapp
++ declare 'desc=verify app name format and app existence'
++ local APP=myapp
++ [[ ! -n myapp ]]
++ [[ ! myapp =~ ^[a-z].* ]]
++ [[ ! -d /home/dokku/myapp ]]
++ return 0
++ CIDS=($(get_app_container_ids "$APP"))
+++ get_app_container_ids myapp
+++ declare 'desc=returns list of docker container ids for given app and optional container_type'
+++ local APP=myapp
+++ local CONTAINER_TYPE=
+++ verify_app_name myapp
+++ declare 'desc=verify app name format and app existence'
+++ local APP=myapp
+++ [[ ! -n myapp ]]
+++ [[ ! myapp =~ ^[a-z].* ]]
+++ [[ ! -d /home/dokku/myapp ]]
+++ return 0
+++ [[ -f /home/dokku/myapp/CONTAINER ]]
+++ [[ -n '' ]]
+++ local 'CONTAINER_PATTERN=/home/dokku/myapp/CONTAINER.*'
+++ shopt -s nullglob
+++ local DOKKU_CID_FILE
+++ for DOKKU_CID_FILE in '$CONTAINER_PATTERN'
+++ local 'DOKKU_CIDS+= '
+++ local DOKKU_CIDS+=06684724c7ad92144541cce7a33c8c683abe2f7cf6a913473db285d8e3fb4432
+++ local 'DOKKU_CIDS+= '
+++ shopt -u nullglob
+++ echo ' 06684724c7ad92144541cce7a33c8c683abe2f7cf6a913473db285d8e3fb4432 '
++ local CIDS
+++ docker inspect -f '{{ .Config.Image }}' 06684724c7ad92144541cce7a33c8c683abe2f7cf6a913473db285d8e3fb4432
+++ awk -F: '{ print $2 }'
++ local RUNNING_IMAGE_TAG=latest
++ echo latest
+ local IMAGE_TAG=latest
++ get_app_image_name myapp latest
++ declare 'desc=return image identifier for a given app, tag tuple. validate if tag is presented'
++ local APP=myapp
++ local IMAGE_TAG=latest
++ IMAGE_REPO=
++ [[ -z myapp ]]
++ [[ -z '' ]]
+++ get_app_image_repo myapp
+++ declare 'desc=central definition of image repo pattern'
+++ local APP=myapp
+++ local IMAGE_REPO=dokku/myapp
+++ [[ -z myapp ]]
+++ echo dokku/myapp
++ IMAGE_REPO=dokku/myapp
++ [[ -n latest ]]
++ local IMAGE=dokku/myapp:latest
++ verify_image dokku/myapp:latest
++ declare 'desc=verify image existence'
++ local IMAGE=dokku/myapp:latest
++ docker inspect dokku/myapp:latest
++ return 0
++ echo dokku/myapp:latest
+ local IMAGE=dokku/myapp:latest
+ local NGINX_TEMPLATE_NAME=nginx.conf.sigil
+ copy_from_image dokku/myapp:latest nginx.conf.sigil /tmp/dokku_nginx_template.IPx2u/nginx.conf.sigil
+ [[ -f /tmp/dokku_nginx_template.IPx2u/nginx.conf.sigil ]]
++ get_app_domains myapp
++ declare 'desc=return app domains'
++ verify_app_name myapp
++ declare 'desc=verify app name format and app existence'
++ local APP=myapp
++ [[ ! -n myapp ]]
++ [[ ! myapp =~ ^[a-z].* ]]
++ [[ ! -d /home/dokku/myapp ]]
++ return 0
++ local APP=myapp
++ local APP_VHOST_FILE=/home/dokku/myapp/VHOST
++ local GLOBAL_VHOST_PATH=/home/dokku/VHOST
++ local GLOBAL_HOSTNAME_PATH=/home/dokku/HOSTNAME
+++ is_app_vhost_enabled myapp
+++ 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=myapp
+++ verify_app_name myapp
+++ declare 'desc=verify app name format and app existence'
+++ local APP=myapp
+++ [[ ! -n myapp ]]
+++ [[ ! myapp =~ ^[a-z].* ]]
+++ [[ ! -d /home/dokku/myapp ]]
+++ return 0
++++ config_get myapp NO_VHOST
++++ declare 'desc=get value of given config var'
++++ [[ myapp == \c\o\n\f\i\g\:\g\e\t ]]
++++ set -- config:get myapp NO_VHOST
++++ config_parse_args config:get myapp NO_VHOST
++++ declare 'desc=parse config plugin args'
++++ unset APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
++++ for var in '"$@"'
++++ [[ config:get == \-\-\g\l\o\b\a\l ]]
++++ [[ config:get == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++++ [[ config:get == \-\-\e\x\p\o\r\t ]]
++++ [[ config:get == \-\-\s\h\e\l\l ]]
++++ for var in '"$@"'
++++ [[ myapp == \-\-\g\l\o\b\a\l ]]
++++ [[ myapp == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++++ [[ myapp == \-\-\e\x\p\o\r\t ]]
++++ [[ myapp == \-\-\s\h\e\l\l ]]
++++ for var in '"$@"'
++++ [[ NO_VHOST == \-\-\g\l\o\b\a\l ]]
++++ [[ NO_VHOST == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++++ [[ NO_VHOST == \-\-\e\x\p\o\r\t ]]
++++ [[ NO_VHOST == \-\-\s\h\e\l\l ]]
++++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
+++++ get_sanitized_config_args config:get myapp NO_VHOST
+++++ local 'desc=return sanitized arguments for config plugin'
+++++ SANITIZED_ARGS=("$@")
+++++ local SANITIZED_ARGS
+++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
+++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
+++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
+++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
+++++ echo config:get myapp NO_VHOST
++++ local SANITIZED_ARGS
++++ set -- config:get myapp NO_VHOST
++++ DOKKU_CONFIG_TYPE=app
++++ DOKKU_CONFIG_RESTART=true
++++ [[ app == \a\p\p ]]
++++ [[ -z myapp ]]
++++ verify_app_name myapp
++++ declare 'desc=verify app name format and app existence'
++++ local APP=myapp
++++ [[ ! -n myapp ]]
++++ [[ ! myapp =~ ^[a-z].* ]]
++++ [[ ! -d /home/dokku/myapp ]]
++++ return 0
++++ APP=myapp
++++ ENV_FILE=/home/dokku/myapp/ENV
++++ export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
++++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
+++++ get_sanitized_config_args config:get myapp NO_VHOST
+++++ local 'desc=return sanitized arguments for config plugin'
+++++ SANITIZED_ARGS=("$@")
+++++ local SANITIZED_ARGS
+++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
+++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
+++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
+++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
+++++ echo config:get myapp NO_VHOST
++++ local SANITIZED_ARGS
++++ set -- config:get myapp NO_VHOST
++++ [[ -z myapp ]]
++++ config_create /home/dokku/myapp/ENV
++++ declare 'desc=create config env file'
++++ local ENV_FILE=/home/dokku/myapp/ENV
++++ [[ -f /home/dokku/myapp/ENV ]]
++++ [[ ! -s /home/dokku/myapp/ENV ]]
++++ local KEY=NO_VHOST
++++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/myapp/ENV
++++ sed -e 's/^'\''//' -e 's/'\''$//'
++++ cut -d= -f2-
++++ grep '^export NO_VHOST='
+++ local NO_VHOST=
+++ local APP_VHOST_ENABLED=true
+++ [[ '' == \1 ]]
+++ echo true
++ [[ true == \t\r\u\e ]]
++ [[ -f /home/dokku/myapp/VHOST ]]
++ cat /home/dokku/myapp/VHOST
+ local 'NONSSL_VHOSTS=myapp.com
www.myapp.com'
++ echo 'myapp.com
www.myapp.com'
++ xargs
+ local 'NOSSL_SERVER_NAME=myapp.com www.myapp.com'
+ is_ssl_enabled myapp
+ declare 'desc=returns 0 if ssl is enabled for given app'
+ local APP=myapp
+ verify_app_name myapp
+ declare 'desc=verify app name format and app existence'
+ local APP=myapp
+ [[ ! -n myapp ]]
+ [[ ! myapp =~ ^[a-z].* ]]
+ [[ ! -d /home/dokku/myapp ]]
+ return 0
+ local APP_SSL_PATH=/home/dokku/myapp/tls
+ [[ -e /home/dokku/myapp/tls/server.crt ]]
+ [[ -e /home/dokku/myapp/tls/server.key ]]
+ return 0
+ local SSL_INUSE=true
+ local SCHEME=https
+ validate_ssl_domains myapp
+ declare 'desc=check configured domains against SSL cert contents and show warning if mismatched'
+ local APP=myapp
+ verify_app_name myapp
+ declare 'desc=verify app name format and app existence'
+ local APP=myapp
+ [[ ! -n myapp ]]
+ [[ ! myapp =~ ^[a-z].* ]]
+ [[ ! -d /home/dokku/myapp ]]
+ return 0
++ get_ssl_hostnames myapp
++ declare 'desc=returns a string of ssl hostnames extracted from an app'\''s ssl certificate'
++ local APP=myapp
++ verify_app_name myapp
++ declare 'desc=verify app name format and app existence'
++ local APP=myapp
++ [[ ! -n myapp ]]
++ [[ ! myapp =~ ^[a-z].* ]]
++ [[ ! -d /home/dokku/myapp ]]
++ return 0
++ local SSL_PATH=/home/dokku/myapp/tls
+++ openssl x509 -in /home/dokku/myapp/tls/server.crt -noout -subject
+++ cut -c4-
+++ grep CN=
+++ tr / '\n'
++ local SSL_HOSTNAME=myapp.com
+++ openssl x509 -in /home/dokku/myapp/tls/server.crt -noout -text
+++ grep --after-context=1 '509v3 Subject Alternative Name:'
+++ tail -n 1
+++ sed -e 's/[[:space:]]*DNS://g'
+++ tr , '\n'
++ local 'SSL_HOSTNAME_ALT=myapp.com
www.myapp.com'
++ [[ -n myapp.com
www.myapp.com ]]
++ local 'SSL_HOSTNAMES=myapp.com\nmyapp.com
www.myapp.com'
++ echo -e 'myapp.com\nmyapp.com
www.myapp.com'
++ return 0
+ local 'SSL_HOSTNAME=myapp.com
myapp.com
www.myapp.com'
++ echo 'myapp.com
myapp.com
www.myapp.com'
++ sed 's/\*/\[^\.\]\*/g'
++ sed 's/ /|/g'
++ sed 's|\.|\\.|g'
++ xargs
+ local 'SSL_HOSTNAME_REGEX=myapp\.com|myapp\.com|www\.myapp\.com'
+ egrep -q '^myapp\.com|myapp\.com|www\.myapp\.com$' /home/dokku/myapp/VHOST
++ get_ssl_hostnames myapp
++ declare 'desc=returns a string of ssl hostnames extracted from an app'\''s ssl certificate'
++ local APP=myapp
++ verify_app_name myapp
++ declare 'desc=verify app name format and app existence'
++ local APP=myapp
++ [[ ! -n myapp ]]
++ [[ ! myapp =~ ^[a-z].* ]]
++ [[ ! -d /home/dokku/myapp ]]
++ return 0
++ local SSL_PATH=/home/dokku/myapp/tls
+++ openssl x509 -in /home/dokku/myapp/tls/server.crt -noout -subject
+++ grep CN=
+++ cut -c4-
+++ tr / '\n'
++ local SSL_HOSTNAME=myapp.com
+++ openssl x509 -in /home/dokku/myapp/tls/server.crt -noout -text
+++ grep --after-context=1 '509v3 Subject Alternative Name:'
+++ sed -e 's/[[:space:]]*DNS://g'
+++ tr , '\n'
+++ tail -n 1
++ local 'SSL_HOSTNAME_ALT=myapp.com
www.myapp.com'
++ [[ -n myapp.com
www.myapp.com ]]
++ local 'SSL_HOSTNAMES=myapp.com\nmyapp.com
www.myapp.com'
++ echo -e 'myapp.com\nmyapp.com
www.myapp.com'
++ return 0
+ local 'SSL_HOSTNAME=myapp.com
myapp.com
www.myapp.com'
++ echo 'myapp.com
myapp.com
www.myapp.com'
++ sed 's|\.|\\.|g'
++ sed 's/ /|/g'
++ xargs
++ sed 's/\*/\[^\.\]\*/g'
+ local 'SSL_HOSTNAME_REGEX=myapp\.com|myapp\.com|www\.myapp\.com'
+ [[ true == \t\r\u\e ]]
++ egrep '^myapp\.com|myapp\.com|www\.myapp\.com$' /home/dokku/myapp/VHOST
+ local 'SSL_VHOSTS=myapp.com
www.myapp.com'
++ echo 'myapp.com
www.myapp.com'
++ xargs
+ local 'SSL_SERVER_NAME=myapp.com www.myapp.com'
++ nginx -v
++ cut -d/ -f 2
+ local 'NGINX_VERSION=1.10.0 (Ubuntu)'
++ is_spdy_enabled '1.10.0 (Ubuntu)'
++ declare 'desc=detects whether the installed nginx version has spdy or http2 support'
++ local 'NGINX_VERSION=1.10.0 (Ubuntu)'
++ local MAJOR_VERSION MINOR_VERSION PATCH_VERSION
++ local HAS_SUPPORT=true
++ which nginx
+++ echo '1.10.0 (Ubuntu)'
+++ awk '{split($0,a,"."); print a[1]}'
++ MAJOR_VERSION=1
+++ echo '1.10.0 (Ubuntu)'
+++ awk '{split($0,a,"."); print a[2]}'
++ MINOR_VERSION=10
+++ echo '1.10.0 (Ubuntu)'
+++ awk '{split($0,a,"."); print a[3]}'
++ PATCH_VERSION='0 (Ubuntu)'
++ [[ 1 -ge 2 ]]
++ [[ 1 -eq 1 ]]
++ [[ 10 -ge 10 ]]
++ HAS_SUPPORT=false
++ echo false
+ local SPDY_SUPPORTED=false
++ config_export app myapp
++ declare 'desc=returns export command for config variable of specified type (app/global)'
++ local CONFIG_TYPE=app
++ local APP=myapp
++ local ENV_FILE=/home/dokku/myapp/ENV
++ [[ app == \g\l\o\b\a\l ]]
++ [[ ! -f /home/dokku/myapp/ENV ]]
++ [[ ! -s /home/dokku/myapp/ENV ]]
+++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/myapp/ENV
+++ cut '-d ' -f2-
++ local 'VARS=ALLOWED_HOSTS='\''myapp.com'\''
DATABASE_URL='\''postgres://postgres:604c8498dd80783da0fdb09fdadbcb29@dokku-postgres-myapp:5432/myapp'\''
DOKKU_APP_RESTORE='\''1'\''
DOKKU_APP_TYPE='\''dockerfile'\''
DOKKU_DOCKERFILE_CMD='\''CMD /app/docker/entrypoint.sh'\''
DOKKU_DOCKERFILE_PORTS='\''80'\''
DOKKU_PROXY_PORT_MAP='\''http:80:80 https:443:80'\''
RETHINKDB_URL='\''rethinkdb://dokku-rethinkdb-myapp:28015'\''
SECRET_KEY='\''976DhtFYxlLHeIodF1nI2IzFAr8CWJT8wTYCFdxuYe6if3L1fb'\''
SENTRY_DSN='\''https://a4e4e9c4cc224cccacc0b30af8bd957a:[email protected]/22'\'''
++ echo 'ALLOWED_HOSTS='\''myapp.com'\''
DATABASE_URL='\''postgres://postgres:604c8498dd80783da0fdb09fdadbcb29@dokku-postgres-myapp:5432/myapp'\''
DOKKU_APP_RESTORE='\''1'\''
DOKKU_APP_TYPE='\''dockerfile'\''
DOKKU_DOCKERFILE_CMD='\''CMD /app/docker/entrypoint.sh'\''
DOKKU_DOCKERFILE_PORTS='\''80'\''
DOKKU_PROXY_PORT_MAP='\''http:80:80 https:443:80'\''
RETHINKDB_URL='\''rethinkdb://dokku-rethinkdb-myapp:28015'\''
SECRET_KEY='\''976DhtFYxlLHeIodF1nI2IzFAr8CWJT8wTYCFdxuYe6if3L1fb'\''
SENTRY_DSN='\''https://a4e4e9c4cc224cccacc0b30af8bd957a:[email protected]/22'\'''
++ awk '{print "export " $0}'
++ return 0
+ eval 'export ALLOWED_HOSTS='\''myapp.com'\''
export DATABASE_URL='\''postgres://postgres:604c8498dd80783da0fdb09fdadbcb29@dokku-postgres-myapp:5432/myapp'\''
export DOKKU_APP_RESTORE='\''1'\''
export DOKKU_APP_TYPE='\''dockerfile'\''
export DOKKU_DOCKERFILE_CMD='\''CMD /app/docker/entrypoint.sh'\''
export DOKKU_DOCKERFILE_PORTS='\''80'\''
export DOKKU_PROXY_PORT_MAP='\''http:80:80 https:443:80'\''
export RETHINKDB_URL='\''rethinkdb://dokku-rethinkdb-myapp:28015'\''
export SECRET_KEY='\''976DhtFYxlLHeIodF1nI2IzFAr8CWJT8wTYCFdxuYe6if3L1fb'\''
export SENTRY_DSN='\''https://a4e4e9c4cc224cccacc0b30af8bd957a:[email protected]/22'\'''
++ export ALLOWED_HOSTS=myapp.com
++ ALLOWED_HOSTS=myapp.com
++ export DATABASE_URL=postgres://postgres:604c8498dd80783da0fdb09fdadbcb29@dokku-postgres-myapp:5432/myapp
++ DATABASE_URL=postgres://postgres:604c8498dd80783da0fdb09fdadbcb29@dokku-postgres-myapp:5432/myapp
++ export DOKKU_APP_RESTORE=1
++ DOKKU_APP_RESTORE=1
++ export DOKKU_APP_TYPE=dockerfile
++ DOKKU_APP_TYPE=dockerfile
++ export 'DOKKU_DOCKERFILE_CMD=CMD /app/docker/entrypoint.sh'
++ DOKKU_DOCKERFILE_CMD='CMD /app/docker/entrypoint.sh'
++ export DOKKU_DOCKERFILE_PORTS=80
++ DOKKU_DOCKERFILE_PORTS=80
++ export 'DOKKU_PROXY_PORT_MAP=http:80:80 https:443:80'
++ DOKKU_PROXY_PORT_MAP='http:80:80 https:443:80'
++ export RETHINKDB_URL=rethinkdb://dokku-rethinkdb-myapp:28015
++ RETHINKDB_URL=rethinkdb://dokku-rethinkdb-myapp:28015
++ export SECRET_KEY=976DhtFYxlLHeIodF1nI2IzFAr8CWJT8wTYCFdxuYe6if3L1fb
++ SECRET_KEY=976DhtFYxlLHeIodF1nI2IzFAr8CWJT8wTYCFdxuYe6if3L1fb
++ export SENTRY_DSN=https://a4e4e9c4cc224cccacc0b30af8bd957a:[email protected]/22
++ SENTRY_DSN=https://a4e4e9c4cc224cccacc0b30af8bd957a:[email protected]/22
+ SIGIL_PARAMS=(-f $NGINX_TEMPLATE APP="$APP" DOKKU_ROOT="$DOKKU_ROOT" NOSSL_SERVER_NAME="$NOSSL_SERVER_NAME" DOKKU_APP_LISTENERS="$DOKKU_APP_LISTENERS" PASSED_LISTEN_IP_PORT="$PASSED_LISTEN_IP_PORT" SPDY_SUPPORTED="$SPDY_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 'myapp.com
www.myapp.com' 'myapp.com
www.myapp.com'
++ tr ' ' '\n'
++ sort -u
-----> Configuring myapp.com...(using built-in template)
-----> Configuring www.myapp.com...(using built-in template)
+ sigil -f /var/lib/dokku/plugins/available/nginx-vhosts/templates/nginx.conf.sigil APP=myapp DOKKU_ROOT=/home/dokku 'NOSSL_SERVER_NAME=myapp.com www.myapp.com' DOKKU_APP_LISTENERS=172.17.0.4:80 PASSED_LISTEN_IP_PORT= SPDY_SUPPORTED=false DOKKU_APP_LISTEN_PORT= DOKKU_APP_LISTEN_IP= APP_SSL_PATH=/home/dokku/myapp/tls SSL_INUSE=true 'SSL_SERVER_NAME=myapp.com www.myapp.com' NGINX_PORT= NGINX_SSL_PORT= RAW_TCP_PORTS=80 'PROXY_PORT_MAP=http:80:80 https:443:80' PROXY_UPSTREAM_PORTS=80
+ cat -s
+ is_deployed myapp
+ declare 'desc=return 0 if given app has a running container'
+ local APP=myapp
+ [[ -f /home/dokku/myapp/CONTAINER ]]
++ ls /home/dokku/myapp/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.IPx2u/nginx.conf.iR4dPq /home/dokku/myapp/nginx.conf
+ is_deployed myapp
+ declare 'desc=return 0 if given app has a running container'
+ local APP=myapp
+ [[ -f /home/dokku/myapp/CONTAINER ]]
++ ls /home/dokku/myapp/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 myapp '' ''
+ 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/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 myapp '' ''
+ declare 'desc=add nginx redirect servers'
+ local trigger=redirect_nginx_pre_load_trigger
+ local APP=myapp
+ local APP_ROOT=/home/dokku/myapp
+ local REDIRECT_FILE=/home/dokku/myapp/REDIRECTS
+ [[ ! -s /home/dokku/myapp/REDIRECTS ]]
++ get_app_proxy_type myapp
++ declare 'desc=return app proxy type'
++ local APP=myapp
++ verify_app_name myapp
++ declare 'desc=verify app name format and app existence'
++ local APP=myapp
++ [[ ! -n myapp ]]
++ [[ ! myapp =~ ^[a-z].* ]]
++ [[ ! -d /home/dokku/myapp ]]
++ return 0
+++ config_get myapp DOKKU_APP_PROXY_TYPE
+++ declare 'desc=get value of given config var'
+++ [[ myapp == \c\o\n\f\i\g\:\g\e\t ]]
+++ set -- config:get myapp DOKKU_APP_PROXY_TYPE
+++ config_parse_args config:get myapp DOKKU_APP_PROXY_TYPE
+++ declare 'desc=parse config plugin args'
+++ unset APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
+++ for var in '"$@"'
+++ [[ config:get == \-\-\g\l\o\b\a\l ]]
+++ [[ config:get == \-\-\n\o\-\r\e\s\t\a\r\t ]]
+++ [[ config:get == \-\-\e\x\p\o\r\t ]]
+++ [[ config:get == \-\-\s\h\e\l\l ]]
+++ for var in '"$@"'
+++ [[ myapp == \-\-\g\l\o\b\a\l ]]
+++ [[ myapp == \-\-\n\o\-\r\e\s\t\a\r\t ]]
+++ [[ myapp == \-\-\e\x\p\o\r\t ]]
+++ [[ myapp == \-\-\s\h\e\l\l ]]
+++ for var in '"$@"'
+++ [[ DOKKU_APP_PROXY_TYPE == \-\-\g\l\o\b\a\l ]]
+++ [[ DOKKU_APP_PROXY_TYPE == \-\-\n\o\-\r\e\s\t\a\r\t ]]
+++ [[ DOKKU_APP_PROXY_TYPE == \-\-\e\x\p\o\r\t ]]
+++ [[ DOKKU_APP_PROXY_TYPE == \-\-\s\h\e\l\l ]]
+++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
++++ get_sanitized_config_args config:get myapp DOKKU_APP_PROXY_TYPE
++++ local 'desc=return sanitized arguments for config plugin'
++++ SANITIZED_ARGS=("$@")
++++ local SANITIZED_ARGS
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
++++ echo config:get myapp DOKKU_APP_PROXY_TYPE
+++ local SANITIZED_ARGS
+++ set -- config:get myapp DOKKU_APP_PROXY_TYPE
+++ DOKKU_CONFIG_TYPE=app
+++ DOKKU_CONFIG_RESTART=true
+++ [[ app == \a\p\p ]]
+++ [[ -z myapp ]]
+++ verify_app_name myapp
+++ declare 'desc=verify app name format and app existence'
+++ local APP=myapp
+++ [[ ! -n myapp ]]
+++ [[ ! myapp =~ ^[a-z].* ]]
+++ [[ ! -d /home/dokku/myapp ]]
+++ return 0
+++ APP=myapp
+++ ENV_FILE=/home/dokku/myapp/ENV
+++ export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
+++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
++++ get_sanitized_config_args config:get myapp DOKKU_APP_PROXY_TYPE
++++ local 'desc=return sanitized arguments for config plugin'
++++ SANITIZED_ARGS=("$@")
++++ local SANITIZED_ARGS
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
++++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
++++ echo config:get myapp DOKKU_APP_PROXY_TYPE
+++ local SANITIZED_ARGS
+++ set -- config:get myapp DOKKU_APP_PROXY_TYPE
+++ [[ -z myapp ]]
+++ config_create /home/dokku/myapp/ENV
+++ declare 'desc=create config env file'
+++ local ENV_FILE=/home/dokku/myapp/ENV
+++ [[ -f /home/dokku/myapp/ENV ]]
+++ [[ ! -s /home/dokku/myapp/ENV ]]
+++ local KEY=DOKKU_APP_PROXY_TYPE
+++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/myapp/ENV
+++ grep '^export DOKKU_APP_PROXY_TYPE='
+++ cut -d= -f2-
+++ sed -e 's/^'\''//' -e 's/'\''$//'
+++ true
++ local DOKKU_APP_PROXY_TYPE=
++ local APP_PROXY_TYPE=nginx
++ echo nginx
+ [[ nginx == \n\g\i\n\x ]]
+ local NGINX_CONF=/home/dokku/myapp/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 myapp DOKKU_PROXY_PORT_MAP
++ declare 'desc=get value of given config var'
++ [[ myapp == \c\o\n\f\i\g\:\g\e\t ]]
++ set -- config:get myapp DOKKU_PROXY_PORT_MAP
++ config_parse_args config:get myapp DOKKU_PROXY_PORT_MAP
++ declare 'desc=parse config plugin args'
++ unset APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
++ for var in '"$@"'
++ [[ config:get == \-\-\g\l\o\b\a\l ]]
++ [[ config:get == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ config:get == \-\-\e\x\p\o\r\t ]]
++ [[ config:get == \-\-\s\h\e\l\l ]]
++ for var in '"$@"'
++ [[ myapp == \-\-\g\l\o\b\a\l ]]
++ [[ myapp == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ myapp == \-\-\e\x\p\o\r\t ]]
++ [[ myapp == \-\-\s\h\e\l\l ]]
++ for var in '"$@"'
++ [[ DOKKU_PROXY_PORT_MAP == \-\-\g\l\o\b\a\l ]]
++ [[ DOKKU_PROXY_PORT_MAP == \-\-\n\o\-\r\e\s\t\a\r\t ]]
++ [[ DOKKU_PROXY_PORT_MAP == \-\-\e\x\p\o\r\t ]]
++ [[ DOKKU_PROXY_PORT_MAP == \-\-\s\h\e\l\l ]]
++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
+++ get_sanitized_config_args config:get myapp DOKKU_PROXY_PORT_MAP
+++ local 'desc=return sanitized arguments for config plugin'
+++ SANITIZED_ARGS=("$@")
+++ local SANITIZED_ARGS
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
+++ echo config:get myapp DOKKU_PROXY_PORT_MAP
++ local SANITIZED_ARGS
++ set -- config:get myapp DOKKU_PROXY_PORT_MAP
++ DOKKU_CONFIG_TYPE=app
++ DOKKU_CONFIG_RESTART=true
++ [[ app == \a\p\p ]]
++ [[ -z myapp ]]
++ verify_app_name myapp
++ declare 'desc=verify app name format and app existence'
++ local APP=myapp
++ [[ ! -n myapp ]]
++ [[ ! myapp =~ ^[a-z].* ]]
++ [[ ! -d /home/dokku/myapp ]]
++ return 0
++ APP=myapp
++ ENV_FILE=/home/dokku/myapp/ENV
++ export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
++ SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
+++ get_sanitized_config_args config:get myapp DOKKU_PROXY_PORT_MAP
+++ local 'desc=return sanitized arguments for config plugin'
+++ SANITIZED_ARGS=("$@")
+++ local SANITIZED_ARGS
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
+++ SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
+++ echo config:get myapp DOKKU_PROXY_PORT_MAP
++ local SANITIZED_ARGS
++ set -- config:get myapp DOKKU_PROXY_PORT_MAP
++ [[ -z myapp ]]
++ config_create /home/dokku/myapp/ENV
++ declare 'desc=create config env file'
++ local ENV_FILE=/home/dokku/myapp/ENV
++ [[ -f /home/dokku/myapp/ENV ]]
++ [[ ! -s /home/dokku/myapp/ENV ]]
++ local KEY=DOKKU_PROXY_PORT_MAP
++ grep -Eo 'export ([a-zA-Z_][a-zA-Z0-9_]*=.*)' /home/dokku/myapp/ENV
++ grep '^export DOKKU_PROXY_PORT_MAP='
++ cut -d= -f2-
++ sed -e 's/^'\''//' -e 's/'\''$//'
+ local 'PROXY_PORT_MAP=http:80:80 https:443:80'
++ nginx -v
++ cut -d/ -f 2
+ local 'NGINX_VERSION=1.10.0 (Ubuntu)'
++ is_spdy_enabled '1.10.0 (Ubuntu)'
++ declare 'desc=detects whether the installed nginx version has spdy or http2 support'
++ local 'NGINX_VERSION=1.10.0 (Ubuntu)'
++ local MAJOR_VERSION MINOR_VERSION PATCH_VERSION
++ local HAS_SUPPORT=true
++ which nginx
+++ echo '1.10.0 (Ubuntu)'
+++ awk '{split($0,a,"."); print a[1]}'
++ MAJOR_VERSION=1
+++ echo '1.10.0 (Ubuntu)'
+++ awk '{split($0,a,"."); print a[2]}'
++ MINOR_VERSION=10
+++ echo '1.10.0 (Ubuntu)'
+++ awk '{split($0,a,"."); print a[3]}'
++ PATCH_VERSION='0 (Ubuntu)'
++ [[ 1 -ge 2 ]]
++ [[ 1 -eq 1 ]]
++ [[ 10 -ge 10 ]]
++ HAS_SUPPORT=false
++ echo false
+ local SPDY_SUPPORTED=false
+ is_ssl_enabled myapp
+ declare 'desc=returns 0 if ssl is enabled for given app'
+ local APP=myapp
+ verify_app_name myapp
+ declare 'desc=verify app name format and app existence'
+ local APP=myapp
+ [[ ! -n myapp ]]
+ [[ ! myapp =~ ^[a-z].* ]]
+ [[ ! -d /home/dokku/myapp ]]
+ return 0
+ local APP_SSL_PATH=/home/dokku/myapp/tls
+ [[ -e /home/dokku/myapp/tls/server.crt ]]
+ [[ -e /home/dokku/myapp/tls/server.key ]]
+ return 0
+ local APP_SSL_PATH=/home/dokku/myapp/tls
++ mktemp
+ local NGINX_CONF_PREPEND=/tmp/tmp.hD8iB7PuYv
+ trap 'rm -f "/tmp/tmp.hD8iB7PuYv"' EXIT
+ read line
+ [[ -z www.myapp.com:myapp.com ]]
++ echo www.myapp.com:myapp.com
++ cut -d: -f1
+ local DOMAIN=www.myapp.com
+ local DEST_DOMAIN=myapp.com
+ dokku_log_info1 'Configuring redirect for www.myapp.com to ...'
+ declare 'desc=log info1 formatter'
+ echo '-----> Configuring redirect for www.myapp.com to ...'
-----> Configuring redirect for www.myapp.com to ...
+ 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" PROXY_PORT_MAP="$PROXY_PORT_MAP")
+ local SIGIL_PARAMS
+ sigil -f /var/lib/dokku/plugins/enabled/redirect/templates/nginx.conf.sigil APP=myapp DOKKU_ROOT=/home/dokku SPDY_SUPPORTED=false APP_SSL_PATH=/home/dokku/myapp/tls DOMAIN=www.myapp.com DEST_DOMAIN=myapp.com 'PROXY_PORT_MAP=http:80:80 https:443:80'
+ cat -s
+ read line
+ [[ -s /tmp/tmp.hD8iB7PuYv ]]
+ cat /home/dokku/myapp/nginx.conf
+ cat /tmp/tmp.hD8iB7PuYv
+ rm -f /tmp/tmp.hD8iB7PuYv
+ dokku_log_verbose 'Reloading nginx'
+ declare 'desc=log verbose formatter'
+ echo ' Reloading nginx'
Reloading nginx
+ validate_nginx
+ declare 'desc=validate entire nginx config'
+ 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 myapp.com
www.myapp.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://{}'
++ echo 'myapp.com
www.myapp.com' 'myapp.com
www.myapp.com'
++ tr ' ' '\n'
++ sort -u
++ rm -rf /tmp/dokku_nginx_template.IPx2u/nginx.conf.iR4dPq /tmp/dokku_nginx_template.IPx2u
++ rm -rf
+ letsencrypt_acmeproxy_off myapp
+ declare 'desc=disable ACME proxy for an app'
+ local app=myapp
+ verify_app_name myapp
+ declare 'desc=verify app name format and app existence'
+ local APP=myapp
+ [[ ! -n myapp ]]
+ [[ ! myapp =~ ^[a-z].* ]]
+ [[ ! -d /home/dokku/myapp ]]
+ return 0
+ local app_root=/home/dokku/myapp
+ local app_config_dir=/home/dokku/myapp/nginx.conf.d
+ dokku_log_info1 'Disabling ACME proxy for myapp...'
+ declare 'desc=log info1 formatter'
+ echo '-----> Disabling ACME proxy for myapp...'
-----> Disabling ACME proxy for myapp...
+ [[ -f /home/dokku/myapp/nginx.conf.d/letsencrypt.conf ]]
+ rm /home/dokku/myapp/nginx.conf.d/letsencrypt.conf
+ restart_nginx
+ declare 'desc=restart nginx for given distros'
+ case "$DOKKU_DISTRO" in
+ sudo /etc/init.d/nginx reload
+ dokku_log_verbose done
+ declare 'desc=log verbose formatter'
+ echo ' done'
done
++ rm -rf
+ rm -rf
+ implemented=1
+ [[ 1 -eq 0 ]]
+ [[ 1 -eq 0 ]]
+ set +f
+ exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment