refactor: unify command declaration across codebase

This commit is contained in:
Jose Diaz-Gonzalez
2020-02-10 01:40:30 -05:00
parent b0abeb49dd
commit e67b96780d
108 changed files with 475 additions and 315 deletions

View File

@@ -235,8 +235,8 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
cmd-hello-default() {
declare desc="prints Hello \$APP"
declare cmd="hello" argv=("$@")
[[ ${argv[0]} == "$cmd" ]] && shift 1
declare cmd="hello"
[[ "$1" == "$cmd" ]] && shift 1
# Support --app/$DOKKU_APP_NAME flag
# Use the following lines to reorder args into "$cmd $DOKKU_APP_NAME $@""
[[ -n $DOKKU_APP_NAME ]] && set -- $DOKKU_APP_NAME $@
@@ -263,8 +263,8 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
cmd-hello-world() {
declare desc="prints Hello world"
declare cmd="hello:world" argv=("$@")
[[ ${argv[0]} == "$cmd" ]] && shift 1
declare cmd="hello:world"
[[ "$1" == "$cmd" ]] && shift 1
echo "Hello world"
}

View File

@@ -5,8 +5,9 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
cmd-report() {
declare desc="reports dokku vitals for troubleshooting"
local cmd="report"
declare APP="$2"
declare cmd="report"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
dokku_log_info1 "uname: $(uname -a)"
dokku_log_info1 "memory: "

View File

@@ -2,12 +2,12 @@
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
cmd-run() {
declare desc="runs command in container based on app image"
declare cmd="run" APP=""
shift
declare cmd="run"
[[ "$1" == "$cmd" ]] && shift 1
declare APP=""
declare -a RUN_ENV
RUN_ENV=()

View File

@@ -4,8 +4,11 @@ set -eo pipefail
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
cmd-urls() {
declare desc="reports dokku vitals for troubleshooting"
declare cmd="url"
declare APP="$2"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
local APP="$2"
get_app_urls "$@"
}

View File

@@ -5,9 +5,12 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
cmd-events-default() {
declare desc="shows contents of dokku events log"
local cmd="events"
declare cmd="events"
[[ "$1" == "$cmd" ]] && shift 1
declare TAIL="$1"
if [[ -f $DOKKU_EVENTS_LOGFILE ]]; then
if [[ $2 == "-t" ]]; then
if [[ "$TAIL" == "-t" ]]; then
tail -F "$DOKKU_EVENTS_LOGFILE"
else
tail -n 100 "$DOKKU_EVENTS_LOGFILE"

View File

@@ -5,7 +5,9 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
cmd-events-list() {
declare desc="lists enabled events"
local cmd="events:list"
declare cmd="events:list"
[[ "$1" == "$cmd" ]] && shift 1
local PLUGIN_DIR="$(dirname "$0")/.."
local logged hook

View File

@@ -5,7 +5,9 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
cmd-events-off() {
declare desc="disables dokku events logger"
local cmd="events:off"
declare cmd="events:off"
[[ "$1" == "$cmd" ]] && shift 1
echo "Disabling dokku events logger"
rm -f "$DOKKU_ROOT/.dokkurc/DOKKU_EVENTS"
}

View File

@@ -5,7 +5,9 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
cmd-events-on() {
declare desc="enables dokku events logger"
local cmd="events:on"
declare cmd="events:on"
[[ "$1" == "$cmd" ]] && shift 1
echo "Enabling dokku events logger"
[[ -d $DOKKU_ROOT/.dokkurc ]] || mkdir -p "$DOKKU_ROOT/.dokkurc"
echo "export DOKKU_EVENTS=1" >"$DOKKU_ROOT/.dokkurc/DOKKU_EVENTS"

View File

@@ -6,9 +6,10 @@ set -eo pipefail
cmd-apps-report() {
declare desc="displays the app report for one or more apps"
local cmd="apps:report"
declare cmd="apps:report"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS=$(dokku_apps)
local APP="$2" INFO_FLAG="$3"
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
@@ -80,7 +81,8 @@ cmd-apps-report-single() {
cmd-apps-list() {
declare desc="lists all apps"
local cmd="apps"
declare cmd="apps"
[[ "$1" == "$cmd" ]] && shift 1
local app
dokku_log_info2_quiet "My Apps"

View File

@@ -7,11 +7,10 @@ source "$PLUGIN_AVAILABLE_PATH/ps/functions"
cmd-apps-clone() {
declare desc="clones an app"
declare cmd="apps:clone" argv=("$@")
[[ ${argv[0]} == "$cmd" ]] && shift 1
declare cmd="apps:clone"
[[ "$1" == "$cmd" ]] && shift 1
declare OLD_APP="$1" NEW_APP="$2"
local IGNORE_EXISTING=false
local SKIP_REBUILD=false
local IGNORE_EXISTING=false SKIP_REBUILD=false
for arg in "$@"; do
[[ "$arg" == "--skip-deploy" ]] && shift 1 && SKIP_REBUILD=true

View File

@@ -5,8 +5,11 @@ source "$PLUGIN_AVAILABLE_PATH/apps/functions"
cmd-apps-create() {
declare desc="creates app via command line"
local cmd="apps:create"
apps_create "$2"
declare cmd="apps:create"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
apps_create "$APP"
}
cmd-apps-create "$@"

View File

@@ -6,11 +6,14 @@ source "$PLUGIN_AVAILABLE_PATH/apps/functions"
cmd-apps-destroy() {
declare desc="destroys an app"
local cmd="apps:destroy"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
[[ "$2" == "tls" ]] && dokku_log_fail "Unable to destroy tls directory"
[[ "$3" == "force" ]] && export DOKKU_APPS_FORCE_DELETE=1
local APP="$2"
declare cmd="apps:destroy"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" FORCE="$2"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
[[ "$APP" == "tls" ]] && dokku_log_fail "Unable to destroy tls directory"
[[ "$FORCE" == "force" ]] && export DOKKU_APPS_FORCE_DELETE=1
apps_destroy "$APP"
}

View File

@@ -5,7 +5,7 @@ source "$PLUGIN_AVAILABLE_PATH/apps/functions"
cmd-apps-exist() {
declare desc="checks if an app exists"
local cmd="apps:exists"
declare cmd="apps:exists"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"

View File

@@ -9,10 +9,9 @@ cmd-apps-lock() {
declare cmd="apps:lock"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
verify_app_name "$APP"
touch "$DOKKU_ROOT/$APP/.deploy.lock" || dokku_log_fail "Unable to create deploy lock"
dokku_log_info1 "Deploy lock created"
}

View File

@@ -9,6 +9,7 @@ cmd-apps-locked() {
declare cmd="apps:locked"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
verify_app_name "$APP"
local LOCKED="$(apps_is_locked "$APP")"

View File

@@ -7,11 +7,12 @@ source "$PLUGIN_AVAILABLE_PATH/ps/functions"
cmd-apps-rename() {
declare desc="renames an app"
local cmd="apps:rename"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
[[ -d "$DOKKU_ROOT/$3" ]] && dokku_log_fail "Name is already taken"
local OLD_APP="$2"
local NEW_APP="$3"
declare cmd="apps:rename"
[[ "$1" == "$cmd" ]] && shift 1
declare OLD_APP="$1" NEW_APP="$2"
[[ -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 OLD_CACHE_DIR="$DOKKU_ROOT/$OLD_APP/cache"
local OLD_CACHE_HOST_DIR="$DOKKU_HOST_ROOT/$OLD_APP/cache"

View File

@@ -6,9 +6,10 @@ set -eo pipefail
cmd-certs-report() {
declare desc="displays an ssl report for one or more apps"
local cmd="certs:report"
declare cmd="certs:report"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS=$(dokku_apps)
local APP="$2" INFO_FLAG="$3"
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
@@ -74,10 +75,12 @@ cmd-certs-report-single() {
cmd-certs-info() {
# 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"
declare cmd="certs:info"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$APP"
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
if is_ssl_enabled "$APP"; then

View File

@@ -30,12 +30,12 @@ is_file_import() {
cmd-certs-set() {
declare desc="imports an SSL cert/key combo either on STDIN via a tarball or from specified cert/key filenames"
local cmd="$1"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$2"
local APP="$2"
local CRT_FILE="$3"
local KEY_FILE="$4"
declare cmd="$1"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" CRT_FILE="$2" KEY_FILE="$3"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$APP"
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
if is_file_import "$CRT_FILE" "$KEY_FILE"; then

View File

@@ -6,8 +6,10 @@ source "$PLUGIN_AVAILABLE_PATH/domains/functions"
cmd-certs-generate() {
declare desc="generates a self-signed SSL certificate/key combo"
declare APP="$2" DOMAIN="$3"
local cmd="certs:generate"
declare cmd="certs:generate"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" DOMAIN="$2"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$APP"
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"

View File

@@ -5,10 +5,12 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
cmd-certs-remove() {
declare desc="removes SSL cert/key from specified app"
local cmd="certs:remove"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$2"
local APP="$2"
declare cmd="certs:remove"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$APP"
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
if [[ -d "$APP_SSL_PATH" ]]; then

View File

@@ -6,9 +6,10 @@ set -eo pipefail
cmd-checks-report() {
declare desc="shows reports for an app"
local cmd="checks:report"
declare cmd="checks:report"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS=$(dokku_apps)
local APP="$2" INFO_FLAG="$3"
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"

View File

@@ -6,11 +6,13 @@ source "$PLUGIN_AVAILABLE_PATH/checks/functions"
cmd-checks-default() {
declare desc="displays app zero-downtime checks status"
local cmd="checks"
declare cmd="checks"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
local APPS=$(dokku_apps)
if [[ -n "$1" ]]; then
local APPS="$1"
if [[ -n "$APP" ]]; then
local APPS="$APP"
fi
dokku_log_warn "Deprecated: Please use checks:report"

View File

@@ -6,9 +6,10 @@ source "$PLUGIN_AVAILABLE_PATH/checks/functions"
cmd-checks-disable() {
declare desc="disable zero-downtime checks for app/proctypes"
local cmd="checks:disable"
declare cmd="checks:disable"
[[ "$1" == "$cmd" ]] && shift 1
local APP="$1"
declare APP="$1"
verify_app_name "$APP"
local PROCTYPES="${2:-_all_}"
local DOKKU_CHECKS_DISABLED=$(config_get "$APP" DOKKU_CHECKS_DISABLED || true)

View File

@@ -6,9 +6,10 @@ source "$PLUGIN_AVAILABLE_PATH/checks/functions"
cmd-checks-enable() {
declare desc="enable zero-downtime checks for app/proctypes"
local cmd="checks:enable"
declare cmd="checks:enable"
[[ "$1" == "$cmd" ]] && shift 1
local APP="$1"
declare APP="$1"
verify_app_name "$APP"
local PROCTYPES="${2:-_all_}"

View File

@@ -69,9 +69,10 @@ check_process() {
cmd-checks-run() {
declare desc="run zero-downtime checks for app/proctypes"
local cmd="checks:run"
declare cmd="checks:run"
[[ "$1" == "$cmd" ]] && shift 1
local APP="$1"
declare APP="$1"
verify_app_name "$APP"
local PROCTYPES="${2:-_all_}"

View File

@@ -6,9 +6,10 @@ source "$PLUGIN_AVAILABLE_PATH/checks/functions"
cmd-checks-skip() {
declare desc="skip zero-downtime checks for app/proctypes"
local cmd="checks:skip"
declare cmd="checks:skip"
[[ "$1" == "$cmd" ]] && shift 1
local APP="$1"
declare APP="$1"
verify_app_name "$APP"
local PROCTYPES="${2:-_all_}"
local DOKKU_CHECKS_DISABLED=$(config_get "$APP" DOKKU_CHECKS_DISABLED || true)

View File

@@ -295,8 +295,7 @@ get_running_image_tag() {
is_image_herokuish_based() {
declare desc="returns true if app image is based on herokuish"
declare IMAGE="$1"
declare APP="$2"
declare IMAGE="$1" APP="$2"
local DOKKU_APP_USER
if [[ -n "$APP" ]]; then
DOKKU_APP_USER=$(config_get "$APP" DOKKU_APP_USER || true)

View File

@@ -6,9 +6,10 @@ set -eo pipefail
cmd-docker-options-report() {
declare desc="displays a docker options report for one or more apps"
local cmd="docker-options:report"
declare cmd="docker-options:report"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS=$(dokku_apps)
local APP="$2" INFO_FLAG="$3"
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"

View File

@@ -6,11 +6,13 @@ source "$PLUGIN_AVAILABLE_PATH/docker-options/functions"
cmd-docker-options-add() {
declare desc="Add a docker option to application"
local cmd="docker-options:add"
declare cmd="docker-options:add"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
verify_app_name "$2" && local APP="$2"
read -ra passed_phases <<<"$(get_phases "$3")"
shift 3 # everything else passed is the docker option
verify_app_name "$2"
read -ra passed_phases <<<"$(get_phases "$2")"
shift 2 # everything else passed is the docker option
local passed_docker_option="$*"
[[ -z "$passed_docker_option" ]] && dokku_log_fail "Please specify docker options to add to the phase"
add_passed_docker_option passed_phases[@] "${passed_docker_option[@]}"

View File

@@ -6,8 +6,8 @@ source "$PLUGIN_AVAILABLE_PATH/docker-options/functions"
cmd-docker-options-clear() {
declare desc="clear a docker options from application"
declare cmd="docker-options:clear" argv=("$@")
[[ ${argv[0]} == "$cmd" ]] && shift 1
declare cmd="docker-options:clear"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" PHASES="$2"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"

View File

@@ -6,11 +6,13 @@ source "$PLUGIN_AVAILABLE_PATH/docker-options/functions"
cmd-docker-options-default() {
declare desc="Display applications docker options"
local cmd="docker-options"
dokku_log_warn "Deprecated: Please use docker-options:report"
declare cmd="docker-options"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
verify_app_name "$2" && local APP="$2"
read -ra passed_phases <<<"$(get_phases "$3")"
dokku_log_warn "Deprecated: Please use docker-options:report"
verify_app_name "$APP"
read -ra passed_phases <<<"$(get_phases "$2")"
if [[ ! "${passed_phases[@]}" ]]; then
display_all_phases_options
else

View File

@@ -6,11 +6,13 @@ source "$PLUGIN_AVAILABLE_PATH/docker-options/functions"
cmd-docker-options-remove() {
declare desc="Remove a docker option from application"
local cmd="docker-options:remove"
declare cmd="docker-options:remove"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
verify_app_name "$2" && local APP="$2"
read -ra passed_phases <<<"$(get_phases "$3")"
shift 3 # everything else passed is the docker option
verify_app_name "$APP"
read -ra passed_phases <<<"$(get_phases "$2")"
shift 2 # everything else passed is the docker option
# shellcheck disable=SC2154
[[ -z ${passed_docker_option="$@"} ]] && dokku_log_fail "Please specify docker options to remove from the phase"
remove_passed_docker_option passed_phases[@] "${passed_docker_option[@]}"

View File

@@ -6,9 +6,10 @@ set -eo pipefail
cmd-domains-report() {
declare desc="displays a domains report for one or more apps"
local cmd="domains:report"
declare cmd="domains:report"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS=$(dokku_apps)
local APP="$2" INFO_FLAG="$3"
if [[ "$APP" == "--global" ]]; then
cmd-domains-report-single "$APP" "$INFO_FLAG"

View File

@@ -6,11 +6,12 @@ source "$PLUGIN_AVAILABLE_PATH/domains/functions"
cmd-domains-add() {
declare desc="adds domains to app via command line"
local cmd="domains:add"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
[[ -z $3 ]] && dokku_log_fail "Please specify a domain name. Usage: dokku $1 $2 <domain> [<domain> ...]"
declare cmd="domains:add"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" DOMAIN_NAME="$2"
shift 1
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
[[ -z "$DOMAIN_NAME" ]] && dokku_log_fail "Please specify a domain name. Usage: dokku $1 $2 <domain> [<domain> ...]"
domains_add "$@"
}

View File

@@ -6,10 +6,11 @@ source "$PLUGIN_AVAILABLE_PATH/domains/functions"
cmd-domains-add-global() {
declare desc="add global domain names via command line"
local cmd="domains:add-global"
[[ -z $2 ]] && dokku_log_fail "Please specify a domain name. Usage: dokku $1 <domain> [<domain> ...]"
declare cmd="domains:add-global"
[[ "$1" == "$cmd" ]] && shift 1
declare DOMAIN_NAME="$1"
shift 1
[[ -z "$DOMAIN_NAME" ]] && dokku_log_fail "Please specify a domain name. Usage: dokku $1 <domain> [<domain> ...]"
domains_add_global "$@"
}

View File

@@ -6,10 +6,12 @@ source "$PLUGIN_AVAILABLE_PATH/domains/functions"
cmd-domains-clear() {
declare desc="clear all app domains"
local cmd="domains:clear"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$2"
local APP="$2"
declare cmd="domains:clear"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$APP"
local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
rm -f "$APP_VHOST_PATH"

View File

@@ -6,8 +6,8 @@ source "$PLUGIN_AVAILABLE_PATH/domains/functions"
cmd-domains-clear-global() {
declare desc="clear global domain names via command line"
local cmd="domains:clear-global"
shift 1
declare cmd="domains:clear-global"
[[ "$1" == "$cmd" ]] && shift 1
dokku_log_info1_quiet "Clearing global domains"
domains_clear_global "$@"

View File

@@ -6,8 +6,9 @@ source "$PLUGIN_AVAILABLE_PATH/domains/functions"
cmd-domains-default() {
declare desc="print app domains"
local cmd="domains"
local APP="$2"
declare cmd="domains"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
dokku_log_warn "Deprecated: Please use domains:report"
if [[ "$(is_global_vhost_enabled)" == "true" ]]; then

View File

@@ -6,9 +6,12 @@ source "$PLUGIN_AVAILABLE_PATH/domains/functions"
cmd-domains-disable() {
declare desc="disable domains/VHOST support via command line"
local cmd="domains:disable"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
domains_disable "$2"
declare cmd="domains:disable"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
domains_disable "$APP"
}
cmd-domains-disable "$@"

View File

@@ -6,9 +6,12 @@ source "$PLUGIN_AVAILABLE_PATH/domains/functions"
cmd-domains-enable() {
declare desc="enable domains/VHOST support via command line"
local cmd="domains:enable"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
domains_enable "$2"
declare cmd="domains:enable"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
domains_enable "$APP"
}
cmd-domains-enable "$@"

View File

@@ -6,11 +6,12 @@ source "$PLUGIN_AVAILABLE_PATH/domains/functions"
cmd-domains-remove() {
declare desc="removes domains from app via command line"
local cmd="domains:remove"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
[[ -z $3 ]] && dokku_log_fail "Please specify a domain name. Usage: dokku $1 $2 <domain> [<domain> ...]"
declare cmd="domains:remove"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" DOMAIN_NAME="$2"
shift 1
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
[[ -z "$DOMAIN_NAME" ]] && dokku_log_fail "Please specify a domain name. Usage: dokku $1 $2 <domain> [<domain> ...]"
domains_remove "$@"
}

View File

@@ -6,10 +6,11 @@ source "$PLUGIN_AVAILABLE_PATH/domains/functions"
cmd-domains-remove-global() {
declare desc="remove global domain names via command line"
local cmd="domains:remove-global"
[[ -z $2 ]] && dokku_log_fail "Please specify a domain name. Usage: dokku $1 <domain> [<domain> ...]"
declare cmd="domains:remove-global"
[[ "$1" == "$cmd" ]] && shift 1
declare DOMAIN_NAME="$1"
shift 1
[[ -z "$DOMAIN_NAME" ]] && dokku_log_fail "Please specify a domain name. Usage: dokku $1 <domain> [<domain> ...]"
domains_remove_global "$@"
}

View File

@@ -6,11 +6,12 @@ source "$PLUGIN_AVAILABLE_PATH/domains/functions"
cmd-domains-set() {
declare desc="set domains for app via command line"
local cmd="domains:set"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
[[ -z $3 ]] && dokku_log_fail "Please specify a domain name. Usage: dokku $1 $2 <domain> [<domain> ...]"
declare cmd="domains:set"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" DOMAIN_NAME="$2"
shift 1
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
[[ -z "$DOMAIN_NAME" ]] && dokku_log_fail "Please specify a domain name. Usage: dokku $1 $2 <domain> [<domain> ...]"
domains_set "$@"
}

View File

@@ -6,10 +6,11 @@ source "$PLUGIN_AVAILABLE_PATH/domains/functions"
cmd-domains-set-global() {
declare desc="set global domain names via command line"
local cmd="domains:set-global"
[[ -z $2 ]] && dokku_log_fail "Please specify a domain name. Usage: dokku $1 <domain> [<domain> ...]"
declare cmd="domains:set-global"
[[ "$1" == "$cmd" ]] && shift 1
declare DOMAIN_NAME="$1"
shift 1
[[ -z "$DOMAIN_NAME" ]] && dokku_log_fail "Please specify a domain name. Usage: dokku $1 <domain> [<domain> ...]"
domains_set_global "$@"
}

View File

@@ -6,9 +6,12 @@ source "$PLUGIN_AVAILABLE_PATH/domains/functions"
cmd-domains-setup() {
declare desc="setup domains to default state via command line"
local cmd="domains:setup"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
domains_setup "$2"
declare cmd="domains:setup"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
domains_setup "$APP"
}
cmd-domains-setup "$@"

View File

@@ -6,15 +6,16 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
cmd-enter-default() {
declare desc="enters running app container of specified proc type"
local cmd="enter"
local APP="$2"
local CONTAINER_TYPE="$3"
declare cmd="enter"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" CONTAINER_TYPE="$2" CONTAINER_ID_FLAG="$3" CONTAINER_ID="$4"
local IMAGE_TAG=$(get_running_image_tag "$APP")
local IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG")
verify_app_name "$APP"
local AVAILABLE_CONTAINER_TYPES=($(get_app_running_container_types "$APP"))
if [[ -z "$3" ]]; then
if [[ -z "$CONTAINER_TYPE" ]]; then
if [[ ${#AVAILABLE_CONTAINER_TYPES[@]} -gt 1 ]]; then
dokku_log_warn "No container type specified."
dokku_log_fail "Available types for app ($APP): ${AVAILABLE_CONTAINER_TYPES[*]}"
@@ -23,9 +24,9 @@ cmd-enter-default() {
fi
fi
if [[ "$3" == "--container-id" ]]; then
if [[ "$CONTAINER_ID_FLAG" == "--container-id" ]]; then
local DOKKU_APP_CIDS=($(get_app_container_ids "$APP"))
if [[ -z "$4" ]]; then
if [[ -z "$CONTAINER_ID" ]]; then
dokku_log_warn "No container id specified."
dokku_log_fail "Available ids for app ($APP): ${DOKKU_APP_CIDS[*]}"
fi
@@ -34,7 +35,7 @@ cmd-enter-default() {
dokku_log_fail "Available ids for app ($APP): ${DOKKU_APP_CIDS[*]}"
fi
local ID=$(printf -- '%s\n' "${DOKKU_APP_CIDS[@]}" | grep -e "^$4")
shift 4
shift 3
else
local DOKKU_APP_CIDS=($(get_app_container_ids "$APP" "$CONTAINER_TYPE"))
local ID=${DOKKU_APP_CIDS[0]}
@@ -42,10 +43,10 @@ cmd-enter-default() {
dokku_log_warn "No containers found for type '$CONTAINER_TYPE'"
dokku_log_fail "Available types for app ($APP): ${AVAILABLE_CONTAINER_TYPES[*]}"
fi
if [[ $3 ]]; then
shift 3
else
if [[ "$CONTAINER_ID_FLAG" ]]; then
shift 2
else
shift 1
fi
fi

View File

@@ -109,7 +109,7 @@ git_trigger_build() {
git_deploy_branch() {
declare desc="retrieve the deploy branch for a given application"
local cmd="git-hook"
declare cmd="git-hook"
local APP="$1"
local DOKKU_DEPLOY_BRANCH="$(fn-plugin-property-get "git" "$APP" "deploy-branch" "")"
@@ -125,9 +125,11 @@ git_deploy_branch() {
cmd-git-hook() {
declare desc="kick off receive-app trigger from git prereceive hook"
local cmd="git-hook"
local APP="$2"
declare cmd="git-hook"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
local DOKKU_DEPLOY_BRANCH
is_valid_app_name "$APP"
DOKKU_DEPLOY_BRANCH="$(git_deploy_branch "$APP")"
@@ -198,7 +200,9 @@ git_receive_app() {
cmd-git-upload-pack() {
declare desc="executes git-upload-pack"
declare cmd="git-upload-pack"
declare APP="$2"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
APP="$(echo "$APP" | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g' | sed 's/^\///g')"
is_valid_app_name "$APP"
! apps_exists "$APP" >/dev/null 2>&1 && apps_maybe_create "$APP"
@@ -210,7 +214,7 @@ cmd-git-upload-pack() {
cmd-git-glob() {
declare desc="catch-all for any other git-* commands"
local cmd="git-*"
declare cmd="git-*"
local APP="$(echo "$2" | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g' | sed 's/^\///g')"
local APP_PATH=$DOKKU_ROOT/$APP
is_valid_app_name "$APP"

View File

@@ -6,9 +6,10 @@ set -eo pipefail
cmd-git-report() {
declare desc="displays a git report for one or more apps"
local cmd="git:report"
declare cmd="git:report"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS=$(dokku_apps)
local APP="$2" INFO_FLAG="$3"
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"

View File

@@ -6,11 +6,11 @@ set -eo pipefail
cmd-git-initialize() {
declare desc="initialize a git repository for an app"
local cmd="git:initialize" argv=("$@")
[[ ${argv[0]} == "$cmd" ]] && shift 1
declare cmd="git:initialize"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
is_valid_app_name "$APP"
is_valid_app_name "$APP"
dokku_log_info1_quiet "Initializing git repository for $APP"
fn-git-create-hook "$APP"
}

View File

@@ -6,10 +6,11 @@ set -eo pipefail
cmd-git-set() {
declare desc="set or clear a git property for an app"
local cmd="git:set" argv=("$@")
[[ ${argv[0]} == "$cmd" ]] && shift 1
declare cmd="git:set"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" KEY="$2" VALUE="$3"
local VALID_KEYS=("deploy-branch" "keep-git-dir" "rev-env-var")
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
[[ -z "$KEY" ]] && dokku_log_fail "No key specified"

View File

@@ -6,14 +6,16 @@ source "$PLUGIN_AVAILABLE_PATH/logs/internal-functions"
cmd-logs-default() {
declare desc="display recent log output"
local cmd="logs"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
local APP="$2"
verify_app_name "$2"
declare cmd="logs"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$APP"
! (is_deployed "$APP") && dokku_log_fail "App $APP has not been deployed"
shift 2
shift 1
local TEMP=$(getopt -o htqn:p: --long help,tail,quiet,num:,ps: -n 'dokku logs' -- "$@")
local EXIT_CODE="$?"
if [[ "$EXIT_CODE" != 0 ]]; then

View File

@@ -7,8 +7,8 @@ set -eo pipefail
cmd-logs-failed() {
declare desc="shows the last failed deploy logs"
declare cmd="logs:failed" argv=("$@")
[[ ${argv[0]} == "$cmd" ]] && shift 1
declare cmd="logs:failed"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
local DOKKU_SCHEDULER

View File

@@ -6,9 +6,10 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
cmd-nginx-report() {
declare desc="displays a nginx report for one or more apps"
local cmd="nginx:report"
declare cmd="nginx:report"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS=$(dokku_apps)
local APP="$2" INFO_FLAG="$3"
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"

View File

@@ -6,7 +6,8 @@ source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
cmd-nginx-logs() {
declare desc="display app nginx logs from command line"
local cmd="$1"
declare cmd="$1"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
nginx_logs "$@"
}

View File

@@ -6,8 +6,10 @@ source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
cmd-nginx-build-config() {
declare desc="build nginx config to proxy app containers from command line"
declare APP="$2"
local cmd="nginx:build-config"
declare cmd="nginx:build-config"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
local PROXY_APP_TYPE
PROXY_APP_TYPE="$(get_app_proxy_type "$APP")"

View File

@@ -6,10 +6,11 @@ set -eo pipefail
cmd-nginx-set() {
declare desc="set or clear an nginx property for an app"
local cmd="nginx:set" argv=("$@")
[[ ${argv[0]} == "$cmd" ]] && shift 1
declare cmd="nginx:set"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" KEY="$2" VALUE="$3"
local VALID_KEYS=("bind-address-ipv4" "bind-address-ipv6" "hsts" "hsts-include-subdomains" "hsts-preload" "hsts-max-age")
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
[[ -z "$KEY" ]] && dokku_log_fail "No key specified"

View File

@@ -5,11 +5,11 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
cmd-nginx-show-conf() {
declare desc="display app nginx config"
declare cmd="nginx:show-conf" argv=("$@")
[[ ${argv[0]} == "$cmd" ]] && shift 1
declare cmd="nginx:show-conf"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
verify_app_name "$APP"
verify_app_name "$APP"
if [[ ! -f "$DOKKU_ROOT/$APP/nginx.conf" ]]; then
dokku_log_fail "No nginx.conf exists for $APP"
fi

View File

@@ -6,9 +6,11 @@ source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
cmd-nginx-validate() {
declare desc="validates and optionally cleans up invalid nginx configurations"
declare cmd="nginx:validate" argv=("$@")
[[ ${argv[0]} == "$cmd" ]] && shift 1
validate_nginx "$@"
declare cmd="nginx:validate"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" FLAG="$2"
validate_nginx "$APP" "$FLAG"
}
cmd-nginx-validate "$@"

View File

@@ -5,7 +5,8 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
cmd-plugin-list() {
declare desc="lists all plugins"
local cmd="plugin"
declare cmd="plugin"
[[ "$1" == "$cmd" ]] && shift 1
plugn version
plugn list

View File

@@ -7,9 +7,11 @@ source "$PLUGIN_AVAILABLE_PATH/plugin/internal-functions"
cmd-plugin-disable() {
declare desc="disables plugin via command line"
local cmd="plugin:disable"
[[ -z $2 ]] && dokku_log_fail "Please specify a plugin to disable"
local PLUGIN="$2"
declare cmd="plugin:disable"
[[ "$1" == "$cmd" ]] && shift 1
declare PLUGIN="$1"
[[ -z "$PLUGIN" ]] && dokku_log_fail "Please specify a plugin to disable"
disable_plugin "$PLUGIN"
plugin_prime_bash_completion
}

View File

@@ -7,9 +7,11 @@ source "$PLUGIN_AVAILABLE_PATH/plugin/internal-functions"
cmd-plugin-enable() {
declare desc="enables plugin via command line"
local cmd="plugin:enable"
[[ -z $2 ]] && dokku_log_fail "Please specify a plugin to enable"
local PLUGIN="$2"
declare cmd="plugin:enable"
[[ "$1" == "$cmd" ]] && shift 1
declare PLUGIN="$1"
[[ -z "$PLUGIN" ]] && dokku_log_fail "Please specify a plugin to enable"
enable_plugin "$PLUGIN"
plugin_prime_bash_completion
}

View File

@@ -7,14 +7,16 @@ source "$PLUGIN_AVAILABLE_PATH/plugin/internal-functions"
cmd-plugin-install() {
declare desc="installs a plugin from URL and calls install plugin trigger via command line"
local cmd="plugin:install"
case "$2" in
declare cmd="plugin:install"
[[ "$1" == "$cmd" ]] && shift 1
declare FLAG="$1"
case "$FLAG" in
--core)
[[ "$#" -gt 2 ]] && dokku_log_info1_quiet "Cannot install additional core plugins, running core plugin install trigger"
[[ "$#" -gt 1 ]] && dokku_log_info1_quiet "Cannot install additional core plugins, running core plugin install trigger"
PLUGIN_PATH="$PLUGIN_CORE_PATH" plugn trigger install
;;
https:* | git* | ssh:* | file:* | *.tar.gz | *.tgz)
shift
download_and_enable_plugin "$@"
plugn trigger install
;;

View File

@@ -4,8 +4,11 @@ set -eo pipefail
cmd-plugin-install-dependencies() {
declare desc="calls dependencies plugin trigger via command line"
local cmd="plugin:install-dependencies"
if [[ $2 == "--core" ]]; then
declare cmd="plugin:install-dependencies"
[[ "$1" == "$cmd" ]] && shift 1
declare FLAG="$1"
if [[ "$FLAG" == "--core" ]]; then
export PLUGIN_PATH="$PLUGIN_CORE_PATH"
fi
plugn trigger dependencies

View File

@@ -4,7 +4,7 @@ set -eo pipefail
cmd-plugin-trigger() {
declare desc="trigger an arbitrary plugin hook"
local cmd="plugin:trigger"
declare cmd="plugin:trigger"
[[ "$1" == "$cmd" ]] && shift 1
plugn trigger "$@"

View File

@@ -7,9 +7,11 @@ source "$PLUGIN_AVAILABLE_PATH/plugin/internal-functions"
cmd-plugin-uninstall() {
declare desc="uninstalls plugin via command line"
local cmd="plugin:uninstall"
[[ -z $2 ]] && dokku_log_fail "Please specify a plugin to uninstall"
local PLUGIN="$2"
declare cmd="plugin:uninstall"
[[ "$1" == "$cmd" ]] && shift 1
declare PLUGIN="$1"
[[ -z "$PLUGIN" ]] && dokku_log_fail "Please specify a plugin to uninstall"
uninstall_plugin "$PLUGIN"
plugin_prime_bash_completion
}

View File

@@ -5,10 +5,11 @@ source "$PLUGIN_AVAILABLE_PATH/plugin/internal-functions"
cmd-plugin-update() {
declare desc="updates plugin to optional committish and calls update plugin trigger via command line"
local cmd="plugin:update"
if [[ -n "$2" ]]; then
local PLUGIN="$2"
local PLUGIN_COMMITTISH="$3"
declare cmd="plugin:update"
[[ "$1" == "$cmd" ]] && shift 1
declare PLUGIN="$1" PLUGIN_COMMITTISH="$2"
if [[ -n "$PLUGIN" ]]; then
plugn update "$PLUGIN" "$PLUGIN_COMMITTISH"
fi
plugn trigger update

View File

@@ -6,9 +6,10 @@ set -eo pipefail
cmd-proxy-report() {
declare desc="displays a proxy report for one or more apps"
local cmd="proxy:report"
declare cmd="proxy:report"
[[ "$1" == "$cmd" ]] && shift 1
local INSTALLED_APPS=$(dokku_apps)
local APP="$2" INFO_FLAG="$3"
local APP="$1" INFO_FLAG="$2"
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"

View File

@@ -6,11 +6,13 @@ source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
cmd-proxy-default() {
declare desc="displays app proxy implementation via command line"
local cmd="proxy"
declare cmd="proxy"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
local APPS=$(dokku_apps)
if [[ -n "$1" ]]; then
local APPS="$1"
if [[ -n "$APP" ]]; then
local APPS="$APP"
fi
dokku_log_warn "Deprecated: Please use proxy:report"

View File

@@ -7,9 +7,11 @@ source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
cmd-proxy-disable() {
declare desc="disable proxy for app via command line"
local cmd="proxy:disable"
[[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on"
local APP="$1"
declare cmd="proxy:disable"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$APP"
if [[ "$(is_app_proxy_enabled "$APP")" == "true" ]]; then

View File

@@ -7,9 +7,11 @@ source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
cmd-proxy-enable() {
declare desc="enable proxy for app via command line"
local cmd="proxy:enable"
[[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on"
local APP="$1"
declare cmd="proxy:enable"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$APP"
if [[ "$(is_app_proxy_enabled "$APP")" == "false" ]]; then

View File

@@ -7,10 +7,11 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
cmd-proxy-ports() {
declare desc="cmd wrapper to list proxy port mappings for an app"
local cmd="proxy:ports"
local APP="$2"
verify_app_name "$APP"
declare cmd="proxy:ports"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
verify_app_name "$APP"
list_app_proxy_ports "$APP"
}

View File

@@ -6,10 +6,12 @@ source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
cmd-proxy-ports-add() {
declare desc="add proxy port mappings to an app"
local cmd="proxy:add"
local APP="$2"
declare cmd="proxy:add"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
verify_app_name "$APP"
shift 2
shift 1
add_proxy_ports "$APP" "$@"
plugn trigger post-proxy-ports-update "$APP" "add"

View File

@@ -6,10 +6,11 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
cmd-proxy-ports-clear() {
declare desc="clear all proxy port mappings for an app"
local cmd="proxy:clear"
local APP="$2"
verify_app_name "$APP"
declare cmd="proxy:clear"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
verify_app_name "$APP"
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$APP" DOKKU_PROXY_PORT_MAP
plugn trigger post-proxy-ports-update "$APP" "clear"
}

View File

@@ -6,10 +6,12 @@ source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
cmd-proxy-ports-remove() {
declare desc="remove specific proxy port mappings from an app"
local cmd="proxy:ports-remove"
local APP="$2"
declare cmd="proxy:ports-remove"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
verify_app_name "$APP"
shift 2
shift 1
local INPUT_PORTS="$*"
if [[ -z "$INPUT_PORTS" ]]; then

View File

@@ -6,10 +6,12 @@ source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
cmd-proxy-ports-set() {
declare desc="set proxy port mappings for an app"
local cmd="proxy:set"
local APP="$2"
declare cmd="proxy:set"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
verify_app_name "$APP"
shift 2
shift 1
set_proxy_ports "$APP" "$@"
plugn trigger post-proxy-ports-update "$APP" "set"

View File

@@ -6,12 +6,12 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
cmd-proxy-set() {
declare desc="enable proxy for app via command line"
local cmd="proxy:set"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
declare cmd="proxy:set"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" PROXY_TYPE="$2"
local APP="$2"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$APP"
local PROXY_TYPE="$3"
if [[ -n "$PROXY_TYPE" ]]; then
DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$APP" DOKKU_APP_PROXY_TYPE="$PROXY_TYPE"

View File

@@ -8,8 +8,9 @@ set -eo pipefail
cmd-ps-inspect() {
declare desc="displays a sanitized version of docker inspect for an app"
local cmd="ps:inspect"
local APP="$2"
declare cmd="ps:inspect"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
verify_app_name "$APP"
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
@@ -18,9 +19,10 @@ cmd-ps-inspect() {
cmd-ps-report() {
declare desc="displays a ps report for one or more apps"
local cmd="ps:report"
declare cmd="ps:report"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS=$(dokku_apps)
local APP="$2" INFO_FLAG="$3"
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"

View File

@@ -5,12 +5,13 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
cmd-ps-default() {
declare desc="shows running processes in all running app containers"
local cmd="ps"
declare cmd="ps"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
dokku_log_warn "Deprecated: Please use ps:report"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
local APP="$2"
verify_app_name "$APP"
! (is_deployed "$APP") && dokku_log_warn "App $APP has not been deployed" && exit 0

View File

@@ -6,8 +6,10 @@ source "$PLUGIN_AVAILABLE_PATH/ps/functions"
cmd-ps-rebuild() {
declare desc="rebuilds an app from source"
local cmd="ps:rebuild"
local APP="$2"
declare cmd="ps:rebuild"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
if (is_deployed "$APP"); then

View File

@@ -6,7 +6,8 @@ source "$PLUGIN_AVAILABLE_PATH/ps/internal-functions"
cmd-ps-rebuildall() {
declare desc="rebuilds all apps from source"
local cmd="ps:rebuildall"
declare cmd="ps:rebuildall"
[[ "$1" == "$cmd" ]] && shift 1
fn-ps-parallel-cmd "rebuild"
}

View File

@@ -6,9 +6,12 @@ source "$PLUGIN_AVAILABLE_PATH/ps/functions"
cmd-ps-restart() {
declare desc="restarts app via command line"
local cmd="ps:restart"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
ps_restart "$2"
declare cmd="ps:restart"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
ps_restart "$APP"
}
cmd-ps-restart "$@"

View File

@@ -7,10 +7,13 @@ source "$PLUGIN_AVAILABLE_PATH/ps/functions"
cmd-ps-restart-policy() {
declare desc="shows the restart-policy for an app"
local cmd="ps:restart-policy"
declare cmd="ps:restart-policy"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
local passed_phases="deploy"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$2" && local APP="$2"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$APP"
dokku_log_info2_quiet "$APP restart-policy:"
get_restart_policies "$(get_phase_file_path "$passed_phases")"

View File

@@ -6,7 +6,8 @@ source "$PLUGIN_AVAILABLE_PATH/ps/internal-functions"
cmd-ps-restartall() {
declare desc="restarts all apps via command line"
local cmd="ps:restartall"
declare cmd="ps:restartall"
[[ "$1" == "$cmd" ]] && shift 1
fn-ps-parallel-cmd "restart"
}

View File

@@ -8,8 +8,9 @@ source "$PLUGIN_AVAILABLE_PATH/ps/internal-functions"
cmd-ps-restore() {
declare desc="starts all apps with DOKKU_APP_RESTORE not set to 0 via command line"
local cmd="ps:restore"
local APP="$2"
declare cmd="ps:restore"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
local DOKKU_SCHEDULER
DOKKU_SCHEDULER=$(get_app_scheduler "$APP")

View File

@@ -6,7 +6,9 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
cmd-ps-retire() {
declare desc="ensures old containers are retired"
local cmd="ps:retire"
declare cmd="ps:retire"
[[ "$1" == "$cmd" ]] && shift 1
local LOCK_FILE="${DOKKU_LIB_ROOT}/data/ps/retire"
local DOKKU_SCHEDULER=$(config_get "--global" DOKKU_SCHEDULER || echo "docker-local")

View File

@@ -6,9 +6,11 @@ source "$PLUGIN_AVAILABLE_PATH/ps/functions"
cmd-ps-scale() {
declare desc="sets app scaling config via command line"
local cmd="ps:scale"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
shift 1
declare cmd="ps:scale"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
ps_scale "$@"
}

View File

@@ -7,10 +7,12 @@ source "$PLUGIN_AVAILABLE_PATH/ps/functions"
cmd-ps-set-restart-policy() {
declare desc="sets app restart-policy"
local cmd="ps:set-restart-policy"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$2" && local APP="$2"
local RESTART_POLICY="$3"
declare cmd="ps:set-restart-policy"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" RESTART_POLICY="$2"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$APP"
local RE_RESTART_POLICY="^(no|unless-stopped|always|on-failure(:[1-9][0-9]*)?)$"
if [[ ! "$RESTART_POLICY" =~ $RE_RESTART_POLICY ]]; then

View File

@@ -6,9 +6,12 @@ source "$PLUGIN_AVAILABLE_PATH/ps/functions"
cmd-ps-start() {
declare desc="starts app via command line"
local cmd="ps:start"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
ps_start "$2"
declare cmd="ps:start"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
ps_start "$APP"
}
cmd-ps-start "$@"

View File

@@ -6,7 +6,8 @@ source "$PLUGIN_AVAILABLE_PATH/ps/internal-functions"
cmd-ps-startall() {
declare desc="starts all apps via command line"
local cmd="ps:startall"
declare cmd="ps:startall"
[[ "$1" == "$cmd" ]] && shift 1
fn-ps-parallel-cmd "start"
}

View File

@@ -6,9 +6,12 @@ source "$PLUGIN_AVAILABLE_PATH/ps/functions"
cmd-ps-stop() {
declare desc="stops app via command line"
local cmd="ps:stop"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
ps_stop "$2"
declare cmd="ps:stop"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
ps_stop "$APP"
}
cmd-ps-stop "$@"

View File

@@ -6,7 +6,8 @@ source "$PLUGIN_AVAILABLE_PATH/ps/internal-functions"
cmd-ps-stopall() {
declare desc="stops all apps via command line"
local cmd="ps:stopall"
declare cmd="ps:stopall"
[[ "$1" == "$cmd" ]] && shift 1
fn-ps-parallel-cmd "stop"
}

View File

@@ -7,9 +7,10 @@ set -eo pipefail
cmd-scheduler-docker-local-report() {
declare desc="displays a scheduler-docker-local report for one or more apps"
local cmd="scheduler-docker-local:report"
declare cmd="scheduler-docker-local:report"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS=$(dokku_apps)
local APP="$2" INFO_FLAG="$3"
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"

View File

@@ -6,10 +6,11 @@ set -eo pipefail
cmd-scheduler-docker-local-set() {
declare desc="set or clear a scheduler-docker-local property for an app"
local cmd="scheduler-docker-local:set" argv=("$@")
[[ ${argv[0]} == "$cmd" ]] && shift 1
declare cmd="scheduler-docker-local:set"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" KEY="$2" VALUE="$3"
local VALID_KEYS=("disable-chown")
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
[[ -z "$KEY" ]] && dokku_log_fail "No key specified"

View File

@@ -4,7 +4,7 @@ set -eo pipefail
cmd-shell-default() {
declare desc="dokku shell interpreter via command line"
local cmd="shell"
declare cmd="shell"
local INPUTRC="$PLUGIN_ROOT/inputrc"
local HISTFILE=~/.dokku_history

View File

@@ -4,7 +4,9 @@ set -eo pipefail
cmd-list-ssh-keys() {
declare desc="List ssh key hashes"
local cmd="ssh-keys:list"
declare cmd="ssh-keys:list"
[[ "$1" == "$cmd" ]] && shift 1
verify_ssh_key_file
sshcommand list dokku
}

View File

@@ -6,10 +6,11 @@ source "$PLUGIN_AVAILABLE_PATH/ssh-keys/functions"
cmd-ssh-keys-add() {
declare desc="add a new key via sshcommand"
local cmd="ssh-keys:add"
declare cmd="ssh-keys:add"
[[ "$1" == "$cmd" ]] && shift 1
declare NAME="$1" KEY_FILE="$2"
local TMP_KEY_FILE
TMP_KEY_FILE=$(mktemp "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX")
trap "rm -rf '$TMP_KEY_FILE' >/dev/null" RETURN INT TERM EXIT

View File

@@ -6,12 +6,13 @@ source "$PLUGIN_AVAILABLE_PATH/ssh-keys/functions"
cmd-ssh-keys-remove() {
declare desc="Removes key from authorized_keys"
local cmd="ssh-keys:remove"
shift
local name="$1"
declare cmd="ssh-keys:remove"
[[ "$1" == "$cmd" ]] && shift 1
declare NAME="$1"
verify_ssh_key_file
[[ -z $1 ]] && dokku_log_fail "A name is required to remove a key, ie: dokku ssh-keys:remove <name>"
sshcommand acl-remove dokku "$name" || dokku_log_fail "sshcommand returned an error $?"
[[ -z "$NAME" ]] && dokku_log_fail "A name is required to remove a key, ie: dokku ssh-keys:remove <name>"
sshcommand acl-remove dokku "$NAME" || dokku_log_fail "sshcommand returned an error $?"
}
cmd-ssh-keys-remove "$@"

View File

@@ -7,9 +7,10 @@ set -eo pipefail
cmd-storage-report() {
declare desc="displays a storage report for one or more apps"
local cmd="storage:report"
declare cmd="storage:report"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS=$(dokku_apps)
local APP="$2" INFO_FLAG="$3"
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
@@ -77,10 +78,13 @@ fn-storage-bind-mounts() {
cmd-storage-list() {
declare desc="List all bound mounts"
local cmd="storage:list"
declare cmd="storage:list"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
local passed_phases="deploy"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$2" && local APP="$2"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$APP"
dokku_log_quiet "$APP volume bind-mounts:"
get_bind_mounts "$(get_phase_file_path "$passed_phases")"
}

View File

@@ -7,11 +7,14 @@ source "$PLUGIN_AVAILABLE_PATH/docker-options/functions"
cmd-storage-mount() {
declare desc="Add bind-mount, redeploy app if running"
local cmd="storage:mount"
declare cmd="storage:mount"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" MOUNT_PATH="$2"
local passed_phases=(deploy run)
[[ -z $3 || $4 ]] && dokku_log_fail "storage:mount requires an app and a two paths divided by colon."
verify_app_name "$2" && local APP="$2"
verify_paths "$3" && local MOUNT_PATH="$3"
[[ -z "$APP" || "$MOUNT_PATH" ]] && dokku_log_fail "storage:mount requires an app and a two paths divided by colon."
verify_app_name "$APP"
verify_paths "$MOUNT_PATH"
check_if_path_exists "$MOUNT_PATH" "$(get_phase_file_path "${passed_phases[@]}")" && dokku_log_fail "Mount path already exists."
add_passed_docker_option passed_phases[@] "-v $MOUNT_PATH"
}

View File

@@ -7,11 +7,14 @@ source "$PLUGIN_AVAILABLE_PATH/docker-options/functions"
cmd-storage-unmount() {
declare desc="Remove bind-mount, restart app if running"
local cmd="storage:unmount"
declare cmd="storage:unmount"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" MOUNT_PATH="$2"
local passed_phases=(deploy run)
[[ -z $3 || $4 ]] && dokku_log_fail "storage:unmount requires an app and a two paths divided by colon."
verify_app_name "$2" && local APP="$2"
verify_paths "$3" && local MOUNT_PATH="$3"
[[ -z "$APP" || "$MOUNT_PATH" ]] && dokku_log_fail "storage:unmount requires an app and a two paths divided by colon."
verify_app_name "$APP"
verify_paths "$MOUNT_PATH"
check_if_path_exists "$MOUNT_PATH" "$(get_phase_file_path "${passed_phases[@]}")" || dokku_log_fail "Mount path does not exist."
remove_passed_docker_option passed_phases[@] "-v $MOUNT_PATH"
}

Some files were not shown because too many files have changed in this diff Show More