Merge branch 'master' into develop

This commit is contained in:
Alessio Treglia
2015-02-13 11:39:50 +00:00
17 changed files with 79 additions and 23 deletions

View File

@@ -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

View File

@@ -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

1
Vagrantfile vendored
View File

@@ -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

View File

@@ -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

4
deb.mk
View File

@@ -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

3
debian/preinst vendored
View File

@@ -25,6 +25,9 @@ case "$1" in
service nginx reload
;;
upgrade)
;;
abort-upgrade)
;;

View File

@@ -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

View File

@@ -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 <app> <command>
--force force flag. currently used in apps:destroy
```

4
dokku
View File

@@ -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 <app> [command-specific-options]"
echo "Usage: dokku [--quiet|--trace|--rm-container|--rm|--force] COMMAND <app> [command-specific-options]"
echo ""
echo "Options:"

View File

@@ -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

View File

@@ -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}"

View File

@@ -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

View File

@@ -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"

View File

@@ -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

View File

@@ -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

Binary file not shown.

View File

@@ -134,3 +134,21 @@ setup_test_tls_with_sans() {
tar xf $BATS_TEST_DIRNAME/server_ssl_sans.tar -C $TLS
sudo chown -R dokku:dokku $TLS
}
setup_test_tls_wildcard() {
TLS="/home/dokku/tls"
mkdir -p $TLS
tar xf $BATS_TEST_DIRNAME/server_ssl_wildcard.tar -C $TLS
sudo chown -R dokku:dokku $TLS
sed -i -e "s:^# ssl_certificate $DOKKU_ROOT/tls/server.crt;:ssl_certificate $DOKKU_ROOT/tls/server.crt;:g" \
-e "s:^# ssl_certificate_key $DOKKU_ROOT/tls/server.key;:ssl_certificate_key $DOKKU_ROOT/tls/server.key;:g" /etc/nginx/conf.d/dokku.conf
kill -HUP "$(< /var/run/nginx.pid)"; sleep 5
}
disable_tls_wildcard() {
TLS="/home/dokku/tls"
rm -rf $TLS
sed -i -e "s:^ssl_certificate $DOKKU_ROOT/tls/server.crt;:# ssl_certificate $DOKKU_ROOT/tls/server.crt;:g" \
-e "s:^ssl_certificate_key $DOKKU_ROOT/tls/server.key;:# ssl_certificate_key $DOKKU_ROOT/tls/server.key;:g" /etc/nginx/conf.d/dokku.conf
kill -HUP "$(< /var/run/nginx.pid)"; sleep 5
}