# go to your server's IP and follow the web installer
diff --git a/docs/template.html b/docs/template.html
index 7c69c23c8..1fd721650 100644
--- a/docs/template.html
+++ b/docs/template.html
@@ -7,29 +7,28 @@
-
Dokku - The smallest PaaS implementation you've ever seen
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
diff --git a/dokku b/dokku
index b26f6c799..978d617f4 100755
--- a/dokku
+++ b/dokku
@@ -9,7 +9,7 @@ export DOKKU_ROOT=${DOKKU_ROOT:=~dokku}
export DOKKU_DISTRO
# shellcheck disable=SC1091
-DOKKU_DISTRO=$(. /etc/os-release && echo "$ID")
+DOKKU_DISTRO=$(. /etc/os-release > /dev/null 2>&1 || true ; echo "$ID")
export DOKKU_IMAGE=${DOKKU_IMAGE:="gliderlabs/herokuish"}
export DOKKU_LIB_ROOT=${DOKKU_LIB_PATH:="/var/lib/dokku"}
@@ -35,10 +35,12 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
parse_args "$@"
args=("$@")
+skip_arg=false
if [[ "${args[0]}" =~ ^--.* ]]; then
for arg in "$@"; do
+ $skip_arg && skip_arg=false && continue
if [[ "$arg" == "--app" ]]; then
- shift 2
+ shift 2 && skip_arg=true
elif [[ "$arg" =~ ^--.* ]]; then
shift 1
else
diff --git a/plugins/00_dokku-standard/plugin.toml b/plugins/00_dokku-standard/plugin.toml
index b0a1b8939..21e999806 100644
--- a/plugins/00_dokku-standard/plugin.toml
+++ b/plugins/00_dokku-standard/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core standard plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/20_events/plugin.toml b/plugins/20_events/plugin.toml
index 8221c20a6..4e15db2c6 100644
--- a/plugins/20_events/plugin.toml
+++ b/plugins/20_events/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core events logging plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/apps/commands b/plugins/apps/commands
index c46d255b1..234108cdf 100755
--- a/plugins/apps/commands
+++ b/plugins/apps/commands
@@ -8,6 +8,7 @@ case "$1" in
declare desc="return apps plugin help content"
cat<, Clones an app
apps:create , Create a new app
apps:destroy , Permanently destroy an app
apps:rename , Rename an app
diff --git a/plugins/apps/plugin.toml b/plugins/apps/plugin.toml
index abda804a0..e79c48f60 100644
--- a/plugins/apps/plugin.toml
+++ b/plugins/apps/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core apps plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/apps/subcommands/clone b/plugins/apps/subcommands/clone
new file mode 100755
index 000000000..829882c2c
--- /dev/null
+++ b/plugins/apps/subcommands/clone
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
+source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
+source "$PLUGIN_AVAILABLE_PATH/apps/functions"
+source "$PLUGIN_AVAILABLE_PATH/ps/functions"
+
+apps_clone_cmd() {
+ declare desc="clones an app"
+ declare OLD_APP="$2" NEW_APP="$3"
+ local cmd="apps:clone"
+ local SKIP_REBUILD=false
+
+ if [[ "$2" == "--skip-deploy" ]]; then
+ SKIP_REBUILD=true
+ OLD_APP="$3"
+ NEW_APP="$4"
+ fi
+
+ [[ -z "$OLD_APP" ]] && dokku_log_fail "Please specify an app to run the command on"
+ [[ -d "$DOKKU_ROOT/$NEW_APP" ]] && dokku_log_fail "Name is already taken"
+ local NEW_CACHE_DIR="$DOKKU_ROOT/$NEW_APP/cache"
+
+ apps_create "$NEW_APP"
+ cp -a "$DOKKU_ROOT/$OLD_APP/." "$DOKKU_ROOT/$NEW_APP"
+
+ if [[ -d "$NEW_CACHE_DIR" ]] && ! rmdir "$NEW_CACHE_DIR"; then
+ docker run "$DOKKU_GLOBAL_RUN_ARGS" --rm -v "$NEW_CACHE_DIR:/cache" "dokku/$OLD_APP" chmod 777 -R /cache
+ fi
+ rm -rf "$NEW_CACHE_DIR"
+
+ [[ -f "$DOKKU_ROOT/$NEW_APP/URLS" ]] && sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/URLS"
+ [[ -f "$DOKKU_ROOT/$NEW_APP/VHOST" ]] && sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/VHOST"
+ [[ -f "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" ]] && sed -i -e "s/git-hook $OLD_APP/git-hook $NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive"
+ [[ "$SKIP_REBUILD" == "true" ]] || ps_rebuild "$NEW_APP"
+ plugn trigger post-app-clone "$OLD_APP" "$NEW_APP"
+ echo "Cloning $OLD_APP to $NEW_APP... done"
+}
+
+apps_clone_cmd "$@"
diff --git a/plugins/build-env/plugin.toml b/plugins/build-env/plugin.toml
index ade77a4a7..92ce826fe 100644
--- a/plugins/build-env/plugin.toml
+++ b/plugins/build-env/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core build-env plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/certs/functions b/plugins/certs/functions
index a130c993e..55c0ea953 100755
--- a/plugins/certs/functions
+++ b/plugins/certs/functions
@@ -2,6 +2,39 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
+certs_info_cmd() {
+ # This is here because it's used in both the info and the default
+ declare desc="prints SSL certificate info for app"
+ local cmd="certs:info"
+ [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
+ verify_app_name "$2"
+ local APP="$2"; local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
+
+ if [[ -n "$APP_SSL_PATH" ]]; then
+ dokku_log_info1 "Fetching SSL Endpoint info for $APP..."
+ dokku_log_info1 "Certificate details:"
+ dokku_log_info2 "Common Name(s): "
+
+ for domain in $(get_ssl_hostnames "$APP" | xargs); do
+ dokku_log_info2 " $domain"
+ done
+
+ dokku_log_info2 "Expires At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not After :" | awk -F " : " '{ print $2 }')"
+ dokku_log_info2 "Issuer: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Issuer:" | xargs | sed -e "s/Issuer: //g")"
+ dokku_log_info2 "Starts At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not Before:" | awk -F ": " '{ print $2 }')"
+ dokku_log_info2 "Subject: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -subject | sed -e "s:subject= ::g"| sed -e "s:^/::g" | sed -e "s:/:; :g")"
+ local SSL_VERIFY_OUTPUT="$(openssl verify -verbose -purpose sslserver "$APP_SSL_PATH/server.crt" | awk -F ':' '{ print $2 }' | tail -1 | xargs || true)"
+ if [[ "$SSL_VERIFY_OUTPUT" == "OK" ]]; then
+ local SSL_SELF_SIGNED="verified by a certificate authority."
+ else
+ local SSL_SELF_SIGNED="self signed."
+ fi
+ dokku_log_info2 "SSL certificate is $SSL_SELF_SIGNED"
+ else
+ dokku_log_info1 "$APP does not have an SSL endpoint"
+ fi
+}
+
is_ssl_enabled() {
declare desc="returns 0 if ssl is enabled for given app"
local APP=$1; verify_app_name "$APP"
diff --git a/plugins/certs/plugin.toml b/plugins/certs/plugin.toml
index cc275d6b9..b0caec7f9 100644
--- a/plugins/certs/plugin.toml
+++ b/plugins/certs/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core certificate management plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/certs/subcommands/add b/plugins/certs/subcommands/add
index 07601378c..c705d1cde 100755
--- a/plugins/certs/subcommands/add
+++ b/plugins/certs/subcommands/add
@@ -72,7 +72,6 @@ certs_set() {
cp "$KEY_FILE" "$APP_SSL_PATH/server.key"
chmod 750 "$APP_SSL_PATH"
chmod 640 "$APP_SSL_PATH/server.crt" "$APP_SSL_PATH/server.key"
- cd "$DOKKU_ROOT"
plugn trigger post-certs-update "$APP"
plugn trigger post-domains-update "$APP"
}
diff --git a/plugins/certs/subcommands/default b/plugins/certs/subcommands/default
new file mode 100644
index 000000000..5eabd33b8
--- /dev/null
+++ b/plugins/certs/subcommands/default
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
+source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
+source "$PLUGIN_AVAILABLE_PATH/certs/functions"
+
+certs_main_cmd() {
+ declare desc="an alias for certs:info"
+ local cmd="certs"
+ certs_info_cmd "$@"
+}
+
+certs_main_cmd "$@"
diff --git a/plugins/certs/subcommands/generate b/plugins/certs/subcommands/generate
index daa2caed8..10349e9f9 100755
--- a/plugins/certs/subcommands/generate
+++ b/plugins/certs/subcommands/generate
@@ -22,14 +22,15 @@ certs_generate_cmd() {
mkdir -p "$APP_SSL_PATH"
dokku_log_info1 "Installing certificate and key..."
- mv -f "$CERTS_GENERATE_TMP_WORK_DIR/server.key" "$CERTS_GENERATE_TMP_WORK_DIR/server.crt" "$APP_SSL_PATH"
+ mv -f "$CERTS_GENERATE_TMP_WORK_DIR/server.crt" "$CERTS_GENERATE_TMP_WORK_DIR/server.csr" "$CERTS_GENERATE_TMP_WORK_DIR/server.key" "$APP_SSL_PATH"
chmod 750 "$APP_SSL_PATH"
- chmod 640 "$APP_SSL_PATH/server.key" "$APP_SSL_PATH/server.crt"
+ chmod 640 "$APP_SSL_PATH/server.crt" "$APP_SSL_PATH/server.csr" "$APP_SSL_PATH/server.key"
+ plugn trigger post-certs-update "$APP"
[[ -n "$DOMAIN" ]] && (domains_add "$APP" "$DOMAIN" || plugn trigger post-domains-update "$APP")
dokku_log_info1 "The following is a certificate signing request that can be used"
dokku_log_info1 "to generate an 'officially' signed SSL certificate for $APP at $DOMAIN"
dokku_log_info1 "by a CA of your choosing."
- cat server.csr
+ cat "$APP_SSL_PATH/server.csr"
else
dokku_log_info1 "$APP has an SSL endpoint already defined"
fi
diff --git a/plugins/certs/subcommands/info b/plugins/certs/subcommands/info
index cfda760d8..77fd90b7c 100755
--- a/plugins/certs/subcommands/info
+++ b/plugins/certs/subcommands/info
@@ -3,36 +3,4 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
-certs_info_cmd() {
- declare desc="prints SSL certificate info for app"
- local cmd="certs:info"
- [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
- verify_app_name "$2"
- local APP="$2"; local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
-
- if [[ -n "$APP_SSL_PATH" ]]; then
- dokku_log_info1 "Fetching SSL Endpoint info for $APP..."
- dokku_log_info1 "Certificate details:"
- dokku_log_info2 "Common Name(s): "
-
- for domain in $(get_ssl_hostnames "$APP" | xargs); do
- dokku_log_info2 " $domain"
- done
-
- dokku_log_info2 "Expires At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not After :" | awk -F " : " '{ print $2 }')"
- dokku_log_info2 "Issuer: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Issuer:" | xargs | sed -e "s/Issuer: //g")"
- dokku_log_info2 "Starts At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not Before:" | awk -F ": " '{ print $2 }')"
- dokku_log_info2 "Subject: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -subject | sed -e "s:subject= ::g"| sed -e "s:^/::g" | sed -e "s:/:; :g")"
- local SSL_VERIFY_OUTPUT="$(openssl verify -verbose -purpose sslserver "$APP_SSL_PATH/server.crt" | awk -F ':' '{ print $2 }' | tail -1 | xargs || true)"
- if [[ "$SSL_VERIFY_OUTPUT" == "OK" ]]; then
- local SSL_SELF_SIGNED="verified by a certificate authority."
- else
- local SSL_SELF_SIGNED="self signed."
- fi
- dokku_log_info2 "SSL certificate is $SSL_SELF_SIGNED"
- else
- dokku_log_info1 "$APP does not have an SSL endpoint"
- fi
-}
-
certs_info_cmd "$@"
diff --git a/plugins/checks/commands b/plugins/checks/commands
index 2400b5ee0..5f27055ac 100755
--- a/plugins/checks/commands
+++ b/plugins/checks/commands
@@ -16,7 +16,7 @@ help_content
}
if [[ $1 = "checks:help" ]] ; then
- echo -e 'Usage: dokku checks[:COMAND]'
+ echo -e 'Usage: dokku checks[:COMMAND]'
echo ''
echo 'Manage zero-downtime settings.'
echo ''
diff --git a/plugins/checks/plugin.toml b/plugins/checks/plugin.toml
index 1b4d3b6b7..bf1d75246 100644
--- a/plugins/checks/plugin.toml
+++ b/plugins/checks/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core checks plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/common/functions b/plugins/common/functions
index 786cf4a34..20cb21c46 100755
--- a/plugins/common/functions
+++ b/plugins/common/functions
@@ -251,7 +251,12 @@ parse_args() {
declare desc="top-level cli arg parser"
local next_index=1; local skip=false; local args=("$@")
for arg in "$@"; do
- $skip && skip=false && continue
+ if [[ "$skip" == "true" ]]; then
+ next_index=$(( next_index + 1 ))
+ skip=false
+ continue
+ fi
+
case "$arg" in
--quiet)
export DOKKU_QUIET_OUTPUT=1
@@ -272,7 +277,7 @@ parse_args() {
export DOKKU_APP_NAME=${args[$next_index]}; skip=true
;;
esac
- local next_index=$(( next_index + 1 ))
+ next_index=$(( next_index + 1 ))
done
return 0
}
diff --git a/plugins/common/plugin.toml b/plugins/common/plugin.toml
index 9a1675ca7..6aa57777e 100644
--- a/plugins/common/plugin.toml
+++ b/plugins/common/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core common plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/config/plugin.toml b/plugins/config/plugin.toml
index 4f87dd4ea..d2e907e8b 100644
--- a/plugins/config/plugin.toml
+++ b/plugins/config/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core config plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/docker-options/plugin.toml b/plugins/docker-options/plugin.toml
index a802b0fc4..fb4500136 100644
--- a/plugins/docker-options/plugin.toml
+++ b/plugins/docker-options/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core docker-options plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/domains/plugin.toml b/plugins/domains/plugin.toml
index a16a166ce..dc46154f6 100644
--- a/plugins/domains/plugin.toml
+++ b/plugins/domains/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core domains plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/domains/subcommands/default b/plugins/domains/subcommands/default
index 011a1c292..c046e7fac 100755
--- a/plugins/domains/subcommands/default
+++ b/plugins/domains/subcommands/default
@@ -12,6 +12,11 @@ domains_main_cmd() {
dokku_log_info2_quiet "Global Domain Name"
get_global_vhosts
fi
+
+ if [[ "$APP" == "--global" ]]; then
+ return
+ fi
+
if [[ -n "$APP" ]]; then
verify_app_name "$APP"
if [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
diff --git a/plugins/enter/plugin.toml b/plugins/enter/plugin.toml
index 71417684a..c37818a91 100644
--- a/plugins/enter/plugin.toml
+++ b/plugins/enter/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core enter plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/git/functions b/plugins/git/functions
index 33158d646..5e0da3726 100755
--- a/plugins/git/functions
+++ b/plugins/git/functions
@@ -28,7 +28,7 @@ git_build_app_repo() {
git remote add origin "$DOKKU_ROOT/$APP" &> /dev/null
git fetch --depth=1 origin "refs/tags/$TMP_TAG" &> /dev/null
git reset --hard FETCH_HEAD &> /dev/null
- git submodule update --init --recursive &> /dev/null
+ suppress_output git submodule update --init --recursive
GIT_DIR="$DOKKU_ROOT/$APP" git tag -d "$TMP_TAG" &> /dev/null || true
find -name .git -prune -exec rm -rf {} \; > /dev/null
@@ -41,16 +41,53 @@ git_build_app_repo() {
fi
}
+suppress_output() {
+ declare desc="suppress all output from a given command unless there is an error"
+ local TMP_COMMAND_OUTPUT
+ TMP_COMMAND_OUTPUT=$(mktemp "/tmp/${FUNCNAME[0]}.XXXX")
+ trap 'rm -rf "$TMP_COMMAND_OUTPUT" > /dev/null' RETURN INT TERM EXIT
+
+ "$@" > "$TMP_COMMAND_OUTPUT" 2>&1 || {
+ local exit_code="$?"
+ cat "$TMP_COMMAND_OUTPUT"
+ return "$exit_code"
+ }
+ return 0
+}
+
+git_deploy_branch() {
+ declare desc="retrieve the deploy branch for a given application"
+ local cmd="git-hook"
+ local APP="$1"
+
+ local DOKKU_DEPLOY_BRANCH="$(config_get "$APP" DOKKU_DEPLOY_BRANCH || true)"
+ local DOKKU_GLOBAL_DEPLOY_BRANCH="$(config_get --global DOKKU_DEPLOY_BRANCH || true)"
+ if [[ -n "$DOKKU_DEPLOY_BRANCH" ]]; then
+ echo "$DOKKU_DEPLOY_BRANCH"
+ elif [[ -n "$DOKKU_GLOBAL_DEPLOY_BRANCH" ]]; then
+ echo "$DOKKU_GLOBAL_DEPLOY_BRANCH"
+ else
+ echo "master"
+ fi
+}
+
git_hook_cmd() {
declare desc="kick off receive-app trigger from git prereceive hook"
local cmd="git-hook"
- local APP="$2"
+ local APP="$2"
+ local DOKKU_DEPLOY_BRANCH="$(git_deploy_branch "$APP")"
+
+ if ! git check-ref-format --branch "$DOKKU_DEPLOY_BRANCH" 2> /dev/null; then
+ echo $'\e[1G\e[K'"-----> WARNING: Invalid branch name '$DOKKU_DEPLOY_BRANCH' specified via DOKKU_DEPLOY_BRANCH."
+ echo $'\e[1G\e[K'"-----> For more details, please see the man page for 'git-check-ref-format.'"
+ return
+ fi
local oldrev newrev refname
while read -r oldrev newrev refname; do
# Only run this script for the master branch. You can remove this
# if block if you wish to run it for others as well.
- if [[ $refname = "refs/heads/master" ]]; then
+ if [[ $refname = "refs/heads/${DOKKU_DEPLOY_BRANCH}" ]]; then
# broken out into plugin so we might support other methods to receive an app
# shellcheck disable=SC2086
plugn trigger receive-app $APP $newrev
diff --git a/plugins/git/plugin.toml b/plugins/git/plugin.toml
index e045d49d2..7a4d20407 100644
--- a/plugins/git/plugin.toml
+++ b/plugins/git/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core git plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/logs/plugin.toml b/plugins/logs/plugin.toml
index 8913ebada..f07495e97 100644
--- a/plugins/logs/plugin.toml
+++ b/plugins/logs/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core logs plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/named-containers/plugin.toml b/plugins/named-containers/plugin.toml
index 6488244b6..7519949ea 100644
--- a/plugins/named-containers/plugin.toml
+++ b/plugins/named-containers/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core named containers plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands
index f7911fc25..2995231d7 100755
--- a/plugins/nginx-vhosts/commands
+++ b/plugins/nginx-vhosts/commands
@@ -1,26 +1,14 @@
#!/usr/bin/env bash
[[ " help nginx:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
+source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
case "$1" in
help | nginx:help)
- help_content_func () {
- declare desc="return nginx plugin help content"
- cat<, (Re)builds nginx config for given app
- nginx:access-logs [-t], Show the nginx access logs for an application (-t follows)
- nginx:error-logs [-t], Show the nginx error logs for an application (-t follows)
-help_content
- }
+
if [[ $1 = "nginx:help" ]] ; then
- echo -e 'Usage: dokku nginx[:COMMAND]'
- echo ''
- echo 'Interact with Dokku'"'"'s Nginx proxy.'
- echo ''
- echo 'Additional commands:'
- help_content_func | sort | column -c2 -t -s,
+ help_formatted
else
help_content_func
fi
diff --git a/plugins/nginx-vhosts/functions b/plugins/nginx-vhosts/functions
index 8c88d9a48..8f1af2c40 100755
--- a/plugins/nginx-vhosts/functions
+++ b/plugins/nginx-vhosts/functions
@@ -6,6 +6,25 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
+help_formatted (){
+ echo -e 'Usage: dokku nginx[:COMMAND]'
+ echo ''
+ echo 'Interact with Dokku'"'"'s Nginx proxy.'
+ echo ''
+ echo 'Additional commands:'
+ help_content_func | sort | column -c2 -t -s,
+}
+
+help_content_func () {
+ declare desc="return nginx plugin help content"
+ cat<, (Re)builds nginx config for given app
+ nginx:access-logs [-t], Show the nginx access logs for an application (-t follows)
+ nginx:error-logs [-t], Show the nginx error logs for an application (-t follows)
+help_content
+ }
+
validate_nginx() {
declare desc="validate entire nginx config"
set +e
@@ -272,7 +291,14 @@ nginx_build_config() {
else
local SSL_VHOSTS=$(< "$DOKKU_ROOT/HOSTNAME")
fi
- local SSL_SERVER_NAME=$(echo "$SSL_VHOSTS" | xargs)
+ local SSL_SERVER_NAME
+ local host
+ for host in $SSL_VHOSTS; do
+ # SSL_SERVER_NAME should only contain items not in NOSSL_SERVER_NAME
+ if [[ ! $NOSSL_SERVER_NAME =~ (^|[[:space:]])$host($|[[:space:]]) ]]; then
+ SSL_SERVER_NAME="${host}${SSL_SERVER_NAME:+ $SSL_SERVER_NAME}"
+ fi
+ done
fi
local NGINX_VERSION="$(nginx -v 2>&1 | cut -d'/' -f 2)"
diff --git a/plugins/nginx-vhosts/plugin.toml b/plugins/nginx-vhosts/plugin.toml
index b7beac324..a9d71618b 100644
--- a/plugins/nginx-vhosts/plugin.toml
+++ b/plugins/nginx-vhosts/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core nginx-vhosts plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/nginx-vhosts/subcommands/default b/plugins/nginx-vhosts/subcommands/default
new file mode 100644
index 000000000..30cb86061
--- /dev/null
+++ b/plugins/nginx-vhosts/subcommands/default
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
+source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
+source "$PLUGIN_AVAILABLE_PATH/config/functions"
+source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
+
+nginx_main_cmd() {
+ declare desc="display nginx plugin help content"
+ local cmd="nginx"
+ help_formatted
+}
+
+nginx_main_cmd "$@"
diff --git a/plugins/plugin/plugin.toml b/plugins/plugin/plugin.toml
index 7e2660bd1..c51efc9f6 100644
--- a/plugins/plugin/plugin.toml
+++ b/plugins/plugin/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core plugin plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/proxy/plugin.toml b/plugins/proxy/plugin.toml
index c046c6ad6..9fac76603 100644
--- a/plugins/proxy/plugin.toml
+++ b/plugins/proxy/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core proxy plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/ps/plugin.toml b/plugins/ps/plugin.toml
index f25ef3c61..d8f492ffe 100644
--- a/plugins/ps/plugin.toml
+++ b/plugins/ps/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core ps plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/ps/subcommands/restore b/plugins/ps/subcommands/restore
index 0b7b83729..818c3d980 100755
--- a/plugins/ps/subcommands/restore
+++ b/plugins/ps/subcommands/restore
@@ -7,11 +7,20 @@ source "$PLUGIN_AVAILABLE_PATH/ps/functions"
ps_restore_cmd() {
declare desc="starts all apps with DOKKU_APP_RESTORE not set to 0 via command line"
local cmd="ps:restore"
+
+ if which parallel > /dev/null 2>&1; then
+ dokku_apps | parallel dokku ps:start
+ return
+ fi
+
for app in $(dokku_apps); do
local DOKKU_APP_RESTORE=$(config_get "$app" DOKKU_APP_RESTORE || true)
if [[ $DOKKU_APP_RESTORE != 0 ]]; then
echo "Restoring app $app ..."
- ps_start "$app"
+ if ps_start "$app"; then
+ continue
+ fi
+ dokku_log_warn "dokku ps:restore ${app} failed"
fi
done
}
diff --git a/plugins/repo/commands b/plugins/repo/commands
index 5025f89f5..816768bf3 100755
--- a/plugins/repo/commands
+++ b/plugins/repo/commands
@@ -7,7 +7,7 @@ case "$1" in
help_content_func () {
declare desc="return repo plugin help content"
cat<, Runs 'git gc --agressive' against the application's repo
+ repo:gc , Runs 'git gc --aggressive' against the application's repo
repo:purge-cache , Deletes the contents of the build cache stored in the repository
help_content
}
diff --git a/plugins/repo/plugin.toml b/plugins/repo/plugin.toml
index f354ceff0..2498cb82f 100644
--- a/plugins/repo/plugin.toml
+++ b/plugins/repo/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core repo plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/repo/subcommands/gc b/plugins/repo/subcommands/gc
index 0fd3f281e..fbeb9b153 100755
--- a/plugins/repo/subcommands/gc
+++ b/plugins/repo/subcommands/gc
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
repo_gc() {
- declare desc="runs 'git gc --agressive' against the application's repo"
+ declare desc="runs 'git gc --aggressive' against the application's repo"
local cmd="repo:gc"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
local APP="$2"; local APP_DIR="$DOKKU_ROOT/$APP"
diff --git a/plugins/shell/plugin.toml b/plugins/shell/plugin.toml
index 3e96e7c2e..2cc88f6aa 100644
--- a/plugins/shell/plugin.toml
+++ b/plugins/shell/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core shell plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/ssh-keys/functions b/plugins/ssh-keys/functions
index b6765691e..f45dce1ff 100755
--- a/plugins/ssh-keys/functions
+++ b/plugins/ssh-keys/functions
@@ -2,6 +2,13 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
+list_ssh_keys() {
+ declare desc="List ssh key hashes"
+ local cmd="ssh-keys:list"
+ verify_ssh_key_file
+ sshcommand list dokku
+}
+
verify_ssh_key_file() {
declare desc="Test that public key is valid"
[[ -s ${DOKKU_ROOT}/.ssh/authorized_keys ]] || dokku_log_fail "No public keys found."
diff --git a/plugins/ssh-keys/plugin.toml b/plugins/ssh-keys/plugin.toml
index f6c7db1c3..1bf62a150 100644
--- a/plugins/ssh-keys/plugin.toml
+++ b/plugins/ssh-keys/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core ssh-keys plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/ssh-keys/subcommands/default b/plugins/ssh-keys/subcommands/default
new file mode 100644
index 000000000..abdbaa619
--- /dev/null
+++ b/plugins/ssh-keys/subcommands/default
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
+source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
+source "$PLUGIN_AVAILABLE_PATH/ssh-keys/functions"
+
+ssh_keys_main_cmd() {
+ declare desc="an alias for ssh-keys:list"
+ local cmd="ssh-keys"
+ list_ssh_keys
+}
+
+ssh_keys_main_cmd "$@"
\ No newline at end of file
diff --git a/plugins/ssh-keys/subcommands/list b/plugins/ssh-keys/subcommands/list
index ce485bbd6..fb78c5e2a 100755
--- a/plugins/ssh-keys/subcommands/list
+++ b/plugins/ssh-keys/subcommands/list
@@ -3,11 +3,4 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/ssh-keys/functions"
-list_ssh_keys() {
- declare desc="List ssh key hashes"
- local cmd="ssh-keys:list"
- verify_ssh_key_file
- sshcommand list dokku
-}
-
list_ssh_keys "$@"
diff --git a/plugins/storage/functions b/plugins/storage/functions
index 767059f13..d65daeb26 100755
--- a/plugins/storage/functions
+++ b/plugins/storage/functions
@@ -2,6 +2,16 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
+storage_list_cmd() {
+ declare desc="List all bound mounts"
+ local cmd="storage:list"
+ local passed_phases="deploy"
+ [[ ! $2 ]] && dokku_log_fail "storage:list requires an app to list."
+ verify_app_name "$2" && local APP="$2"
+ echo "$APP volume bind-mounts:"
+ get_bind_mounts "$(get_phase_file_path "$passed_phases")"
+}
+
verify_paths() {
declare desc="verifies storage paths"
echo "$1" | grep -qe '^/.*\:/' || dokku_log_fail "Storage path must be two valid paths divided by colon."
diff --git a/plugins/storage/plugin.toml b/plugins/storage/plugin.toml
index b822d1c04..862e8342e 100644
--- a/plugins/storage/plugin.toml
+++ b/plugins/storage/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core storage plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/storage/subcommands/default b/plugins/storage/subcommands/default
new file mode 100644
index 000000000..194ef7942
--- /dev/null
+++ b/plugins/storage/subcommands/default
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
+source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
+source "$PLUGIN_CORE_AVAILABLE_PATH/storage/functions"
+source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions"
+
+storage_main_cmd() {
+ declare desc="an alias for storage:list"
+ local cmd="storage"
+ storage_list_cmd "$@"
+}
+
+storage_main_cmd "$@"
diff --git a/plugins/storage/subcommands/list b/plugins/storage/subcommands/list
index ecaab29b0..a16999a38 100755
--- a/plugins/storage/subcommands/list
+++ b/plugins/storage/subcommands/list
@@ -4,14 +4,5 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/storage/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions"
-storage_list_cmd() {
- declare desc="List all bound mounts"
- local cmd="storage:list"
- local passed_phases="deploy"
- [[ ! $2 ]] && dokku_log_fail "storage:list requires an app to list."
- verify_app_name "$2" && local APP="$2"
- echo "$APP volume bind-mounts:"
- get_bind_mounts "$(get_phase_file_path "$passed_phases")"
-}
storage_list_cmd "$@"
diff --git a/plugins/tags/plugin.toml b/plugins/tags/plugin.toml
index c5bc6d690..07231f6d2 100644
--- a/plugins/tags/plugin.toml
+++ b/plugins/tags/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core tags plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/plugins/tar/functions b/plugins/tar/functions
index 93b024645..a9c8aa049 100755
--- a/plugins/tar/functions
+++ b/plugins/tar/functions
@@ -24,7 +24,7 @@ tar_build() {
tar -x -C "$TAR_BUILD_TMP_WORK_DIR" -f "$DOKKU_ROOT/$APP/src.tar" --strip-components="$BOGUS_PARTS"
chmod -R u+r "$TAR_BUILD_TMP_WORK_DIR"
- if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]]; then
+ if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]] && [[ -z $(config_get "$APP" BUILDPACK_URL || true) ]]; then
plugn trigger pre-receive-app "$APP" "dockerfile" "$TAR_BUILD_TMP_WORK_DIR"
dokku_receive "$APP" "dockerfile" "$TAR_BUILD_TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
else
diff --git a/plugins/tar/plugin.toml b/plugins/tar/plugin.toml
index 25b425fcc..bf5dc5000 100644
--- a/plugins/tar/plugin.toml
+++ b/plugins/tar/plugin.toml
@@ -1,4 +1,4 @@
[plugin]
description = "dokku core tar plugin"
-version = "0.7.2"
+version = "0.8.0"
[plugin.config]
diff --git a/rpm.mk b/rpm.mk
index 1d430a9a3..67d7662d9 100644
--- a/rpm.mk
+++ b/rpm.mk
@@ -65,12 +65,20 @@ rpm-dokku:
cp /usr/local/share/man/man1/dokku.1 /tmp/build/usr/share/man/man1/dokku.1
gzip -9 /tmp/build/usr/share/man/man1/dokku.1
cp contrib/dokku-installer.py /tmp/build/usr/share/dokku/contrib
+ifeq ($(DOKKU_VERSION),master)
git describe --tags > /tmp/build/var/lib/dokku/VERSION
+else
+ echo $(DOKKU_VERSION) > /tmp/build/var/lib/dokku/VERSION
+endif
cat /tmp/build/var/lib/dokku/VERSION | cut -d '-' -f 1 | cut -d 'v' -f 2 > /tmp/build/var/lib/dokku/STABLE_VERSION
ifneq (,$(findstring false,$(IS_RELEASE)))
- sed -i.bak -e "s/^/`date +%s`:/" /tmp/build/var/lib/dokku/STABLE_VERSION && rm /tmp/build/var/lib/dokku/STABLE_VERSION.bak
+ sed -i.bak -e "s/^/`date +%s`-/" /tmp/build/var/lib/dokku/STABLE_VERSION && rm /tmp/build/var/lib/dokku/STABLE_VERSION.bak
endif
+ifdef DOKKU_GIT_REV
+ echo "$(DOKKU_GIT_REV)" > /tmp/build/var/lib/dokku/GIT_REV
+else
git rev-parse HEAD > /tmp/build/var/lib/dokku/GIT_REV
+endif
@echo "-> Creating rpm package"
VERSION=$$(cat /tmp/build/var/lib/dokku/STABLE_VERSION); \
diff --git a/tests/apps/multi/static/styles/main.scss b/tests/apps/multi/static/styles/main.scss
index 93efb53fa..20b7ae981 100644
--- a/tests/apps/multi/static/styles/main.scss
+++ b/tests/apps/multi/static/styles/main.scss
@@ -1,4 +1,4 @@
-// override scss variables within bootsrap by delaring them
+// override scss variables within bootsrap by declaring them
// before importing bootstrap
$brand-primary: #428bca !default;
diff --git a/tests/unit/10_apps.bats b/tests/unit/10_apps.bats
index 9558b3e9b..17ed29be3 100644
--- a/tests/unit/10_apps.bats
+++ b/tests/unit/10_apps.bats
@@ -90,3 +90,36 @@ teardown () {
echo "status: "$status
assert_success
}
+
+@test "(apps) apps:clone" {
+ deploy_app
+ run bash -c "dokku apps:clone $TEST_APP great-test-name"
+ echo "output: "$output
+ echo "status: "$status
+ assert_success
+ run bash -c "dokku apps | grep $TEST_APP"
+ echo "output: "$output
+ echo "status: "$status
+ assert_success
+ run bash -c "curl --silent --write-out '%{http_code}\n' `dokku url great-test-name` | grep 404"
+ echo "output: "$output
+ echo "status: "$status
+ assert_output ""
+ run bash -c "dokku --force apps:destroy great-test-name"
+ echo "output: "$output
+ echo "status: "$status
+ assert_success
+
+ run bash -c "dokku apps:clone --skip-deploy $TEST_APP great-test-name"
+ echo "output: "$output
+ echo "status: "$status
+ assert_success
+ run bash -c "curl --silent --write-out '%{http_code}\n' `dokku url great-test-name` | grep 404"
+ echo "output: "$output
+ echo "status: "$status
+ assert_failure
+ run bash -c "dokku --force apps:destroy great-test-name"
+ echo "output: "$output
+ echo "status: "$status
+ assert_success
+}
diff --git a/tests/unit/20_config.bats b/tests/unit/20_config.bats
index a5894372c..87dafa332 100644
--- a/tests/unit/20_config.bats
+++ b/tests/unit/20_config.bats
@@ -145,3 +145,17 @@ teardown() {
echo "status: "$status
assert_success
}
+
+@test "(config) deploy specific DOKKU_DEPLOY_BRANCH" {
+ run ssh dokku@dokku.me config:set --global DOKKU_DEPLOY_BRANCH=global-branch
+ GIT_REMOTE_BRANCH=global-branch deploy_app
+ echo "output: "$output
+ echo "status: "$status
+ assert_success
+
+ run ssh dokku@dokku.me config:set $TEST_APP DOKKU_DEPLOY_BRANCH=app-branch
+ GIT_REMOTE_BRANCH=app-branch deploy_app
+ echo "output: "$output
+ echo "status: "$status
+ assert_success
+}
diff --git a/tests/unit/test_helper.bash b/tests/unit/test_helper.bash
index e6d16da86..b59841339 100644
--- a/tests/unit/test_helper.bash
+++ b/tests/unit/test_helper.bash
@@ -196,10 +196,11 @@ assert_http_redirect() {
}
deploy_app() {
- local APP_TYPE="$1"; local APP_TYPE=${APP_TYPE:="nodejs-express"}
- local GIT_REMOTE="$2"; local GIT_REMOTE=${GIT_REMOTE:="dokku@dokku.me:$TEST_APP"}
- local CUSTOM_TEMPLATE="$3"; local TMP=$(mktemp -d "/tmp/dokku.me.XXXXX")
- local CUSTOM_PATH="$4"
+ declare APP_TYPE="$1" GIT_REMOTE="$2" CUSTOM_TEMPLATE="$3" CUSTOM_PATH="$4"
+ local APP_TYPE=${APP_TYPE:="nodejs-express"}
+ local GIT_REMOTE=${GIT_REMOTE:="dokku@dokku.me:$TEST_APP"}
+ local GIT_REMOTE_BRANCH=${GIT_REMOTE_BRANCH:="master"}
+ local TMP=$(mktemp -d "/tmp/dokku.me.XXXXX")
rmdir "$TMP" && cp -r "./tests/apps/$APP_TYPE" "$TMP"
@@ -218,7 +219,7 @@ deploy_app() {
[[ -f gitignore ]] && mv gitignore .gitignore
git add .
git commit -m 'initial commit'
- git push target master || destroy_app $?
+ git push target "master:${GIT_REMOTE_BRANCH}" || destroy_app $?
}
setup_client_repo() {