From 7c7896029c86ce7b7b9ade4c0c3209b17de11b7a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 9 Feb 2015 13:24:38 -0500 Subject: [PATCH 1/6] Update debian package building due to manage generation changes --- Vagrantfile | 1 + deb.mk | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 2d310a943..a2a4e7d9c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -47,6 +47,7 @@ Vagrant::configure("2") do |config| end config.vm.define "build", autostart: false do |vm| + vm.vm.provision :shell, :inline => "apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}" vm.vm.provision :shell, :inline => "cd /root/dokku && make deb-all" end diff --git a/deb.mk b/deb.mk index 13357eef6..6e3f5917d 100644 --- a/deb.mk +++ b/deb.mk @@ -101,7 +101,9 @@ deb-dokku: deb-setup cp dokku /tmp/build/usr/local/bin cp -r plugins /tmp/build/var/lib/dokku find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do touch /tmp/build/var/lib/dokku/plugins/$$plugin/.core; done - cp dokku.1 /tmp/build/usr/local/share/man/man1/dokku.1 + $(MAKE) help2man + $(MAKE) addman + cp /usr/local/share/man/man1/dokku.1 /tmp/build/usr/local/share/man/man1/dokku.1 cp contrib/dokku-installer.rb /tmp/build/usr/local/share/dokku/contrib git describe --tags > /tmp/build/var/lib/dokku/VERSION cat /tmp/build/var/lib/dokku/VERSION | cut -d '-' -f 1 | cut -d 'v' -f 2 > /tmp/build/var/lib/dokku/STABLE_VERSION From e5fb746a7f8daa72b8126505696a9a6ed35eb157 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Mon, 9 Feb 2015 16:59:07 -0800 Subject: [PATCH 2/6] only look for long args in global space. allows for short args in plugins. closes #963 --- docs/remote-commands.md | 5 +++-- dokku | 4 ++-- plugins/common/functions | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/remote-commands.md b/docs/remote-commands.md index 4bc907359..943ebfa47 100644 --- a/docs/remote-commands.md +++ b/docs/remote-commands.md @@ -24,7 +24,8 @@ Dokku also supports certain command-line arguments that augment it's behavior. I in order to avoid ssh interpretting dokku arguments for itself. ```shell --q|--quiet suppress output headers --t|--trace enable DOKKU_TRACE for current execution only +--quiet suppress output headers +--trace enable DOKKU_TRACE for current execution only --rm|--rm-container remove docker container after successful dokku run +--force force flag. currently used in apps:destroy ``` diff --git a/dokku b/dokku index 9b4bf7731..6b4d00306 100755 --- a/dokku +++ b/dokku @@ -19,7 +19,7 @@ source "$PLUGIN_PATH/common/functions" parse_args "$@" for arg in "$@"; do - [[ "$arg" =~ ^-.* ]] && shift 1 + [[ "$arg" =~ ^--.* ]] && shift 1 done ! has_tty && DOKKU_QUIET_OUTPUT=1 @@ -150,7 +150,7 @@ case "$1" in ;; help|'') - echo "Usage: dokku [-q|--quiet|-t|--trace|--rm-container|--rm] COMMAND [command-specific-options]" + echo "Usage: dokku [--quiet|--trace|--rm-container|--rm|--force] COMMAND [command-specific-options]" echo "" echo "Options:" diff --git a/plugins/common/functions b/plugins/common/functions index 9785b7cdd..7c0aa071a 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -98,16 +98,16 @@ is_image_buildstep_based() { parse_args() { for arg in "$@"; do case "$arg" in - --quiet|-q) + --quiet) export DOKKU_QUIET_OUTPUT=1 ;; - --trace|-t) + --trace) export DOKKU_TRACE=1 ;; --rm-container|--rm) export DOKKU_RM_CONTAINER=1 ;; - --force|-f) + --force) export DOKKU_APPS_FORCE_DELETE=1 ;; esac From d5ceda6da72842cfde202d966a66be1429fe458f Mon Sep 17 00:00:00 2001 From: David Jelic Date: Tue, 10 Feb 2015 11:47:20 +0100 Subject: [PATCH 3/6] handle upgrade in debian/preinst script --- debian/preinst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debian/preinst b/debian/preinst index a7a5c7a54..198b8aee6 100755 --- a/debian/preinst +++ b/debian/preinst @@ -25,6 +25,9 @@ case "$1" in service nginx reload ;; + upgrade) + ;; + abort-upgrade) ;; From 870ca86ba6738b644a5d59cb3b0d0de1cb1763f1 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 11 Feb 2015 17:12:28 -0500 Subject: [PATCH 4/6] Release 0.3.15 --- HISTORY.md | 13 +++++++++++++ README.md | 2 +- contrib/dokku-installer.rb | 2 +- docs/installation.md | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 249871d05..5353e30bc 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,18 @@ # History +## 0.3.15 + +- #950: @michaelhobbs Do not count blank lines in `make count` +- #952: @michaelhobbs Document cli args over ssh. closes #951 +- #954: @michaelhobbs Dockerfile support +- #955: @michaelhobbs Quick style refactor +- #956: @michaelhobbs Comment out skipped tests as we pay the cost for setup() and teardown() anyway +- #957: @michaelhobbs Implement dokku shell and ls (by @plietar). refs #312 +- #960: @michaelhobbs Use consistent bash shebang. closes #959 +- #962: @josegonzalez Update debian package building due to man page generation changes +- #964: @michaelhobbs Only look for long args in global space. allows for short args in plugins. closes #963 +- #966: @djelic handle upgrade in debian/preinst script + ## 0.3.14 - #891: @josegonzalez Keep existing configuration files when installing nginx. Refs #886 diff --git a/README.md b/README.md index 773c29ed3..e7c1ee3b7 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. S To install the latest stable version of dokku, you can run the following bootstrapper command: - $ wget -qO- https://raw.github.com/progrium/dokku/v0.3.14/bootstrap.sh | sudo DOKKU_TAG=v0.3.14 bash + $ wget -qO- https://raw.github.com/progrium/dokku/v0.3.15/bootstrap.sh | sudo DOKKU_TAG=v0.3.15 bash ### Upgrading diff --git a/contrib/dokku-installer.rb b/contrib/dokku-installer.rb index 2210db7da..4b14c3f2c 100755 --- a/contrib/dokku-installer.rb +++ b/contrib/dokku-installer.rb @@ -21,7 +21,7 @@ if ARGV[0] == "onboot" exit end -version = "v0.3.14" +version = "v0.3.15" dokku_root = ENV["DOKKU_ROOT"] || "/home/dokku" admin_key = `cat /root/.ssh/authorized_keys`.split("\n").first hostname = `bash -c '[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME || curl icanhazip.com'`.strip diff --git a/docs/installation.md b/docs/installation.md index 7718c0aed..bc4c54752 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -11,7 +11,7 @@ Ubuntu 14.04 x64 x64. Ideally have a domain ready to point to your host. It's de To install the latest stable version of dokku, you can run the following bootstrapper command: ```shell -wget -qO- https://raw.github.com/progrium/dokku/v0.3.14/bootstrap.sh | sudo DOKKU_TAG=v0.3.14 bash +wget -qO- https://raw.github.com/progrium/dokku/v0.3.15/bootstrap.sh | sudo DOKKU_TAG=v0.3.15 bash ``` ## Configuring From 043b055558bcaeab955069cb206351e307e7ec38 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Wed, 11 Feb 2015 17:01:30 -0800 Subject: [PATCH 5/6] don't use set to guard against pipefail --- plugins/nginx-vhosts/bind-external-ip | 2 +- plugins/nginx-vhosts/post-deploy | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/nginx-vhosts/bind-external-ip b/plugins/nginx-vhosts/bind-external-ip index d4582b3cd..422ddc2f0 100755 --- a/plugins/nginx-vhosts/bind-external-ip +++ b/plugins/nginx-vhosts/bind-external-ip @@ -2,7 +2,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x APP="$1" -set +e; NO_VHOST=$(dokku config:get $APP NO_VHOST); set -e +NO_VHOST=$(dokku config:get $APP NO_VHOST || true) RE_IPV4="([0-9]{1,3}[\.]){3}[0-9]{1,3}" diff --git a/plugins/nginx-vhosts/post-deploy b/plugins/nginx-vhosts/post-deploy index db457b8c7..c803c980b 100755 --- a/plugins/nginx-vhosts/post-deploy +++ b/plugins/nginx-vhosts/post-deploy @@ -3,8 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$(dirname $0)/../common/functions" APP="$1"; PORT="$2"; IP="$3" - -set +e; NO_VHOST=$(dokku config:get $APP NO_VHOST); set -e +NO_VHOST=$(dokku config:get $APP NO_VHOST || true) if [[ -n "$NO_VHOST" ]]; then dokku_log_info1 "NO_VHOST config detected" From 12777d9bf074dc15436e4c7257e52ad7c331b90b Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Thu, 12 Feb 2015 12:33:13 -0800 Subject: [PATCH 6/6] simplify SSL hostname handling and avoid overwriting variables. refs #971 --- plugins/nginx-vhosts/commands | 14 +++++++++----- tests/unit/00_dokku-standard.bats | 7 +++---- tests/unit/nginx-vhosts.bats | 16 ++++++++++++++++ tests/unit/server_ssl_wildcard.tar | Bin 0 -> 10240 bytes tests/unit/test_helper.bash | 18 ++++++++++++++++++ 5 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 tests/unit/server_ssl_wildcard.tar diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands index 1d0a9db23..a75745871 100755 --- a/plugins/nginx-vhosts/commands +++ b/plugins/nginx-vhosts/commands @@ -52,14 +52,18 @@ EOF SCHEME="https" SSL_HOSTNAME=$(openssl x509 -in $SSL_INUSE/server.crt -noout -subject | tr '/' '\n' | grep CN= | cut -c4-) - SSL_HOSTNAME=$(echo "$SSL_HOSTNAME" | sed 's|\.|\\.|g' | sed 's/\*/\.\*/g') - [[ -z "$(egrep ^"$SSL_HOSTNAME"$ $VHOST_PATH)" ]] && echo "$SSL_HOSTNAME" | sed 's/\\./\./g' >> $VHOST_PATH + if [[ -n "$SSL_HOSTNAME" ]]; then + SSL_HOSTNAME_REGEX=$(echo "$SSL_HOSTNAME" | sed 's|\.|\\.|g' | sed 's/\*/\.\*/g') + [[ -z "$(egrep "^${SSL_HOSTNAME_REGEX}$" $VHOST_PATH)" ]] && echo "$SSL_HOSTNAME" >> $VHOST_PATH + fi SSL_HOSTNAME_ALT=$(openssl x509 -in $SSL_INUSE/server.crt -noout -text | grep --after-context=1 '509v3 Subject Alternative Name:' | tail -n 1 | sed -e "s/[[:space:]]*DNS://g" | tr ',' '\n' || true) - SSL_HOSTNAME_ALT=$(echo "$SSL_HOSTNAME_ALT" | sed 's|\.|\\.|g' | sed 's/\*/\.\*/g') - [[ -z "$(egrep ^"$SSL_HOSTNAME_ALT"$ $VHOST_PATH)" ]] && echo "$SSL_HOSTNAME_ALT" | sed 's/\\./\./g' >> $VHOST_PATH + if [[ -n "$SSL_HOSTNAME_ALT" ]]; then + SSL_HOSTNAME_ALT_REGEX=$(echo "$SSL_HOSTNAME_ALT" | sed 's|\.|\\.|g' | sed 's/\*/\.\*/g') + [[ -z "$(egrep "^${SSL_HOSTNAME_ALT_REGEX}$" $VHOST_PATH)" ]] && echo "$SSL_HOSTNAME_ALT" >> $VHOST_PATH + fi - SSL_VHOSTS=$(egrep "^${SSL_HOSTNAME}$|^${SSL_HOSTNAME_ALT}$" $VHOST_PATH || exit 0) + SSL_VHOSTS=$(egrep "^${SSL_HOSTNAME_REGEX}$|^${SSL_HOSTNAME_ALT_REGEX}$" $VHOST_PATH || exit 0) NONSSL_VHOSTS=$(egrep -v "^${SSL_HOSTNAME}$|^${SSL_HOSTNAME_ALT}$" $VHOST_PATH || exit 0) while read line; do diff --git a/tests/unit/00_dokku-standard.bats b/tests/unit/00_dokku-standard.bats index c8abfbfba..cb9857e39 100644 --- a/tests/unit/00_dokku-standard.bats +++ b/tests/unit/00_dokku-standard.bats @@ -9,6 +9,7 @@ setup() { teardown() { rm -rf /home/dokku/$TEST_APP/tls /home/dokku/tls destroy_app + disable_tls_wildcard } @test "run (with tty)" { @@ -35,8 +36,7 @@ teardown() { } @test "urls (app ssl)" { - mkdir -p /home/dokku/$TEST_APP/tls - touch /home/dokku/$TEST_APP/tls/server.crt /home/dokku/$TEST_APP/tls/server.key + setup_test_tls run bash -c "dokku urls $TEST_APP | grep dokku.me" echo "output: "$output echo "status: "$status @@ -44,8 +44,7 @@ teardown() { } @test "urls (wildcard ssl)" { - mkdir -p /home/dokku/tls - touch /home/dokku/tls/server.crt /home/dokku/tls/server.key + setup_test_tls_wildcard run bash -c "dokku urls $TEST_APP | grep dokku.me" echo "output: "$output echo "status: "$status diff --git a/tests/unit/nginx-vhosts.bats b/tests/unit/nginx-vhosts.bats index 0c6f09db1..8c9660a48 100644 --- a/tests/unit/nginx-vhosts.bats +++ b/tests/unit/nginx-vhosts.bats @@ -12,6 +12,7 @@ teardown() { destroy_app [[ -f "$DOKKU_ROOT/VHOST.bak" ]] && mv "$DOKKU_ROOT/VHOST.bak" "$DOKKU_ROOT/VHOST" [[ -f "$DOKKU_ROOT/HOSTNAME.bak" ]] && mv "$DOKKU_ROOT/HOSTNAME.bak" "$DOKKU_ROOT/HOSTNAME" + disable_tls_wildcard } @test "nginx (no server tokens)" { @@ -22,6 +23,21 @@ teardown() { assert_failure } +@test "nginx:build-config (wildcard SSL)" { + destroy_app + setup_test_tls_wildcard + create_app + run dokku domains:add $TEST_APP wildcard.dokku.me + echo "output: "$output + echo "status: "$status + assert_success + deploy_app + run bash -c "response=\"$(curl -LkSs wildcard.dokku.me)\"; echo \$response; test \"\$response\" == \"nodejs/express\"" + echo "output: "$output + echo "status: "$status + assert_success +} + @test "nginx:build-config (with SSL CN mismatch)" { setup_test_tls deploy_app diff --git a/tests/unit/server_ssl_wildcard.tar b/tests/unit/server_ssl_wildcard.tar new file mode 100644 index 0000000000000000000000000000000000000000..0fa52c4eefaf1ce1d71da62dd54834cb4d9b6530 GIT binary patch literal 10240 zcmeH~NziXFsZ4(vN(70ZoHfB>;C;@3A{=5$w2StZb~!6c->o z%+2HR2!Ea5z$qWseEcmP=Wl<}fX+c+*thcmlQ{J2^UH*wDE9VH zzI})OqImw`cA4gQ{Qmvh8W&^y`qvEpH~Sx){^xxB*VkZpQ8vD_yzR<@%+fCZV;0b5 znTrpWrJGwpZ!$v{vO>#@nKzi8iJ_*`kjOfN=*S7mSv-Gg!d6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