use declare for description variable
This commit is contained in:
1 parent
d8e00f4f8a
commit
987c5cfb9c
111 files changed
+225
-225
No files matched your search
@@ -20,7 +20,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
hello_main_cmd() {
|
hello_main_cmd() {
|
||||||
local desc="prints Hello \$APP"
|
declare desc="prints Hello \$APP"
|
||||||
local cmd="hello"
|
local cmd="hello"
|
||||||
# Support --app/$DOKKU_APP_NAME flag
|
# Support --app/$DOKKU_APP_NAME flag
|
||||||
# Use the following lines to reorder args into "$cmd $DOKKU_APP_NAME $@""
|
# Use the following lines to reorder args into "$cmd $DOKKU_APP_NAME $@""
|
||||||
@@ -48,7 +48,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
hello_world_cmd() {
|
hello_world_cmd() {
|
||||||
local desc="prints Hello World"
|
declare desc="prints Hello World"
|
||||||
local cmd="hello:world"
|
local cmd="hello:world"
|
||||||
# Support --app/$DOKKU_APP_NAME flag
|
# Support --app/$DOKKU_APP_NAME flag
|
||||||
# Use the following lines to reorder args into "$cmd $DOKKU_APP_NAME $@""
|
# Use the following lines to reorder args into "$cmd $DOKKU_APP_NAME $@""
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ if ! dokku_auth "$@" ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
execute_dokku_cmd() {
|
execute_dokku_cmd() {
|
||||||
local desc="executes dokku sub-commands"
|
declare desc="executes dokku sub-commands"
|
||||||
local PLUGIN_NAME="$1"
|
local PLUGIN_NAME="$1"
|
||||||
local PLUGIN_CMD=$PLUGIN_NAME
|
local PLUGIN_CMD=$PLUGIN_NAME
|
||||||
local implemented=0; local script
|
local implemented=0; local script
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
get_phase_script() {
|
get_phase_script() {
|
||||||
local desc="extracts app.json from app image and returns the appropriate json key/value"
|
declare desc="extracts app.json from app image and returns the appropriate json key/value"
|
||||||
local IMAGE="$1"; local PHASE_SCRIPT_KEY="$2"
|
local IMAGE="$1"; local PHASE_SCRIPT_KEY="$2"
|
||||||
local TMP_WORK_DIR=$(mktemp -d -t "dokku_get_phase_script.XXXX")
|
local TMP_WORK_DIR=$(mktemp -d -t "dokku_get_phase_script.XXXX")
|
||||||
local APP_JSON_FILE="$TMP_WORK_DIR/app.json"
|
local APP_JSON_FILE="$TMP_WORK_DIR/app.json"
|
||||||
@@ -21,7 +21,7 @@ get_phase_script() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
execute_script() {
|
execute_script() {
|
||||||
local desc="executes appropriate phase script key from app.json"
|
declare desc="executes appropriate phase script key from app.json"
|
||||||
local APP="$1"; local IMAGE="$2"; local PHASE_SCRIPT_KEY="$3"
|
local APP="$1"; local IMAGE="$2"; local PHASE_SCRIPT_KEY="$3"
|
||||||
local SCRIPT_CMD=$(get_phase_script "$IMAGE" "$PHASE_SCRIPT_KEY")
|
local SCRIPT_CMD=$(get_phase_script "$IMAGE" "$PHASE_SCRIPT_KEY")
|
||||||
if [[ -n "$SCRIPT_CMD" ]];then
|
if [[ -n "$SCRIPT_CMD" ]];then
|
||||||
@@ -46,7 +46,7 @@ execute_script() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
exec_app_json_scripts() {
|
exec_app_json_scripts() {
|
||||||
local desc="core app.json scripts execution"
|
declare desc="core app.json scripts execution"
|
||||||
local trigger="$0 app_json_scripts"
|
local trigger="$0 app_json_scripts"
|
||||||
local APP="$1"
|
local APP="$1"
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
dokku_build_cmd() {
|
dokku_build_cmd() {
|
||||||
local desc="build phase"
|
declare desc="build phase"
|
||||||
local cmd="build"
|
local cmd="build"
|
||||||
local APP="$2"; local IMAGE_SOURCE_TYPE="$3"; local TMP_WORK_DIR="$4"; local IMAGE=$(get_app_image_name "$APP")
|
local APP="$2"; local IMAGE_SOURCE_TYPE="$3"; local TMP_WORK_DIR="$4"; local IMAGE=$(get_app_image_name "$APP")
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
dokku_cleanup_cmd(){
|
dokku_cleanup_cmd(){
|
||||||
local desc="cleans up old deployment cruft"
|
declare desc="cleans up old deployment cruft"
|
||||||
local cmd="cleanup"
|
local cmd="cleanup"
|
||||||
|
|
||||||
docker_cleanup
|
docker_cleanup
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/proxy/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/proxy/functions"
|
||||||
|
|
||||||
dokku_deploy_cmd() {
|
dokku_deploy_cmd() {
|
||||||
local desc="deploy phase"
|
declare desc="deploy phase"
|
||||||
local cmd="deploy"
|
local cmd="deploy"
|
||||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to deploy"
|
[[ -z $2 ]] && dokku_log_fail "Please specify an app to deploy"
|
||||||
local APP="$2"; local IMAGE_TAG="$3"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
local APP="$2"; local IMAGE_TAG="$3"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||||
@@ -85,7 +85,7 @@ dokku_deploy_cmd() {
|
|||||||
|
|
||||||
# if we can't post-deploy successfully, kill new container
|
# if we can't post-deploy successfully, kill new container
|
||||||
kill_new() {
|
kill_new() {
|
||||||
local desc="wrapper function to kill newly started app container"
|
declare desc="wrapper function to kill newly started app container"
|
||||||
local id="$1"
|
local id="$1"
|
||||||
docker inspect "$id" &> /dev/null && docker stop "$id" > /dev/null && docker kill "$id" &> /dev/null
|
docker inspect "$id" &> /dev/null && docker stop "$id" > /dev/null && docker kill "$id" &> /dev/null
|
||||||
trap - INT TERM EXIT
|
trap - INT TERM EXIT
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
dokku_ls_cmd() {
|
dokku_ls_cmd() {
|
||||||
local desc="lists installed apps with status"
|
declare desc="lists installed apps with status"
|
||||||
local cmd="ls"
|
local cmd="ls"
|
||||||
local installed_apps=$(dokku_apps)
|
local installed_apps=$(dokku_apps)
|
||||||
local dokku_app
|
local dokku_app
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
dokku_receive_cmd() {
|
dokku_receive_cmd() {
|
||||||
local desc="receives an app kicks off deploy process"
|
declare desc="receives an app kicks off deploy process"
|
||||||
local cmd="receive"
|
local cmd="receive"
|
||||||
local APP="$2"; local IMAGE=$(get_app_image_name "$APP"); local IMAGE_SOURCE_TYPE="$3"; local TMP_WORK_DIR="$4"
|
local APP="$2"; local IMAGE=$(get_app_image_name "$APP"); local IMAGE_SOURCE_TYPE="$3"; local TMP_WORK_DIR="$4"
|
||||||
if [[ -z "$DOKKU_SKIP_CLEANUP" ]]; then
|
if [[ -z "$DOKKU_SKIP_CLEANUP" ]]; then
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
dokku_release_cmd() {
|
dokku_release_cmd() {
|
||||||
local desc="release phase"
|
declare desc="release phase"
|
||||||
local cmd="release"
|
local cmd="release"
|
||||||
local APP="$2"; local IMAGE_SOURCE_TYPE="$3"; local IMAGE_TAG="$4"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
local APP="$2"; local IMAGE_SOURCE_TYPE="$3"; local IMAGE_TAG="$4"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
dokku_report_cmd() {
|
dokku_report_cmd() {
|
||||||
local desc="reports dokku vitals for troubleshooting"
|
declare desc="reports dokku vitals for troubleshooting"
|
||||||
local cmd="report"
|
local cmd="report"
|
||||||
|
|
||||||
dokku_log_info1 "uname: $(uname -a)"
|
dokku_log_info1 "uname: $(uname -a)"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
dokku_run_cmd() {
|
dokku_run_cmd() {
|
||||||
local desc="runs command in container based on app image"
|
declare desc="runs command in container based on app image"
|
||||||
local cmd="run"
|
local cmd="run"
|
||||||
[[ -z $2 ]] && 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"; local IMAGE_TAG=$(get_running_image_tag "$APP"); local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
local APP="$2"; local IMAGE_TAG=$(get_running_image_tag "$APP"); local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
dokku_trace_cmd() {
|
dokku_trace_cmd() {
|
||||||
local desc="enables/disables DOKKU_TRACE"
|
declare desc="enables/disables DOKKU_TRACE"
|
||||||
local cmd="trace"
|
local cmd="trace"
|
||||||
[[ -d $DOKKU_ROOT/.dokkurc ]] || mkdir -p "$DOKKU_ROOT/.dokkurc"
|
[[ -d $DOKKU_ROOT/.dokkurc ]] || mkdir -p "$DOKKU_ROOT/.dokkurc"
|
||||||
[[ "$2" == "on" ]] || [[ "$2" == "off" ]] || {
|
[[ "$2" == "on" ]] || [[ "$2" == "off" ]] || {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/proxy/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/proxy/functions"
|
||||||
|
|
||||||
dokku_version_cmd() {
|
dokku_version_cmd() {
|
||||||
local desc="prints dokku version"
|
declare desc="prints dokku version"
|
||||||
local cmd="version"
|
local cmd="version"
|
||||||
cat "$DOKKU_ROOT/VERSION" || dokku_log_fail "Unable to determine dokku's version"
|
cat "$DOKKU_ROOT/VERSION" || dokku_log_fail "Unable to determine dokku's version"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
events_main_cmd() {
|
events_main_cmd() {
|
||||||
local desc="shows contents of dokku events log"
|
declare desc="shows contents of dokku events log"
|
||||||
local cmd="events"
|
local cmd="events"
|
||||||
if [[ -f $DOKKU_EVENTS_LOGFILE ]]; then
|
if [[ -f $DOKKU_EVENTS_LOGFILE ]]; then
|
||||||
if [[ $2 == "-t" ]]; then
|
if [[ $2 == "-t" ]]; then
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
events_list_cmd() {
|
events_list_cmd() {
|
||||||
local desc="lists enabled events"
|
declare desc="lists enabled events"
|
||||||
local cmd="events:list"
|
local cmd="events:list"
|
||||||
local PLUGIN_DIR="$(dirname "$0")/.."
|
local PLUGIN_DIR="$(dirname "$0")/.."
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
events_off_cmd() {
|
events_off_cmd() {
|
||||||
local desc="disables dokku events logger"
|
declare desc="disables dokku events logger"
|
||||||
local cmd="events:off"
|
local cmd="events:off"
|
||||||
echo "Disabling dokku events logger"
|
echo "Disabling dokku events logger"
|
||||||
rm -f "$DOKKU_ROOT/.dokkurc/DOKKU_EVENTS"
|
rm -f "$DOKKU_ROOT/.dokkurc/DOKKU_EVENTS"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
events_on_cmd() {
|
events_on_cmd() {
|
||||||
local desc="enables dokku events logger"
|
declare desc="enables dokku events logger"
|
||||||
local cmd="events:on"
|
local cmd="events:on"
|
||||||
echo "Enabling dokku events logger"
|
echo "Enabling dokku events logger"
|
||||||
[[ -d $DOKKU_ROOT/.dokkurc ]] || mkdir -p "$DOKKU_ROOT/.dokkurc"
|
[[ -d $DOKKU_ROOT/.dokkurc ]] || mkdir -p "$DOKKU_ROOT/.dokkurc"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
apps_create() {
|
apps_create() {
|
||||||
local desc="verifies app name and creates an app"
|
declare desc="verifies app name and creates an app"
|
||||||
[[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on"
|
[[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||||
[[ ! "$1" =~ ^[a-z].* && ! "$1" =~ ^[0-9].* ]] && dokku_log_fail "App name must begin with lowercase alphanumeric character"
|
[[ ! "$1" =~ ^[a-z].* && ! "$1" =~ ^[0-9].* ]] && dokku_log_fail "App name must begin with lowercase alphanumeric character"
|
||||||
[[ -d "$DOKKU_ROOT/$1" ]] && dokku_log_fail "Name is already taken"
|
[[ -d "$DOKKU_ROOT/$1" ]] && dokku_log_fail "Name is already taken"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
app_post_delete() {
|
app_post_delete() {
|
||||||
local desc="apps post-delete plugin trigger"
|
declare desc="apps post-delete plugin trigger"
|
||||||
local trigger="app_post_delete"
|
local trigger="app_post_delete"
|
||||||
local APP="$1"; local IMAGE_REPO=$(get_app_image_repo "$APP")
|
local APP="$1"; local IMAGE_REPO=$(get_app_image_repo "$APP")
|
||||||
[[ -n $APP ]] && rm -rf "${DOKKU_ROOT:?}/$APP" > /dev/null
|
[[ -n $APP ]] && rm -rf "${DOKKU_ROOT:?}/$APP" > /dev/null
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
apps_pre_delete() {
|
apps_pre_delete() {
|
||||||
local desc="apps pre-delete plugin trigger"
|
declare desc="apps pre-delete plugin trigger"
|
||||||
local trigger="apps_pre_delete"
|
local trigger="apps_pre_delete"
|
||||||
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG"); local CACHE_DIR="$DOKKU_ROOT/$APP/cache"
|
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG"); local CACHE_DIR="$DOKKU_ROOT/$APP/cache"
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
|
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
|
||||||
|
|
||||||
apps_create_cmd() {
|
apps_create_cmd() {
|
||||||
local desc="creates app via command line"
|
declare desc="creates app via command line"
|
||||||
local cmd="apps:create"
|
local cmd="apps:create"
|
||||||
apps_create "$2"
|
apps_create "$2"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
apps_main_cmd() {
|
apps_main_cmd() {
|
||||||
local desc="lists all apps"
|
declare desc="lists all apps"
|
||||||
local cmd="apps"
|
local cmd="apps"
|
||||||
local app
|
local app
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
|
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
|
||||||
|
|
||||||
apps_destroy_cmd() {
|
apps_destroy_cmd() {
|
||||||
local desc="destroys an app"
|
declare desc="destroys an app"
|
||||||
local cmd="apps:destroy"
|
local cmd="apps:destroy"
|
||||||
[[ -z $2 ]] && 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"
|
||||||
[[ "$2" == "tls" ]] && dokku_log_fail "Unable to destroy tls directory"
|
[[ "$2" == "tls" ]] && dokku_log_fail "Unable to destroy tls directory"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ source "$PLUGIN_AVAILABLE_PATH/apps/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||||
|
|
||||||
apps_rename_cmd() {
|
apps_rename_cmd() {
|
||||||
local desc="renames an app"
|
declare desc="renames an app"
|
||||||
local cmd="apps:rename"
|
local cmd="apps:rename"
|
||||||
[[ -z $2 ]] && 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"
|
||||||
[[ -d "$DOKKU_ROOT/$3" ]] && dokku_log_fail "Name is already taken"
|
[[ -d "$DOKKU_ROOT/$3" ]] && dokku_log_fail "Name is already taken"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
build_env_pre_build_buildpack() {
|
build_env_pre_build_buildpack() {
|
||||||
local desc="build-env pre-build-buildpack plugin trigger"
|
declare desc="build-env pre-build-buildpack plugin trigger"
|
||||||
local trigger="build_env_pre_build_buildpack"
|
local trigger="build_env_pre_build_buildpack"
|
||||||
local APP="$1"; local IMAGE=$(get_app_image_name "$APP"); local BUILD_ENV=""
|
local APP="$1"; local IMAGE=$(get_app_image_name "$APP"); local BUILD_ENV=""
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
is_ssl_enabled() {
|
is_ssl_enabled() {
|
||||||
local desc="returns 0 if ssl is enabled for given app"
|
declare desc="returns 0 if ssl is enabled for given app"
|
||||||
local APP=$1; verify_app_name "$APP"
|
local APP=$1; verify_app_name "$APP"
|
||||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ is_ssl_enabled() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_ssl_hostnames() {
|
get_ssl_hostnames() {
|
||||||
local desc="returns a string of ssl hostnames extracted from an app's ssl certificate"
|
declare desc="returns a string of ssl hostnames extracted from an app's ssl certificate"
|
||||||
local APP=$1; verify_app_name "$APP"
|
local APP=$1; verify_app_name "$APP"
|
||||||
local SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
local SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||||
|
|
||||||
is_tar_import() {
|
is_tar_import() {
|
||||||
local desc="determines if we have STDIN open in an attempt to detect a streamed tar import"
|
declare desc="determines if we have STDIN open in an attempt to detect a streamed tar import"
|
||||||
[[ -t 0 ]] && return 1
|
[[ -t 0 ]] && return 1
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
is_file_import() {
|
is_file_import() {
|
||||||
local desc="determines if we have passed in a file and key path for a file import"
|
declare desc="determines if we have passed in a file and key path for a file import"
|
||||||
local CRT_FILE="$1"
|
local CRT_FILE="$1"
|
||||||
local KEY_FILE="$2"
|
local KEY_FILE="$2"
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ is_file_import() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
certs_set() {
|
certs_set() {
|
||||||
local desc="imports an SSL cert/key combo either on STDIN via a tarball or from specified cert/key filenames"
|
declare desc="imports an SSL cert/key combo either on STDIN via a tarball or from specified cert/key filenames"
|
||||||
local cmd="$1"
|
local cmd="$1"
|
||||||
[[ -z $2 ]] && 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"
|
||||||
verify_app_name "$2"
|
verify_app_name "$2"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||||
|
|
||||||
certs_generate_cmd() {
|
certs_generate_cmd() {
|
||||||
local desc="generates a self-signed SSL certificate/key combo"
|
declare desc="generates a self-signed SSL certificate/key combo"
|
||||||
local cmd="certs:generate"
|
local cmd="certs:generate"
|
||||||
[[ -z $2 ]] && 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"
|
||||||
verify_app_name "$2"
|
verify_app_name "$2"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
||||||
|
|
||||||
certs_info_cmd() {
|
certs_info_cmd() {
|
||||||
local desc="prints SSL certificate info for app"
|
declare desc="prints SSL certificate info for app"
|
||||||
local cmd="certs:info"
|
local cmd="certs:info"
|
||||||
[[ -z $2 ]] && 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"
|
||||||
verify_app_name "$2"
|
verify_app_name "$2"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
certs_remove_cmd() {
|
certs_remove_cmd() {
|
||||||
local desc="removes SSL cert/key from specified app"
|
declare desc="removes SSL cert/key from specified app"
|
||||||
local cmd="certs:remove"
|
local cmd="certs:remove"
|
||||||
[[ -z $2 ]] && 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"
|
||||||
verify_app_name "$2"
|
verify_app_name "$2"
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
checks_check_deploy() {
|
checks_check_deploy() {
|
||||||
local desc="checks check-deploy plugin trigger"
|
declare desc="checks check-deploy plugin trigger"
|
||||||
local trigger="checks_check_deploy"
|
local trigger="checks_check_deploy"
|
||||||
local APP="$1"; local DOKKU_APP_CONTAINER_ID="$2"; local DOKKU_APP_CONTAINER_TYPE="$3"; local DOKKU_APP_LISTEN_PORT="$4"; local DOKKU_APP_LISTEN_IP="$5"
|
local APP="$1"; local DOKKU_APP_CONTAINER_ID="$2"; local DOKKU_APP_CONTAINER_TYPE="$3"; local DOKKU_APP_LISTEN_PORT="$4"; local DOKKU_APP_LISTEN_IP="$5"
|
||||||
if [[ -z "$DOKKU_APP_LISTEN_PORT" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then
|
if [[ -z "$DOKKU_APP_LISTEN_PORT" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then
|
||||||
@@ -80,7 +80,7 @@ checks_check_deploy() {
|
|||||||
local FILENAME=${TMPDIR}/CHECKS
|
local FILENAME=${TMPDIR}/CHECKS
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
local desc="cleans up TMPDIR and print container output"
|
declare desc="cleans up TMPDIR and print container output"
|
||||||
local id="$1"
|
local id="$1"
|
||||||
rm -rf "$TMPDIR"
|
rm -rf "$TMPDIR"
|
||||||
if [[ $id ]]; then
|
if [[ $id ]]; then
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
is_app_checks_enabled() {
|
is_app_checks_enabled() {
|
||||||
local desc="return app zero-downtime checks status"
|
declare desc="return app zero-downtime checks status"
|
||||||
local APP="$1"; verify_app_name "$APP"
|
local APP="$1"; verify_app_name "$APP"
|
||||||
local DOKKU_CHECKS_ENABLED=$(config_get "$APP" DOKKU_CHECKS_ENABLED)
|
local DOKKU_CHECKS_ENABLED=$(config_get "$APP" DOKKU_CHECKS_ENABLED)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
migrate_checks_vars() {
|
migrate_checks_vars() {
|
||||||
local desc="migrates deprecated CHECKS config variables to simplified counter part introduced in 0.5.x"
|
declare desc="migrates deprecated CHECKS config variables to simplified counter part introduced in 0.5.x"
|
||||||
local APPS="$(dokku_apps)"
|
local APPS="$(dokku_apps)"
|
||||||
local GLOBAL_SKIP_ALL_CHECKS=$(dokku config:get --global DOKKU_SKIP_ALL_CHECKS || true)
|
local GLOBAL_SKIP_ALL_CHECKS=$(dokku config:get --global DOKKU_SKIP_ALL_CHECKS || true)
|
||||||
local GLOBAL_SKIP_DEFAULT_CHECKS=$(dokku config:get --global DOKKU_SKIP_DEFAULT_CHECKS || true)
|
local GLOBAL_SKIP_DEFAULT_CHECKS=$(dokku config:get --global DOKKU_SKIP_DEFAULT_CHECKS || true)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
||||||
|
|
||||||
checks_main_cmd() {
|
checks_main_cmd() {
|
||||||
local desc="displays app zero-downtime status"
|
declare desc="displays app zero-downtime status"
|
||||||
local cmd="checks"
|
local cmd="checks"
|
||||||
local ALL_APPS=$(dokku_apps)
|
local ALL_APPS=$(dokku_apps)
|
||||||
if [[ -n "$1" ]]; then
|
if [[ -n "$1" ]]; then
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
||||||
|
|
||||||
checks_disable_cmd() {
|
checks_disable_cmd() {
|
||||||
local desc="disable zero-downtime for app"
|
declare desc="disable zero-downtime for app"
|
||||||
local cmd="check:disable"
|
local cmd="check:disable"
|
||||||
local APP="$1"; verify_app_name "$APP"
|
local APP="$1"; verify_app_name "$APP"
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
||||||
|
|
||||||
checks_enable_cmd() {
|
checks_enable_cmd() {
|
||||||
local desc="enable zero-downtime for app"
|
declare desc="enable zero-downtime for app"
|
||||||
local cmd="checks:enable"
|
local cmd="checks:enable"
|
||||||
local APP="$1"; verify_app_name "$APP"
|
local APP="$1"; verify_app_name "$APP"
|
||||||
|
|
||||||
|
|||||||
+55
-55
@@ -2,7 +2,7 @@
|
|||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
has_tty() {
|
has_tty() {
|
||||||
local desc="return 0 if we have a tty"
|
declare desc="return 0 if we have a tty"
|
||||||
if [[ "$(/usr/bin/tty || true)" == "not a tty" ]]; then
|
if [[ "$(/usr/bin/tty || true)" == "not a tty" ]]; then
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
@@ -11,23 +11,23 @@ has_tty() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dokku_apps() {
|
dokku_apps() {
|
||||||
local desc="prints list of all local apps"
|
declare desc="prints list of all local apps"
|
||||||
local INSTALLED_APPS=$(find "$DOKKU_ROOT" -follow -maxdepth 1 -mindepth 1 -type d ! -name 'tls' ! -name '.*' -printf "%f\n" | sort) || (dokku_log_fail "You haven't deployed any applications yet")
|
local INSTALLED_APPS=$(find "$DOKKU_ROOT" -follow -maxdepth 1 -mindepth 1 -type d ! -name 'tls' ! -name '.*' -printf "%f\n" | sort) || (dokku_log_fail "You haven't deployed any applications yet")
|
||||||
[[ $INSTALLED_APPS ]] && echo "$INSTALLED_APPS"
|
[[ $INSTALLED_APPS ]] && echo "$INSTALLED_APPS"
|
||||||
}
|
}
|
||||||
|
|
||||||
dokku_log_info1() {
|
dokku_log_info1() {
|
||||||
local desc="log info1 formatter"
|
declare desc="log info1 formatter"
|
||||||
echo "-----> $*"
|
echo "-----> $*"
|
||||||
}
|
}
|
||||||
|
|
||||||
dokku_log_info2() {
|
dokku_log_info2() {
|
||||||
local desc="log info2 formatter"
|
declare desc="log info2 formatter"
|
||||||
echo "=====> $*"
|
echo "=====> $*"
|
||||||
}
|
}
|
||||||
|
|
||||||
dokku_log_info1_quiet() {
|
dokku_log_info1_quiet() {
|
||||||
local desc="log info1 formatter (with quiet option)"
|
declare desc="log info1 formatter (with quiet option)"
|
||||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
||||||
echo "-----> $*"
|
echo "-----> $*"
|
||||||
else
|
else
|
||||||
@@ -36,7 +36,7 @@ dokku_log_info1_quiet() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dokku_log_info2_quiet() {
|
dokku_log_info2_quiet() {
|
||||||
local desc="log info2 formatter (with quiet option)"
|
declare desc="log info2 formatter (with quiet option)"
|
||||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
||||||
echo "=====> $*"
|
echo "=====> $*"
|
||||||
else
|
else
|
||||||
@@ -45,12 +45,12 @@ dokku_log_info2_quiet() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dokku_col_log_info1() {
|
dokku_col_log_info1() {
|
||||||
local desc="columnar log info1 formatter"
|
declare desc="columnar log info1 formatter"
|
||||||
printf "%-6s %-18s %-25s %-25s %-25s\n" "----->" "$@"
|
printf "%-6s %-18s %-25s %-25s %-25s\n" "----->" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
dokku_col_log_info1_quiet() {
|
dokku_col_log_info1_quiet() {
|
||||||
local desc="columnar log info1 formatter (with quiet option)"
|
declare desc="columnar log info1 formatter (with quiet option)"
|
||||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
||||||
printf "%-6s %-18s %-25s %-25s %-25s\n" "----->" "$@"
|
printf "%-6s %-18s %-25s %-25s %-25s\n" "----->" "$@"
|
||||||
else
|
else
|
||||||
@@ -59,12 +59,12 @@ dokku_col_log_info1_quiet() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dokku_col_log_info2() {
|
dokku_col_log_info2() {
|
||||||
local desc="columnar log info2 formatter"
|
declare desc="columnar log info2 formatter"
|
||||||
printf "%-6s %-18s %-25s %-25s %-25s\n" "=====>" "$@"
|
printf "%-6s %-18s %-25s %-25s %-25s\n" "=====>" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
dokku_col_log_info2_quiet() {
|
dokku_col_log_info2_quiet() {
|
||||||
local desc="columnar log info2 formatter (with quiet option)"
|
declare desc="columnar log info2 formatter (with quiet option)"
|
||||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
||||||
printf "%-6s %-18s %-25s %-25s %-25s\n" "=====>" "$@"
|
printf "%-6s %-18s %-25s %-25s %-25s\n" "=====>" "$@"
|
||||||
else
|
else
|
||||||
@@ -73,12 +73,12 @@ dokku_col_log_info2_quiet() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dokku_col_log_msg() {
|
dokku_col_log_msg() {
|
||||||
local desc="columnar log formatter"
|
declare desc="columnar log formatter"
|
||||||
printf "%-25s %-25s %-25s %-25s\n" "$@"
|
printf "%-25s %-25s %-25s %-25s\n" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
dokku_col_log_msg_quiet() {
|
dokku_col_log_msg_quiet() {
|
||||||
local desc="columnar log formatter (with quiet option)"
|
declare desc="columnar log formatter (with quiet option)"
|
||||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
||||||
printf "%-25s %-25s %-25s %-25s\n" "$@"
|
printf "%-25s %-25s %-25s %-25s\n" "$@"
|
||||||
else
|
else
|
||||||
@@ -87,7 +87,7 @@ dokku_col_log_msg_quiet() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dokku_log_verbose_quiet() {
|
dokku_log_verbose_quiet() {
|
||||||
local desc="log verbose formatter (with quiet option)"
|
declare desc="log verbose formatter (with quiet option)"
|
||||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
||||||
echo " $*"
|
echo " $*"
|
||||||
else
|
else
|
||||||
@@ -96,35 +96,35 @@ dokku_log_verbose_quiet() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dokku_log_verbose() {
|
dokku_log_verbose() {
|
||||||
local desc="log verbose formatter"
|
declare desc="log verbose formatter"
|
||||||
echo " $*"
|
echo " $*"
|
||||||
}
|
}
|
||||||
|
|
||||||
dokku_log_warn() {
|
dokku_log_warn() {
|
||||||
local desc="log warning formatter"
|
declare desc="log warning formatter"
|
||||||
echo " ! $*"
|
echo " ! $*"
|
||||||
}
|
}
|
||||||
|
|
||||||
dokku_log_fail() {
|
dokku_log_fail() {
|
||||||
local desc="log fail formatter"
|
declare desc="log fail formatter"
|
||||||
echo "$@" 1>&2
|
echo "$@" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
dokku_log_event() {
|
dokku_log_event() {
|
||||||
local desc="log dokku events"
|
declare desc="log dokku events"
|
||||||
logger -t dokku -i -- "$@"
|
logger -t dokku -i -- "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
dokku_log_plugn_trigger_call() {
|
dokku_log_plugn_trigger_call() {
|
||||||
local desc="log plugn trigger calls"
|
declare desc="log plugn trigger calls"
|
||||||
|
|
||||||
local l_hook="$1" ; shift
|
local l_hook="$1" ; shift
|
||||||
dokku_log_event "INVOKED: ${l_hook}( $* ) NAME=$NAME FINGERPRINT=$FINGERPRINT"
|
dokku_log_event "INVOKED: ${l_hook}( $* ) NAME=$NAME FINGERPRINT=$FINGERPRINT"
|
||||||
}
|
}
|
||||||
|
|
||||||
dokku_container_log_verbose_quiet() {
|
dokku_container_log_verbose_quiet() {
|
||||||
local desc="log verbose container output (with quiet option)"
|
declare desc="log verbose container output (with quiet option)"
|
||||||
local CID=$1;
|
local CID=$1;
|
||||||
shift
|
shift
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ dokku_container_log_verbose_quiet() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
verify_app_name() {
|
verify_app_name() {
|
||||||
local desc="verify app name format and app existence"
|
declare desc="verify app name format and app existence"
|
||||||
local APP="$1"
|
local APP="$1"
|
||||||
[[ ! -n "$APP" ]] && dokku_log_fail "(verify_app_name) APP must not be null"
|
[[ ! -n "$APP" ]] && dokku_log_fail "(verify_app_name) APP must not be null"
|
||||||
if [[ ! "$APP" =~ ^[a-z].* && ! "$APP" =~ ^[0-9].* ]]; then
|
if [[ ! "$APP" =~ ^[a-z].* && ! "$APP" =~ ^[0-9].* ]]; then
|
||||||
@@ -151,7 +151,7 @@ verify_app_name() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
verify_image() {
|
verify_image() {
|
||||||
local desc="verify image existence"
|
declare desc="verify image existence"
|
||||||
local IMAGE="$1"
|
local IMAGE="$1"
|
||||||
if (docker inspect "$IMAGE" &>/dev/null); then
|
if (docker inspect "$IMAGE" &>/dev/null); then
|
||||||
return 0
|
return 0
|
||||||
@@ -161,14 +161,14 @@ verify_image() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_app_image_repo() {
|
get_app_image_repo() {
|
||||||
local desc="central definition of image repo pattern"
|
declare desc="central definition of image repo pattern"
|
||||||
local APP="$1"; local IMAGE_REPO="dokku/$APP"
|
local APP="$1"; local IMAGE_REPO="dokku/$APP"
|
||||||
[[ -z "$APP" ]] && dokku_log_fail "(get_app_image_repo) APP must not be null"
|
[[ -z "$APP" ]] && dokku_log_fail "(get_app_image_repo) APP must not be null"
|
||||||
echo "$IMAGE_REPO"
|
echo "$IMAGE_REPO"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_app_image_name() {
|
get_app_image_name() {
|
||||||
local desc="return image identifier for a given app, tag tuple. validate if tag is presented"
|
declare desc="return image identifier for a given app, tag tuple. validate if tag is presented"
|
||||||
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE_REPO=$(get_app_image_repo "$APP")
|
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE_REPO=$(get_app_image_repo "$APP")
|
||||||
[[ -z "$APP" ]] && dokku_log_fail "(get_app_image_name) APP must not be null"
|
[[ -z "$APP" ]] && dokku_log_fail "(get_app_image_name) APP must not be null"
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ get_app_image_name() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_running_image_tag() {
|
get_running_image_tag() {
|
||||||
local desc="retrieve current image tag for a given app. returns empty string if no deployed containers are found"
|
declare desc="retrieve current image tag for a given app. returns empty string if no deployed containers are found"
|
||||||
local APP="$1"
|
local APP="$1"
|
||||||
[[ ! -n "$APP" ]] && dokku_log_fail "(get_running_image_tag) APP must not be null"
|
[[ ! -n "$APP" ]] && dokku_log_fail "(get_running_image_tag) APP must not be null"
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
@@ -193,14 +193,14 @@ get_running_image_tag() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
is_image_herokuish_based() {
|
is_image_herokuish_based() {
|
||||||
local desc="returns true if app image is based on herokuish"
|
declare desc="returns true if app image is based on herokuish"
|
||||||
# circleci can't support --rm as they run lxc in lxc
|
# circleci can't support --rm as they run lxc in lxc
|
||||||
[[ ! -f "/home/ubuntu/.circlerc" ]] && local DOCKER_ARGS="--rm"
|
[[ ! -f "/home/ubuntu/.circlerc" ]] && local DOCKER_ARGS="--rm"
|
||||||
docker run "$DOKKU_GLOBAL_RUN_ARGS" --entrypoint="/bin/sh" $DOCKER_ARGS "$@" -c "test -f /exec"
|
docker run "$DOKKU_GLOBAL_RUN_ARGS" --entrypoint="/bin/sh" $DOCKER_ARGS "$@" -c "test -f /exec"
|
||||||
}
|
}
|
||||||
|
|
||||||
is_number() {
|
is_number() {
|
||||||
local desc="returns 0 if input is a number"
|
declare desc="returns 0 if input is a number"
|
||||||
local NUMBER=$1; local NUM_RE='^[0-9]+$'
|
local NUMBER=$1; local NUM_RE='^[0-9]+$'
|
||||||
if [[ $NUMBER =~ $NUM_RE ]]; then
|
if [[ $NUMBER =~ $NUM_RE ]]; then
|
||||||
return 0
|
return 0
|
||||||
@@ -210,7 +210,7 @@ is_number() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
is_abs_path() {
|
is_abs_path() {
|
||||||
local desc="returns 0 if input path is absolute"
|
declare desc="returns 0 if input path is absolute"
|
||||||
local TEST_PATH=$1
|
local TEST_PATH=$1
|
||||||
if [[ "$TEST_PATH" == /* ]]; then
|
if [[ "$TEST_PATH" == /* ]]; then
|
||||||
return 0
|
return 0
|
||||||
@@ -220,7 +220,7 @@ is_abs_path() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parse_args() {
|
parse_args() {
|
||||||
local desc="top-level cli arg parser"
|
declare desc="top-level cli arg parser"
|
||||||
local next_index=1; local skip=false; local args=("$@")
|
local next_index=1; local skip=false; local args=("$@")
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
$skip && skip=false && continue
|
$skip && skip=false && continue
|
||||||
@@ -247,7 +247,7 @@ parse_args() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
copy_from_image() {
|
copy_from_image() {
|
||||||
local desc="copy file from named image to destination"
|
declare desc="copy file from named image to destination"
|
||||||
local IMAGE="$1"; local SRC_FILE="$2"; local DST_DIR="$3"
|
local IMAGE="$1"; local SRC_FILE="$2"; local DST_DIR="$3"
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
|
|
||||||
@@ -266,7 +266,7 @@ copy_from_image() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_app_container_ids() {
|
get_app_container_ids() {
|
||||||
local desc="returns list of docker container ids for given app"
|
declare desc="returns list of docker container ids for given app"
|
||||||
local APP="$1"; local CONTAINER_TYPE="$2"
|
local APP="$1"; local CONTAINER_TYPE="$2"
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
[[ -f $DOKKU_ROOT/$APP/CONTAINER ]] && DOKKU_CIDS+=$(< "$DOKKU_ROOT/$APP/CONTAINER")
|
[[ -f $DOKKU_ROOT/$APP/CONTAINER ]] && DOKKU_CIDS+=$(< "$DOKKU_ROOT/$APP/CONTAINER")
|
||||||
@@ -293,7 +293,7 @@ get_app_container_ids() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_app_running_container_ids() {
|
get_app_running_container_ids() {
|
||||||
local desc="return list of running docker container ids for given apps"
|
declare desc="return list of running docker container ids for given apps"
|
||||||
local APP=$1
|
local APP=$1
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
|
|
||||||
@@ -309,7 +309,7 @@ get_app_running_container_ids() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_cmd_from_procfile() {
|
get_cmd_from_procfile() {
|
||||||
local desc="parse cmd from app Procfile"
|
declare desc="parse cmd from app Procfile"
|
||||||
local APP=$1; local PROC_TYPE=$2; local DOKKU_PROCFILE="$DOKKU_ROOT/$APP/DOKKU_PROCFILE"
|
local APP=$1; local PROC_TYPE=$2; local DOKKU_PROCFILE="$DOKKU_ROOT/$APP/DOKKU_PROCFILE"
|
||||||
local name; local command;
|
local name; local command;
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
@@ -327,7 +327,7 @@ get_cmd_from_procfile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
is_deployed() {
|
is_deployed() {
|
||||||
local desc="return 0 if given app has a running container"
|
declare desc="return 0 if given app has a running container"
|
||||||
local APP="$1"
|
local APP="$1"
|
||||||
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] || [[ $(ls "$DOKKU_ROOT/$APP"/CONTAINER.* &> /dev/null; echo $?) -eq 0 ]]; then
|
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] || [[ $(ls "$DOKKU_ROOT/$APP"/CONTAINER.* &> /dev/null; echo $?) -eq 0 ]]; then
|
||||||
return 0
|
return 0
|
||||||
@@ -337,7 +337,7 @@ is_deployed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
is_container_running () {
|
is_container_running () {
|
||||||
local desc="return 0 if given docker container id is in running state"
|
declare desc="return 0 if given docker container id is in running state"
|
||||||
local CID=$1
|
local CID=$1
|
||||||
local CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID" || true)
|
local CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID" || true)
|
||||||
|
|
||||||
@@ -349,7 +349,7 @@ is_container_running () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
is_container_status () {
|
is_container_status () {
|
||||||
local desc="return 0 if given docker container id is in given state"
|
declare desc="return 0 if given docker container id is in given state"
|
||||||
local CID=$1
|
local CID=$1
|
||||||
local TEMPLATE="{{.State.$2}}"
|
local TEMPLATE="{{.State.$2}}"
|
||||||
local CONTAINER_STATUS=$(docker inspect -f "$TEMPLATE" "$CID" || true)
|
local CONTAINER_STATUS=$(docker inspect -f "$TEMPLATE" "$CID" || true)
|
||||||
@@ -362,7 +362,7 @@ is_container_status () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
is_app_running() {
|
is_app_running() {
|
||||||
local desc="return 0 if given app has a running container"
|
declare desc="return 0 if given app has a running container"
|
||||||
local APP="$1"
|
local APP="$1"
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
|
|
||||||
@@ -376,7 +376,7 @@ is_app_running() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
release_and_deploy() {
|
release_and_deploy() {
|
||||||
local desc="main function for releasing and deploying an app"
|
declare desc="main function for releasing and deploying an app"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||||
@@ -411,7 +411,7 @@ release_and_deploy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
docker_cleanup() {
|
docker_cleanup() {
|
||||||
local desc="cleans up all exited/dead containers and removes all dangling images"
|
declare desc="cleans up all exited/dead containers and removes all dangling images"
|
||||||
# delete all non-running containers
|
# delete all non-running containers
|
||||||
# shellcheck disable=SC2046
|
# shellcheck disable=SC2046
|
||||||
docker rm $(docker ps -a -f 'status=exited' -q) &> /dev/null || true
|
docker rm $(docker ps -a -f 'status=exited' -q) &> /dev/null || true
|
||||||
@@ -426,7 +426,7 @@ docker_cleanup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_available_port() {
|
get_available_port() {
|
||||||
local desc="returns first currently unused port > 1024"
|
declare desc="returns first currently unused port > 1024"
|
||||||
while true; do
|
while true; do
|
||||||
local port=$(shuf -i 1025-65535 -n 1)
|
local port=$(shuf -i 1025-65535 -n 1)
|
||||||
if ! nc -z 0.0.0.0 "$port"; then
|
if ! nc -z 0.0.0.0 "$port"; then
|
||||||
@@ -439,7 +439,7 @@ get_available_port() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dokku_auth() {
|
dokku_auth() {
|
||||||
local desc="calls user-auth plugin trigger"
|
declare desc="calls user-auth plugin trigger"
|
||||||
export SSH_USER=${SSH_USER:=$USER}
|
export SSH_USER=${SSH_USER:=$USER}
|
||||||
export SSH_NAME=${NAME:="default"}
|
export SSH_NAME=${NAME:="default"}
|
||||||
if ! plugn trigger user-auth "$SSH_USER" "$SSH_NAME" "$@" ; then
|
if ! plugn trigger user-auth "$SSH_USER" "$SSH_NAME" "$@" ; then
|
||||||
@@ -449,12 +449,12 @@ dokku_auth() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_ipv4_regex() {
|
_ipv4_regex() {
|
||||||
local desc="ipv4 regex"
|
declare desc="ipv4 regex"
|
||||||
echo "([0-9]{1,3}[\.]){3}[0-9]{1,3}"
|
echo "([0-9]{1,3}[\.]){3}[0-9]{1,3}"
|
||||||
}
|
}
|
||||||
|
|
||||||
_ipv6_regex() {
|
_ipv6_regex() {
|
||||||
local desc="ipv6 regex"
|
declare desc="ipv6 regex"
|
||||||
local RE_IPV4="$(_ipv4_regex)"
|
local RE_IPV4="$(_ipv4_regex)"
|
||||||
local RE_IPV6="([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|" # TEST: 1:2:3:4:5:6:7:8
|
local RE_IPV6="([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|" # TEST: 1:2:3:4:5:6:7:8
|
||||||
local RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,7}:|" # TEST: 1:: 1:2:3:4:5:6:7::
|
local RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,7}:|" # TEST: 1:: 1:2:3:4:5:6:7::
|
||||||
@@ -472,7 +472,7 @@ _ipv6_regex() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_ipv4_regex() {
|
get_ipv4_regex() {
|
||||||
local desc="returns ipv4 regex"
|
declare desc="returns ipv4 regex"
|
||||||
local RE_IPV4="$(_ipv4_regex)"
|
local RE_IPV4="$(_ipv4_regex)"
|
||||||
# Ensure the ip address continues to the end of the line
|
# Ensure the ip address continues to the end of the line
|
||||||
# Fixes using a wildcard dns service such as xip.io which allows for *.<ip address>.xip.io
|
# Fixes using a wildcard dns service such as xip.io which allows for *.<ip address>.xip.io
|
||||||
@@ -480,7 +480,7 @@ get_ipv4_regex() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_ipv6_regex() {
|
get_ipv6_regex() {
|
||||||
local desc="returns ipv6 regex"
|
declare desc="returns ipv6 regex"
|
||||||
local RE_IPV6="$(_ipv6_regex)"
|
local RE_IPV6="$(_ipv6_regex)"
|
||||||
# Ensure the ip address continues to the end of the line
|
# Ensure the ip address continues to the end of the line
|
||||||
# Fixes using a wildcard dns service such as xip.io which allows for *.<ip address>.xip.io
|
# Fixes using a wildcard dns service such as xip.io which allows for *.<ip address>.xip.io
|
||||||
@@ -488,14 +488,14 @@ get_ipv6_regex() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_global_vhost() {
|
get_global_vhost() {
|
||||||
local desc="return global vhost"
|
declare desc="return global vhost"
|
||||||
local GLOBAL_VHOST_FILE="$DOKKU_ROOT/VHOST"
|
local GLOBAL_VHOST_FILE="$DOKKU_ROOT/VHOST"
|
||||||
[[ -f "$GLOBAL_VHOST_FILE" ]] && local GLOBAL_VHOST=$(< "$GLOBAL_VHOST_FILE")
|
[[ -f "$GLOBAL_VHOST_FILE" ]] && local GLOBAL_VHOST=$(< "$GLOBAL_VHOST_FILE")
|
||||||
echo "$GLOBAL_VHOST"
|
echo "$GLOBAL_VHOST"
|
||||||
}
|
}
|
||||||
|
|
||||||
is_global_vhost_enabled() {
|
is_global_vhost_enabled() {
|
||||||
local desc="returns true if we have a valid global vhost set; otherwise returns false"
|
declare desc="returns true if we have a valid global vhost set; otherwise returns false"
|
||||||
local GLOBAL_VHOST=$(get_global_vhost)
|
local GLOBAL_VHOST=$(get_global_vhost)
|
||||||
local GLOBAL_VHOST_ENABLED=true
|
local GLOBAL_VHOST_ENABLED=true
|
||||||
local RE_IPV4="$(get_ipv4_regex)"
|
local RE_IPV4="$(get_ipv4_regex)"
|
||||||
@@ -508,7 +508,7 @@ is_global_vhost_enabled() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
is_app_vhost_enabled() {
|
is_app_vhost_enabled() {
|
||||||
local desc="returns true or false if vhost support is enabled for a given application"
|
declare desc="returns true or false if vhost support is enabled for a given application"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
local APP=$1; verify_app_name "$APP"
|
local APP=$1; verify_app_name "$APP"
|
||||||
@@ -523,7 +523,7 @@ is_app_vhost_enabled() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
disable_app_vhost() {
|
disable_app_vhost() {
|
||||||
local desc="disable vhost support for given application"
|
declare desc="disable vhost support for given application"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
local APP=$1; verify_app_name "$APP"
|
local APP=$1; verify_app_name "$APP"
|
||||||
@@ -553,7 +553,7 @@ disable_app_vhost() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enable_app_vhost() {
|
enable_app_vhost() {
|
||||||
local desc="enable vhost support for given application"
|
declare desc="enable vhost support for given application"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
local APP=$1; verify_app_name "$APP"
|
local APP=$1; verify_app_name "$APP"
|
||||||
@@ -565,13 +565,13 @@ enable_app_vhost() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_dockerfile_exposed_ports() {
|
get_dockerfile_exposed_ports() {
|
||||||
local desc="return all exposed ports from passed file path"
|
declare desc="return all exposed ports from passed file path"
|
||||||
local DOCKERFILE_PORTS=$(egrep "^EXPOSE " "$1" | awk '{ print $2 }' | xargs) || true
|
local DOCKERFILE_PORTS=$(egrep "^EXPOSE " "$1" | awk '{ print $2 }' | xargs) || true
|
||||||
echo "$DOCKERFILE_PORTS"
|
echo "$DOCKERFILE_PORTS"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_app_raw_tcp_ports() {
|
get_app_raw_tcp_ports() {
|
||||||
local desc="extracts raw tcp port numbers from DOCKERFILE_PORTS config variable"
|
declare desc="extracts raw tcp port numbers from DOCKERFILE_PORTS config variable"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
local APP="$1"; verify_app_name "$APP"
|
local APP="$1"; verify_app_name "$APP"
|
||||||
@@ -587,7 +587,7 @@ get_app_raw_tcp_ports() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_container_ports() {
|
get_container_ports() {
|
||||||
local desc="returns published ports from app containers"
|
declare desc="returns published ports from app containers"
|
||||||
local APP="$1"; verify_app_name "$APP"
|
local APP="$1"; verify_app_name "$APP"
|
||||||
local APP_CIDS="$(get_app_container_ids "$APP")"
|
local APP_CIDS="$(get_app_container_ids "$APP")"
|
||||||
local cid
|
local cid
|
||||||
@@ -600,7 +600,7 @@ get_container_ports() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_app_urls() {
|
get_app_urls() {
|
||||||
local desc="print an app's available urls"
|
declare desc="print an app's available urls"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||||
|
|
||||||
@@ -668,7 +668,7 @@ get_app_urls() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_json_value() {
|
get_json_value() {
|
||||||
local desc="return value of provided json key from a json stream on stdin"
|
declare desc="return value of provided json key from a json stream on stdin"
|
||||||
# JSON_NODE should be expresses as either a top-level object that has no children
|
# JSON_NODE should be expresses as either a top-level object that has no children
|
||||||
# or in the format of json.node.path
|
# or in the format of json.node.path
|
||||||
local JSON_NODE="$1"
|
local JSON_NODE="$1"
|
||||||
@@ -678,7 +678,7 @@ get_json_value() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_json_keys() {
|
get_json_keys() {
|
||||||
local desc="return space-separated list of json keys from json provided on stdin"
|
declare desc="return space-separated list of json keys from json provided on stdin"
|
||||||
# JSON_NODE should be expressed as json.node.path and is expected to have children
|
# JSON_NODE should be expressed as json.node.path and is expected to have children
|
||||||
local JSON_NODE="$1"
|
local JSON_NODE="$1"
|
||||||
local JSON_NODE=${JSON_NODE//\./\"][\"}
|
local JSON_NODE=${JSON_NODE//\./\"][\"}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
config_docker_args() {
|
config_docker_args() {
|
||||||
local desc="config docker-args plugin trigger"
|
declare desc="config docker-args plugin trigger"
|
||||||
local trigger="$0 config_docker_args"
|
local trigger="$0 config_docker_args"
|
||||||
local STDIN=$(cat); local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
local STDIN=$(cat); local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||||
local DOCKERFILE_ENV_FILE="$DOKKU_ROOT/$APP/DOCKERFILE_ENV_FILE"
|
local DOCKERFILE_ENV_FILE="$DOKKU_ROOT/$APP/DOCKERFILE_ENV_FILE"
|
||||||
|
|||||||
+10
-10
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
config_export() {
|
config_export() {
|
||||||
local desc="returns export command for config variable of specified type (app/global)"
|
declare desc="returns export command for config variable of specified type (app/global)"
|
||||||
local CONFIG_TYPE="$1"
|
local CONFIG_TYPE="$1"
|
||||||
local APP="$2"
|
local APP="$2"
|
||||||
local ENV_FILE="$DOKKU_ROOT/$APP/ENV"
|
local ENV_FILE="$DOKKU_ROOT/$APP/ENV"
|
||||||
@@ -18,7 +18,7 @@ config_export() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
config_parse_args() {
|
config_parse_args() {
|
||||||
local desc="parse config plugin args"
|
declare desc="parse config plugin args"
|
||||||
unset APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART
|
unset APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART
|
||||||
case "$2" in
|
case "$2" in
|
||||||
--global)
|
--global)
|
||||||
@@ -50,13 +50,13 @@ config_parse_args() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
config_create () {
|
config_create () {
|
||||||
local desc="create config env file"
|
declare desc="create config env file"
|
||||||
local ENV_FILE=$1
|
local ENV_FILE=$1
|
||||||
[[ -f $ENV_FILE ]] || touch "$ENV_FILE"
|
[[ -f $ENV_FILE ]] || touch "$ENV_FILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
config_styled_hash () {
|
config_styled_hash () {
|
||||||
local desc="internal config hash"
|
declare desc="internal config hash"
|
||||||
local vars="$1"
|
local vars="$1"
|
||||||
local prefix="$2"
|
local prefix="$2"
|
||||||
local longest=""
|
local longest=""
|
||||||
@@ -83,7 +83,7 @@ config_styled_hash () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
config_write() {
|
config_write() {
|
||||||
local desc="writes config vars out to appropriate file path"
|
declare desc="writes config vars out to appropriate file path"
|
||||||
local ENV_TEMP="$1"
|
local ENV_TEMP="$1"
|
||||||
local ENV_FILE_TEMP="${ENV_FILE}.tmp"
|
local ENV_FILE_TEMP="${ENV_FILE}.tmp"
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ config_write() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
is_config_export() {
|
is_config_export() {
|
||||||
local desc="return 0 if we're supposed to export"
|
declare desc="return 0 if we're supposed to export"
|
||||||
for var in "$@"; do
|
for var in "$@"; do
|
||||||
if [[ "$var" == "--export" ]]; then
|
if [[ "$var" == "--export" ]]; then
|
||||||
return 0
|
return 0
|
||||||
@@ -106,7 +106,7 @@ is_config_export() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
config_all() {
|
config_all() {
|
||||||
local desc="print or export config vars"
|
declare desc="print or export config vars"
|
||||||
[[ "$1" == "config" ]] || set -- "config" "$@"
|
[[ "$1" == "config" ]] || set -- "config" "$@"
|
||||||
config_parse_args "$@"
|
config_parse_args "$@"
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ config_all() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
config_get() {
|
config_get() {
|
||||||
local desc="get value of given config var"
|
declare desc="get value of given config var"
|
||||||
[[ "$1" == "config:get" ]] || set -- "config:get" "$@"
|
[[ "$1" == "config:get" ]] || set -- "config:get" "$@"
|
||||||
config_parse_args "$@"
|
config_parse_args "$@"
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ config_get() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
config_set() {
|
config_set() {
|
||||||
local desc="set value of given config var"
|
declare desc="set value of given config var"
|
||||||
[[ "$1" == "config:set" ]] || set -- "config:set" "$@"
|
[[ "$1" == "config:set" ]] || set -- "config:set" "$@"
|
||||||
config_parse_args "$@"
|
config_parse_args "$@"
|
||||||
[[ "$2" = "--no-restart" ]] && set -- "${@:1:1}" "${@:3}"
|
[[ "$2" = "--no-restart" ]] && set -- "${@:1:1}" "${@:3}"
|
||||||
@@ -209,7 +209,7 @@ ${var}"
|
|||||||
}
|
}
|
||||||
|
|
||||||
config_unset() {
|
config_unset() {
|
||||||
local desc="unset given config var"
|
declare desc="unset given config var"
|
||||||
[[ "$1" == "config:unset" ]] || set -- "config:unset" "$@"
|
[[ "$1" == "config:unset" ]] || set -- "config:unset" "$@"
|
||||||
config_parse_args "$@"
|
config_parse_args "$@"
|
||||||
[[ "$2" = "--no-restart" ]] && set -- "${@:1:1}" "${@:3}"
|
[[ "$2" = "--no-restart" ]] && set -- "${@:1:1}" "${@:3}"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
config_main_cmd() {
|
config_main_cmd() {
|
||||||
local desc="print config vars for app via command line"
|
declare desc="print config vars for app via command line"
|
||||||
local cmd="config"
|
local cmd="config"
|
||||||
config_all "$@"
|
config_all "$@"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
config_get_cmd() {
|
config_get_cmd() {
|
||||||
local desc="get specified config vars from app via command line"
|
declare desc="get specified config vars from app via command line"
|
||||||
local cmd="config:get"
|
local cmd="config:get"
|
||||||
config_get "$@"
|
config_get "$@"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
config_set_cmd() {
|
config_set_cmd() {
|
||||||
local desc="set specified config vars for app via command line"
|
declare desc="set specified config vars for app via command line"
|
||||||
local cmd="config:set"
|
local cmd="config:set"
|
||||||
config_set "$@"
|
config_set "$@"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
config_unset_cmd() {
|
config_unset_cmd() {
|
||||||
local desc="unset specified config vars for app via command line"
|
declare desc="unset specified config vars for app via command line"
|
||||||
local cmd="config:unset"
|
local cmd="config:unset"
|
||||||
config_unset "$@"
|
config_unset "$@"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
docker_args() {
|
docker_args() {
|
||||||
local desc="docker args plugin trigger"
|
declare desc="docker args plugin trigger"
|
||||||
local trigger="$0"
|
local trigger="$0"
|
||||||
local STDIN=$(cat)
|
local STDIN=$(cat)
|
||||||
local APP="$1"; local IMAGE_SOURCE_TYPE="$2"
|
local APP="$1"; local IMAGE_SOURCE_TYPE="$2"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
AVAILABLE_PHASES=(build deploy run)
|
AVAILABLE_PHASES=(build deploy run)
|
||||||
|
|
||||||
get_phase_file_path() {
|
get_phase_file_path() {
|
||||||
local desc="return docker-options config file path for specified phase"
|
declare desc="return docker-options config file path for specified phase"
|
||||||
local phase_file_prefix="DOCKER_OPTIONS_"
|
local phase_file_prefix="DOCKER_OPTIONS_"
|
||||||
local phase=$1
|
local phase=$1
|
||||||
[[ "$DOKKU_ROOT" && "$APP" && "$phase_file_prefix" && "$phase" ]] || dokku_log_fail "Error: phase_file_path is incomplete."
|
[[ "$DOKKU_ROOT" && "$APP" && "$phase_file_prefix" && "$phase" ]] || dokku_log_fail "Error: phase_file_path is incomplete."
|
||||||
@@ -13,7 +13,7 @@ get_phase_file_path() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_phases() {
|
get_phases() {
|
||||||
local desc="returns array of passed passes if all are in allowed array"
|
declare desc="returns array of passed passes if all are in allowed array"
|
||||||
local passed_phases_list="$1"
|
local passed_phases_list="$1"
|
||||||
local -r phases_allowed=$(sed -e 's/ /\|/g' <<< "${AVAILABLE_PHASES[@]}")
|
local -r phases_allowed=$(sed -e 's/ /\|/g' <<< "${AVAILABLE_PHASES[@]}")
|
||||||
local phase
|
local phase
|
||||||
@@ -30,7 +30,7 @@ get_phases() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
create_phase_file_if_required() {
|
create_phase_file_if_required() {
|
||||||
local desc="create phase file"
|
declare desc="create phase file"
|
||||||
local phase_file_path="$1"
|
local phase_file_path="$1"
|
||||||
[[ -f "$phase_file_path" ]] || {
|
[[ -f "$phase_file_path" ]] || {
|
||||||
touch "$phase_file_path"
|
touch "$phase_file_path"
|
||||||
@@ -38,7 +38,7 @@ create_phase_file_if_required() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
display_phase_options() {
|
display_phase_options() {
|
||||||
local desc="print docker-options for specified phase"
|
declare desc="print docker-options for specified phase"
|
||||||
local phase="$1"
|
local phase="$1"
|
||||||
local phase_file_path="$2"
|
local phase_file_path="$2"
|
||||||
echo "${phase^} options:"
|
echo "${phase^} options:"
|
||||||
@@ -46,7 +46,7 @@ display_phase_options() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
display_all_phases_options() {
|
display_all_phases_options() {
|
||||||
local desc="print docker-options for all phases"
|
declare desc="print docker-options for all phases"
|
||||||
local phases=("${AVAILABLE_PHASES[@]}")
|
local phases=("${AVAILABLE_PHASES[@]}")
|
||||||
for phase in "${phases[@]}"; do
|
for phase in "${phases[@]}"; do
|
||||||
local phase_file_path="$(get_phase_file_path "$phase")"
|
local phase_file_path="$(get_phase_file_path "$phase")"
|
||||||
@@ -57,7 +57,7 @@ display_all_phases_options() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
display_passed_phases_options() {
|
display_passed_phases_options() {
|
||||||
local desc="print docker options for list of specified phases"
|
declare desc="print docker options for list of specified phases"
|
||||||
local passed_phases=("${!1}")
|
local passed_phases=("${!1}")
|
||||||
local phase
|
local phase
|
||||||
for phase in "${passed_phases[@]}"; do
|
for phase in "${passed_phases[@]}"; do
|
||||||
@@ -71,7 +71,7 @@ display_passed_phases_options() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
add_passed_docker_option() {
|
add_passed_docker_option() {
|
||||||
local desc="adds docker option to specified phases"
|
declare desc="adds docker option to specified phases"
|
||||||
local passed_phases=("${!1}")
|
local passed_phases=("${!1}")
|
||||||
shift
|
shift
|
||||||
local passed_option_string="$*"
|
local passed_option_string="$*"
|
||||||
@@ -86,7 +86,7 @@ add_passed_docker_option() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
remove_passed_docker_option() {
|
remove_passed_docker_option() {
|
||||||
local desc="removes docker option from specified phases"
|
declare desc="removes docker option from specified phases"
|
||||||
local passed_phases=("${!1}")
|
local passed_phases=("${!1}")
|
||||||
shift
|
shift
|
||||||
local passed_option_string="$*"
|
local passed_option_string="$*"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions"
|
||||||
|
|
||||||
docker_options_add_cmd() {
|
docker_options_add_cmd() {
|
||||||
local desc="Add a docker option to application"
|
declare desc="Add a docker option to application"
|
||||||
local cmd="docker-options:add"
|
local cmd="docker-options:add"
|
||||||
|
|
||||||
verify_app_name "$2" && local APP="$2"
|
verify_app_name "$2" && local APP="$2"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions"
|
||||||
|
|
||||||
docker_options_main_cmd() {
|
docker_options_main_cmd() {
|
||||||
local desc="Display applications docker options"
|
declare desc="Display applications docker options"
|
||||||
local cmd="docker-options"
|
local cmd="docker-options"
|
||||||
|
|
||||||
verify_app_name "$2" && local APP="$2"
|
verify_app_name "$2" && local APP="$2"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions"
|
||||||
|
|
||||||
docker_options_remove_cmd() {
|
docker_options_remove_cmd() {
|
||||||
local desc="Remove a docker option from application"
|
declare desc="Remove a docker option from application"
|
||||||
local cmd="docker-options:remove"
|
local cmd="docker-options:remove"
|
||||||
|
|
||||||
verify_app_name "$2" && local APP="$2"
|
verify_app_name "$2" && local APP="$2"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
get_app_domains() {
|
get_app_domains() {
|
||||||
local desc="return app domains"
|
declare desc="return app domains"
|
||||||
verify_app_name "$1"
|
verify_app_name "$1"
|
||||||
local APP=$1; local APP_VHOST_FILE="$DOKKU_ROOT/$APP/VHOST"
|
local APP=$1; local APP_VHOST_FILE="$DOKKU_ROOT/$APP/VHOST"
|
||||||
local GLOBAL_VHOST_PATH="$DOKKU_ROOT/VHOST"
|
local GLOBAL_VHOST_PATH="$DOKKU_ROOT/VHOST"
|
||||||
@@ -21,7 +21,7 @@ get_app_domains() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_default_vhost() {
|
get_default_vhost() {
|
||||||
local desc="return default vhost"
|
declare desc="return default vhost"
|
||||||
verify_app_name "$1"
|
verify_app_name "$1"
|
||||||
local APP="$1"; local RE_IPV4="$(get_ipv4_regex)"; local RE_IPV6="$(get_ipv6_regex)"
|
local APP="$1"; local RE_IPV4="$(get_ipv4_regex)"; local RE_IPV6="$(get_ipv6_regex)"
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ get_default_vhost() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
domains_setup() {
|
domains_setup() {
|
||||||
local desc="setup domains to default state"
|
declare desc="setup domains to default state"
|
||||||
verify_app_name "$1"
|
verify_app_name "$1"
|
||||||
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"; local GLOBAL_VHOST_PATH="$DOKKU_ROOT/VHOST"
|
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"; local GLOBAL_VHOST_PATH="$DOKKU_ROOT/VHOST"
|
||||||
local RE_IPV4="$(get_ipv4_regex)"; local RE_IPV6="$(get_ipv6_regex)"
|
local RE_IPV4="$(get_ipv4_regex)"; local RE_IPV6="$(get_ipv6_regex)"
|
||||||
@@ -62,7 +62,7 @@ domains_setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
domains_add() {
|
domains_add() {
|
||||||
local desc="add list of domains to app"
|
declare desc="add list of domains to app"
|
||||||
verify_app_name "$1"
|
verify_app_name "$1"
|
||||||
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ domains_add() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
domains_remove() {
|
domains_remove() {
|
||||||
local desc="remove list of app domains"
|
declare desc="remove list of app domains"
|
||||||
verify_app_name "$1"
|
verify_app_name "$1"
|
||||||
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||||
local DEFAULT_VHOST="$(get_default_vhost "$APP")"
|
local DEFAULT_VHOST="$(get_default_vhost "$APP")"
|
||||||
@@ -99,7 +99,7 @@ domains_remove() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
domains_disable() {
|
domains_disable() {
|
||||||
local desc="disable domains/VHOST support"
|
declare desc="disable domains/VHOST support"
|
||||||
verify_app_name "$1"
|
verify_app_name "$1"
|
||||||
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ domains_disable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
domains_enable() {
|
domains_enable() {
|
||||||
local desc="enable domains/VHOST support"
|
declare desc="enable domains/VHOST support"
|
||||||
verify_app_name "$1"
|
verify_app_name "$1"
|
||||||
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||||
local DEFAULT_VHOST="$(get_default_vhost "$APP")"
|
local DEFAULT_VHOST="$(get_default_vhost "$APP")"
|
||||||
@@ -128,7 +128,7 @@ domains_enable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
domains_set_global() {
|
domains_set_global() {
|
||||||
local desc="set global domain name"
|
declare desc="set global domain name"
|
||||||
local NEW_GLOBAL_VHOST="$1"; local GLOBAL_VHOST_PATH="$DOKKU_ROOT/VHOST"
|
local NEW_GLOBAL_VHOST="$1"; local GLOBAL_VHOST_PATH="$DOKKU_ROOT/VHOST"
|
||||||
|
|
||||||
if [[ -n "$NEW_GLOBAL_VHOST" ]]; then
|
if [[ -n "$NEW_GLOBAL_VHOST" ]]; then
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||||
|
|
||||||
domains_add_cmd() {
|
domains_add_cmd() {
|
||||||
local desc="adds domain to app via command line"
|
declare desc="adds domain to app via command line"
|
||||||
local cmd="domains:add"
|
local cmd="domains:add"
|
||||||
[[ -z $2 ]] && 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"
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||||
|
|
||||||
domains_clear_cmd() {
|
domains_clear_cmd() {
|
||||||
local desc="clear all app domains"
|
declare desc="clear all app domains"
|
||||||
local cmd="domains:clear"
|
local cmd="domains:clear"
|
||||||
[[ -z $2 ]] && 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"
|
||||||
verify_app_name "$2"
|
verify_app_name "$2"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||||
|
|
||||||
domains_main_cmd() {
|
domains_main_cmd() {
|
||||||
local desc="print app domains"
|
declare desc="print app domains"
|
||||||
local cmd="domains"
|
local cmd="domains"
|
||||||
local APP="$2"
|
local APP="$2"
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||||
|
|
||||||
domains_disable_cmd() {
|
domains_disable_cmd() {
|
||||||
local desc="disable domains/VHOST support via command line"
|
declare desc="disable domains/VHOST support via command line"
|
||||||
local cmd="domains:disable"
|
local cmd="domains:disable"
|
||||||
[[ -z $2 ]] && 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"
|
||||||
domains_disable "$2"
|
domains_disable "$2"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||||
|
|
||||||
domains_enable_cmd() {
|
domains_enable_cmd() {
|
||||||
local desc="enable domains/VHOST support via command line"
|
declare desc="enable domains/VHOST support via command line"
|
||||||
local cmd="domains:enable"
|
local cmd="domains:enable"
|
||||||
[[ -z $2 ]] && 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"
|
||||||
domains_enable "$2"
|
domains_enable "$2"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||||
|
|
||||||
domains_remove_cmd() {
|
domains_remove_cmd() {
|
||||||
local desc="removes domains from app via command line"
|
declare desc="removes domains from app via command line"
|
||||||
local cmd="domains:remove"
|
local cmd="domains:remove"
|
||||||
[[ -z $2 ]] && 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"
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||||
|
|
||||||
domains_set_global_cmd() {
|
domains_set_global_cmd() {
|
||||||
local desc="set global domain name from command line"
|
declare desc="set global domain name from command line"
|
||||||
local cmd="domains:set-global"
|
local cmd="domains:set-global"
|
||||||
[[ -z $2 ]] && dokku_log_fail "Please specify a global domain name"
|
[[ -z $2 ]] && dokku_log_fail "Please specify a global domain name"
|
||||||
domains_set_global "$2"
|
domains_set_global "$2"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||||
|
|
||||||
domains_setup_cmd() {
|
domains_setup_cmd() {
|
||||||
local desc="setup domains to default state via command line"
|
declare desc="setup domains to default state via command line"
|
||||||
local cmd="domains:setup"
|
local cmd="domains:setup"
|
||||||
[[ -z $2 ]] && 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"
|
||||||
domains_setup "$2"
|
domains_setup "$2"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
enter_default_cmd() {
|
enter_default_cmd() {
|
||||||
local desc="enters running app container of specified proc type"
|
declare desc="enters running app container of specified proc type"
|
||||||
local cmd="enter"
|
local cmd="enter"
|
||||||
local APP="$2"; local CONTAINER_TYPE="$3"; local IMAGE_TAG=$(get_running_image_tag "$APP"); local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
local APP="$2"; local CONTAINER_TYPE="$3"; local IMAGE_TAG=$(get_running_image_tag "$APP"); local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
|
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
|
||||||
|
|
||||||
git_build_app_repo() {
|
git_build_app_repo() {
|
||||||
local desc="builds local git app repo for app"
|
declare desc="builds local git app repo for app"
|
||||||
verify_app_name "$1"
|
verify_app_name "$1"
|
||||||
local APP="$1"; local REV="$2"
|
local APP="$1"; local REV="$2"
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ git_build_app_repo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
git_hook_cmd() {
|
git_hook_cmd() {
|
||||||
local desc="kick off receive-app trigger from git prereceive hook"
|
declare desc="kick off receive-app trigger from git prereceive hook"
|
||||||
local cmd="git-hook"
|
local cmd="git-hook"
|
||||||
local APP="$2"
|
local APP="$2"
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ git_hook_cmd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
git_upload_pack_cmd() {
|
git_upload_pack_cmd() {
|
||||||
local desc="executes git-upload-pack"
|
declare desc="executes git-upload-pack"
|
||||||
local cmd="git-upload-pack"
|
local cmd="git-upload-pack"
|
||||||
local APP="$(echo "$2" | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
|
local APP="$(echo "$2" | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
|
||||||
plugn trigger git-pre-pull "$APP"
|
plugn trigger git-pre-pull "$APP"
|
||||||
@@ -76,7 +76,7 @@ git_upload_pack_cmd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
git_build_cmd() {
|
git_build_cmd() {
|
||||||
local desc="lock git-build"
|
declare desc="lock git-build"
|
||||||
local cmd="git-build"
|
local cmd="git-build"
|
||||||
local APP="$2"; local APP_BUILD_LOCK="$DOKKU_ROOT/$APP/.build.lock"
|
local APP="$2"; local APP_BUILD_LOCK="$DOKKU_ROOT/$APP/.build.lock"
|
||||||
local APP_BUILD_LOCK_MSG="$APP is currently being deployed or locked. Waiting..."
|
local APP_BUILD_LOCK_MSG="$APP is currently being deployed or locked. Waiting..."
|
||||||
@@ -87,7 +87,7 @@ git_build_cmd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
git_build_locked_cmd() {
|
git_build_locked_cmd() {
|
||||||
local desc="setup and call git_build_app_repo"
|
declare desc="setup and call git_build_app_repo"
|
||||||
local cmd="git-build-locked"
|
local cmd="git-build-locked"
|
||||||
local APP="$2"
|
local APP="$2"
|
||||||
if [[ $# -ge 3 ]]; then
|
if [[ $# -ge 3 ]]; then
|
||||||
@@ -100,7 +100,7 @@ git_build_locked_cmd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
git_glob_cmd() {
|
git_glob_cmd() {
|
||||||
local desc="catch-all for any other git-* commands"
|
declare desc="catch-all for any other git-* commands"
|
||||||
local cmd="git-*"
|
local cmd="git-*"
|
||||||
local APP="$(echo "$2" | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g' | sed 's/^\///g')"
|
local APP="$(echo "$2" | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g' | sed 's/^\///g')"
|
||||||
local APP_PATH=$DOKKU_ROOT/$APP
|
local APP_PATH=$DOKKU_ROOT/$APP
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
git_receive_app(){
|
git_receive_app(){
|
||||||
local desc="git receive-app plugin trigger"
|
declare desc="git receive-app plugin trigger"
|
||||||
local trigger="git_receive_app"
|
local trigger="git_receive_app"
|
||||||
local APP="$1"; local REV="$2"
|
local APP="$1"; local REV="$2"
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
local desc="logs specific usage"
|
declare desc="logs specific usage"
|
||||||
echo "Usage: dokku logs <app>"
|
echo "Usage: dokku logs <app>"
|
||||||
echo " display recent log output"
|
echo " display recent log output"
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
logs_default_cmd() {
|
logs_default_cmd() {
|
||||||
local desc="shows the last logs for an app via command line"
|
declare desc="shows the last logs for an app via command line"
|
||||||
local cmd="logs"
|
local cmd="logs"
|
||||||
[[ -z $2 ]] && 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 "$2"
|
local APP="$2"; verify_app_name "$2"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
named_containers_post_deploy() {
|
named_containers_post_deploy() {
|
||||||
local desc="names deployed app container is consistent manner"
|
declare desc="names deployed app container is consistent manner"
|
||||||
local trigger="named_containers_post_deploy"
|
local trigger="named_containers_post_deploy"
|
||||||
local APP="$1"; local APP_ROOT="$DOKKU_ROOT/$APP"
|
local APP="$1"; local APP_ROOT="$DOKKU_ROOT/$APP"
|
||||||
[[ -z $(stat -t "$APP_ROOT"/CONTAINER.* 2>/dev/null) ]] && exit 0
|
[[ -z $(stat -t "$APP_ROOT"/CONTAINER.* 2>/dev/null) ]] && exit 0
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||||
|
|
||||||
validate_nginx() {
|
validate_nginx() {
|
||||||
local desc="validate entire nginx config"
|
declare desc="validate entire nginx config"
|
||||||
set +e
|
set +e
|
||||||
sudo /usr/sbin/nginx -t > /dev/null 2>&1
|
sudo /usr/sbin/nginx -t > /dev/null 2>&1
|
||||||
local exit_code=$?
|
local exit_code=$?
|
||||||
@@ -19,7 +19,7 @@ validate_nginx() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
restart_nginx() {
|
restart_nginx() {
|
||||||
local desc="restart nginx for given distros"
|
declare desc="restart nginx for given distros"
|
||||||
case "$DOKKU_DISTRO" in
|
case "$DOKKU_DISTRO" in
|
||||||
debian)
|
debian)
|
||||||
sudo /usr/sbin/invoke-rc.d nginx reload > /dev/null
|
sudo /usr/sbin/invoke-rc.d nginx reload > /dev/null
|
||||||
@@ -40,7 +40,7 @@ restart_nginx() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nginx_logs() {
|
nginx_logs() {
|
||||||
local desc="display app nginx logs"
|
declare desc="display app nginx logs"
|
||||||
local APP="$2"; verify_app_name "$APP"
|
local APP="$2"; verify_app_name "$APP"
|
||||||
local NGINX_LOGS_TYPE=${1#nginx:}
|
local NGINX_LOGS_TYPE=${1#nginx:}
|
||||||
local NGINX_LOGS_TYPE=${NGINX_LOGS_TYPE%-logs}
|
local NGINX_LOGS_TYPE=${NGINX_LOGS_TYPE%-logs}
|
||||||
@@ -56,7 +56,7 @@ nginx_logs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
configure_nginx_ports() {
|
configure_nginx_ports() {
|
||||||
local desc="configure nginx listening ports"
|
declare desc="configure nginx listening ports"
|
||||||
local APP=$1; verify_app_name "$APP"
|
local APP=$1; verify_app_name "$APP"
|
||||||
local RAW_TCP_PORTS="$(get_app_raw_tcp_ports "$APP")"
|
local RAW_TCP_PORTS="$(get_app_raw_tcp_ports "$APP")"
|
||||||
local DOKKU_NGINX_PORT=$(config_get "$APP" DOKKU_NGINX_PORT)
|
local DOKKU_NGINX_PORT=$(config_get "$APP" DOKKU_NGINX_PORT)
|
||||||
@@ -89,7 +89,7 @@ configure_nginx_ports() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
validate_ssl_domains() {
|
validate_ssl_domains() {
|
||||||
local desc="check configured domains against SSL cert contents and show warning if mismatched"
|
declare desc="check configured domains against SSL cert contents and show warning if mismatched"
|
||||||
local APP=$1; verify_app_name "$APP"
|
local APP=$1; verify_app_name "$APP"
|
||||||
local SSL_HOSTNAME=$(get_ssl_hostnames "$APP")
|
local SSL_HOSTNAME=$(get_ssl_hostnames "$APP")
|
||||||
local SSL_HOSTNAME_REGEX=$(echo "$SSL_HOSTNAME" | xargs | sed 's|\.|\\.|g' | sed 's/\*/\[^\.\]\*/g' | sed 's/ /|/g')
|
local SSL_HOSTNAME_REGEX=$(echo "$SSL_HOSTNAME" | xargs | sed 's|\.|\\.|g' | sed 's/\*/\[^\.\]\*/g' | sed 's/ /|/g')
|
||||||
@@ -110,7 +110,7 @@ validate_ssl_domains() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_custom_nginx_template() {
|
get_custom_nginx_template() {
|
||||||
local desc="attempts to copy custom nginx template from app image"
|
declare desc="attempts to copy custom nginx template from app image"
|
||||||
local APP="$1"; verify_app_name "$APP"
|
local APP="$1"; verify_app_name "$APP"
|
||||||
local DESTINATION="$2"
|
local DESTINATION="$2"
|
||||||
local IMAGE_TAG="$(get_running_image_tag "$APP")"
|
local IMAGE_TAG="$(get_running_image_tag "$APP")"
|
||||||
@@ -121,7 +121,7 @@ get_custom_nginx_template() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nginx_build_config() {
|
nginx_build_config() {
|
||||||
local desc="build nginx config to proxy app containers using sigil"
|
declare desc="build nginx config to proxy app containers using sigil"
|
||||||
local APP="$1"; verify_app_name "$APP"
|
local APP="$1"; verify_app_name "$APP"
|
||||||
local DOKKU_APP_LISTEN_PORT="$2"; local DOKKU_APP_LISTEN_IP="$3"
|
local DOKKU_APP_LISTEN_PORT="$2"; local DOKKU_APP_LISTEN_IP="$3"
|
||||||
local VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"; local URLS_PATH="$DOKKU_ROOT/$APP/URLS"
|
local VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"; local URLS_PATH="$DOKKU_ROOT/$APP/URLS"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||||
|
|
||||||
nginx_post_deploy() {
|
nginx_post_deploy() {
|
||||||
local desc="nginx-vhosts post-deploy plugin trigger"
|
declare desc="nginx-vhosts post-deploy plugin trigger"
|
||||||
local trigger="nginx_post_deploy"
|
local trigger="nginx_post_deploy"
|
||||||
local APP="$1"
|
local APP="$1"
|
||||||
if [[ -f "$DOKKU_ROOT/$APP/IP.web.1" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT.web.1" ]]; then
|
if [[ -f "$DOKKU_ROOT/$APP/IP.web.1" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT.web.1" ]]; then
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||||
|
|
||||||
nginx_post_domains_update() {
|
nginx_post_domains_update() {
|
||||||
local desc="calls nginx build_config when domains are updated"
|
declare desc="calls nginx build_config when domains are updated"
|
||||||
local trigger="nginx_post_domains_update"
|
local trigger="nginx_post_domains_update"
|
||||||
if [[ "$(get_app_proxy_type "$1")" == "nginx" ]]; then
|
if [[ "$(get_app_proxy_type "$1")" == "nginx" ]]; then
|
||||||
nginx_build_config "$1"
|
nginx_build_config "$1"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/proxy/functions"
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/ps/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/ps/functions"
|
||||||
|
|
||||||
nginx_proxy_disable() {
|
nginx_proxy_disable() {
|
||||||
local desc="disable nginx proxy"
|
declare desc="disable nginx proxy"
|
||||||
local trigger="nginx_proxy_disable"
|
local trigger="nginx_proxy_disable"
|
||||||
local APP="$1"; verify_app_name "$APP"
|
local APP="$1"; verify_app_name "$APP"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/proxy/functions"
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/ps/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/ps/functions"
|
||||||
|
|
||||||
nginx_proxy_enable() {
|
nginx_proxy_enable() {
|
||||||
local desc="enable nginx proxy"
|
declare desc="enable nginx proxy"
|
||||||
local trigger="nginx_proxy_enable"
|
local trigger="nginx_proxy_enable"
|
||||||
local APP="$1"; verify_app_name "$APP"
|
local APP="$1"; verify_app_name "$APP"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||||
|
|
||||||
nginx_logs_cmd() {
|
nginx_logs_cmd() {
|
||||||
local desc="display app nginx logs from command line"
|
declare desc="display app nginx logs from command line"
|
||||||
local cmd="$1"
|
local cmd="$1"
|
||||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||||
nginx_logs "$@"
|
nginx_logs "$@"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||||
|
|
||||||
nginx_build_config_cmd() {
|
nginx_build_config_cmd() {
|
||||||
local desc="build nginx config to proxy app containers from command line"
|
declare desc="build nginx config to proxy app containers from command line"
|
||||||
local cmd="nginx:build-config"
|
local cmd="nginx:build-config"
|
||||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||||
nginx_build_config "$2"
|
nginx_build_config "$2"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
disable_plugin() {
|
disable_plugin() {
|
||||||
local desc="disables specified plugin name"
|
declare desc="disables specified plugin name"
|
||||||
local PLUGIN="$1"
|
local PLUGIN="$1"
|
||||||
[[ -e $PLUGIN_CORE_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Cannot disable a core plugin"
|
[[ -e $PLUGIN_CORE_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Cannot disable a core plugin"
|
||||||
[[ ! -e $PLUGIN_ENABLED_PATH/$PLUGIN ]] && dokku_log_fail "Plugin already disabled"
|
[[ ! -e $PLUGIN_ENABLED_PATH/$PLUGIN ]] && dokku_log_fail "Plugin already disabled"
|
||||||
@@ -13,7 +13,7 @@ disable_plugin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enable_plugin() {
|
enable_plugin() {
|
||||||
local desc="enables specified plugin name"
|
declare desc="enables specified plugin name"
|
||||||
local PLUGIN="$1"
|
local PLUGIN="$1"
|
||||||
[[ -e $PLUGIN_ENABLED_PATH/$PLUGIN ]] && dokku_log_fail "Plugin already enabled"
|
[[ -e $PLUGIN_ENABLED_PATH/$PLUGIN ]] && dokku_log_fail "Plugin already enabled"
|
||||||
[[ ! -e $PLUGIN_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Plugin does not exist"
|
[[ ! -e $PLUGIN_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Plugin does not exist"
|
||||||
@@ -22,14 +22,14 @@ enable_plugin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
download_plugin() {
|
download_plugin() {
|
||||||
local desc="download plugin from URL and set name"
|
declare desc="download plugin from URL and set name"
|
||||||
local PLUGIN_GIT_URL="$1"
|
local PLUGIN_GIT_URL="$1"
|
||||||
local PLUGIN_NAME="$2"
|
local PLUGIN_NAME="$2"
|
||||||
plugn install "$PLUGIN_GIT_URL" "$PLUGIN_NAME"
|
plugn install "$PLUGIN_GIT_URL" "$PLUGIN_NAME"
|
||||||
}
|
}
|
||||||
|
|
||||||
download_and_enable_plugin() {
|
download_and_enable_plugin() {
|
||||||
local desc="wrapper to download and enable specified version of plugin"
|
declare desc="wrapper to download and enable specified version of plugin"
|
||||||
local PLUGIN_GIT_URL="$1"
|
local PLUGIN_GIT_URL="$1"
|
||||||
shift
|
shift
|
||||||
while getopts ":-:" opt "$@"; do
|
while getopts ":-:" opt "$@"; do
|
||||||
@@ -58,7 +58,7 @@ download_and_enable_plugin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update_plugin() {
|
update_plugin() {
|
||||||
local desc="update plugin"
|
declare desc="update plugin"
|
||||||
local PLUGIN="$1"
|
local PLUGIN="$1"
|
||||||
local PLUGIN_COMMITTISH="$2"
|
local PLUGIN_COMMITTISH="$2"
|
||||||
[[ ! -e $PLUGIN_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Plugin ($PLUGIN) is not currently installed"
|
[[ ! -e $PLUGIN_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Plugin ($PLUGIN) is not currently installed"
|
||||||
@@ -66,7 +66,7 @@ update_plugin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uninstall_plugin() {
|
uninstall_plugin() {
|
||||||
local desc="uninstall plugin"
|
declare desc="uninstall plugin"
|
||||||
local PLUGIN="$1"
|
local PLUGIN="$1"
|
||||||
[[ -e $PLUGIN_CORE_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Cannot uninstall a core plugin"
|
[[ -e $PLUGIN_CORE_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Cannot uninstall a core plugin"
|
||||||
[[ ! -e $PLUGIN_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Plugin ($PLUGIN) is not currently installed"
|
[[ ! -e $PLUGIN_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Plugin ($PLUGIN) is not currently installed"
|
||||||
@@ -75,7 +75,7 @@ uninstall_plugin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugin_name() {
|
plugin_name() {
|
||||||
local desc="default plugin name"
|
declare desc="default plugin name"
|
||||||
local PLUGIN_GIT_URL="$1"
|
local PLUGIN_GIT_URL="$1"
|
||||||
echo "$PLUGIN_GIT_URL" | awk -F '/' '{ print $NF }' | sed -e "s:.git::g" | sed 's:^dokku-::'
|
echo "$PLUGIN_GIT_URL" | awk -F '/' '{ print $NF }' | sed -e "s:.git::g" | sed 's:^dokku-::'
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
plugin_main_cmd() {
|
plugin_main_cmd() {
|
||||||
local desc="shows details about locally installed plugins"
|
declare desc="shows details about locally installed plugins"
|
||||||
local cmd="plugin"
|
local cmd="plugin"
|
||||||
plugn version
|
plugn version
|
||||||
plugn list
|
plugn list
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/plugin/functions"
|
source "$PLUGIN_AVAILABLE_PATH/plugin/functions"
|
||||||
|
|
||||||
plugin_disable_cmd() {
|
plugin_disable_cmd() {
|
||||||
local desc="disables plugin via command line"
|
declare desc="disables plugin via command line"
|
||||||
local cmd="plugin:disable"
|
local cmd="plugin:disable"
|
||||||
[[ -z $2 ]] && dokku_log_fail "Please specify a plugin to disable"
|
[[ -z $2 ]] && dokku_log_fail "Please specify a plugin to disable"
|
||||||
local PLUGIN="$2"
|
local PLUGIN="$2"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/plugin/functions"
|
source "$PLUGIN_AVAILABLE_PATH/plugin/functions"
|
||||||
|
|
||||||
plugin_enable_cmd() {
|
plugin_enable_cmd() {
|
||||||
local desc="enables plugin via command line"
|
declare desc="enables plugin via command line"
|
||||||
local cmd="plugin:enable"
|
local cmd="plugin:enable"
|
||||||
[[ -z $2 ]] && dokku_log_fail "Please specify a plugin to enable"
|
[[ -z $2 ]] && dokku_log_fail "Please specify a plugin to enable"
|
||||||
local PLUGIN="$2"
|
local PLUGIN="$2"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/plugin/functions"
|
source "$PLUGIN_AVAILABLE_PATH/plugin/functions"
|
||||||
|
|
||||||
plugin_install_cmd() {
|
plugin_install_cmd() {
|
||||||
local desc="installs a plugin from URL and calls install plugin trigger via command line"
|
declare desc="installs a plugin from URL and calls install plugin trigger via command line"
|
||||||
local cmd="plugin:install"
|
local cmd="plugin:install"
|
||||||
case "$2" in
|
case "$2" in
|
||||||
--core)
|
--core)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
plugin_install_dependencies_cmd() {
|
plugin_install_dependencies_cmd() {
|
||||||
local desc="calls dependencies plugin trigger via command line"
|
declare desc="calls dependencies plugin trigger via command line"
|
||||||
local cmd="plugin:install-dependencies"
|
local cmd="plugin:install-dependencies"
|
||||||
if [[ $2 == "--core" ]]; then
|
if [[ $2 == "--core" ]]; then
|
||||||
export PLUGIN_PATH="$PLUGIN_CORE_PATH"
|
export PLUGIN_PATH="$PLUGIN_CORE_PATH"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/plugin/functions"
|
source "$PLUGIN_AVAILABLE_PATH/plugin/functions"
|
||||||
|
|
||||||
plugin_uninstall_cmd() {
|
plugin_uninstall_cmd() {
|
||||||
local desc="uninstalls plugin via command line"
|
declare desc="uninstalls plugin via command line"
|
||||||
local cmd="plugin:uninstall"
|
local cmd="plugin:uninstall"
|
||||||
[[ -z $2 ]] && dokku_log_fail "Please specify a plugin to enable"
|
[[ -z $2 ]] && dokku_log_fail "Please specify a plugin to enable"
|
||||||
local PLUGIN="$2"
|
local PLUGIN="$2"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
plugin_update_cmd() {
|
plugin_update_cmd() {
|
||||||
local desc="updates plugin to optional committish and calls update plugin trigger via command line"
|
declare desc="updates plugin to optional committish and calls update plugin trigger via command line"
|
||||||
local cmd="plugin:update"
|
local cmd="plugin:update"
|
||||||
if [[ -n "$2" ]]; then
|
if [[ -n "$2" ]]; then
|
||||||
local PLUGIN="$2"
|
local PLUGIN="$2"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
is_app_proxy_enabled() {
|
is_app_proxy_enabled() {
|
||||||
local desc="return true if proxy is enabled; otherwise return false"
|
declare desc="return true if proxy is enabled; otherwise return false"
|
||||||
local APP="$1"; verify_app_name "$APP"
|
local APP="$1"; verify_app_name "$APP"
|
||||||
local APP_PROXY_ENABLED=true
|
local APP_PROXY_ENABLED=true
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ is_app_proxy_enabled() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_app_proxy_type() {
|
get_app_proxy_type() {
|
||||||
local desc="return app proxy type"
|
declare desc="return app proxy type"
|
||||||
local APP="$1"; verify_app_name "$APP"
|
local APP="$1"; verify_app_name "$APP"
|
||||||
local APP_PROXY_TYPE="nginx"
|
local APP_PROXY_TYPE="nginx"
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||||
|
|
||||||
proxy_main_cmd() {
|
proxy_main_cmd() {
|
||||||
local desc="displays app proxy implementation via command line"
|
declare desc="displays app proxy implementation via command line"
|
||||||
local cmd="proxy"
|
local cmd="proxy"
|
||||||
local ALL_APPS=$(dokku_apps)
|
local ALL_APPS=$(dokku_apps)
|
||||||
if [[ -n "$2" ]]; then
|
if [[ -n "$2" ]]; then
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||||
|
|
||||||
proxy_disable_cmd() {
|
proxy_disable_cmd() {
|
||||||
local desc="disable proxy for app via command line"
|
declare desc="disable proxy for app via command line"
|
||||||
local cmd="proxy:disable"
|
local cmd="proxy:disable"
|
||||||
[[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on"
|
[[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||||
local APP="$1"; verify_app_name "$APP"
|
local APP="$1"; verify_app_name "$APP"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||||
|
|
||||||
proxy_enable_cmd() {
|
proxy_enable_cmd() {
|
||||||
local desc="enable proxy for app via command line"
|
declare desc="enable proxy for app via command line"
|
||||||
local cmd="proxy:enable"
|
local cmd="proxy:enable"
|
||||||
[[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on"
|
[[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||||
local APP="$1"; verify_app_name "$APP"
|
local APP="$1"; verify_app_name "$APP"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
proxy_set_cmd() {
|
proxy_set_cmd() {
|
||||||
local desc="enable proxy for app via command line"
|
declare desc="enable proxy for app via command line"
|
||||||
local cmd="proxy:set"
|
local cmd="proxy:set"
|
||||||
[[ -z $2 ]] && 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"
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
print_dokku_scale_file() {
|
print_dokku_scale_file() {
|
||||||
local desc="prints contents of DOKKU_SCALE file"
|
declare desc="prints contents of DOKKU_SCALE file"
|
||||||
local APP="$1"; local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
local APP="$1"; local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
||||||
while read -r line || [[ -n "$line" ]]; do
|
while read -r line || [[ -n "$line" ]]; do
|
||||||
dokku_log_info2_quiet "$line"
|
dokku_log_info2_quiet "$line"
|
||||||
@@ -11,7 +11,7 @@ print_dokku_scale_file() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extract_procfile() {
|
extract_procfile() {
|
||||||
local desc="extracts procfile from app image"
|
declare desc="extracts procfile from app image"
|
||||||
local APP="$1"
|
local APP="$1"
|
||||||
local IMAGE_TAG="$(get_running_image_tag "$APP")"
|
local IMAGE_TAG="$(get_running_image_tag "$APP")"
|
||||||
local IMAGE="$(get_app_image_name "$APP" "$IMAGE_TAG")"
|
local IMAGE="$(get_app_image_name "$APP" "$IMAGE_TAG")"
|
||||||
@@ -27,7 +27,7 @@ extract_procfile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
remove_procfile() {
|
remove_procfile() {
|
||||||
local desc="removes DOKKU_PROCFILE"
|
declare desc="removes DOKKU_PROCFILE"
|
||||||
local APP="$1"; local DOKKU_PROCFILE="$DOKKU_ROOT/$APP/DOKKU_PROCFILE"
|
local APP="$1"; local DOKKU_PROCFILE="$DOKKU_ROOT/$APP/DOKKU_PROCFILE"
|
||||||
if [[ -f "$DOKKU_PROCFILE" ]]; then
|
if [[ -f "$DOKKU_PROCFILE" ]]; then
|
||||||
rm -f "$DOKKU_PROCFILE"
|
rm -f "$DOKKU_PROCFILE"
|
||||||
@@ -35,7 +35,7 @@ remove_procfile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
generate_scale_file() {
|
generate_scale_file() {
|
||||||
local desc="generates DOKKU_SCALE file"
|
declare desc="generates DOKKU_SCALE file"
|
||||||
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG"); local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG"); local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
||||||
local DOKKU_PROCFILE="$DOKKU_ROOT/$APP/DOKKU_PROCFILE"
|
local DOKKU_PROCFILE="$DOKKU_ROOT/$APP/DOKKU_PROCFILE"
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
@@ -68,7 +68,7 @@ generate_scale_file() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_scale() {
|
set_scale() {
|
||||||
local desc="sets app proc type scaling"
|
declare desc="sets app proc type scaling"
|
||||||
local APP="$1"; local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
local APP="$1"; local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
||||||
shift 1
|
shift 1
|
||||||
local SCALE_SETTINGS=("$@")
|
local SCALE_SETTINGS=("$@")
|
||||||
@@ -86,7 +86,7 @@ set_scale() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ps_start() {
|
ps_start() {
|
||||||
local desc="starts app"
|
declare desc="starts app"
|
||||||
local APP="$1"; verify_app_name "$APP"
|
local APP="$1"; verify_app_name "$APP"
|
||||||
local IMAGE_TAG=$(get_running_image_tag "$APP");
|
local IMAGE_TAG=$(get_running_image_tag "$APP");
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ ps_start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ps_stop() {
|
ps_stop() {
|
||||||
local desc="stops app"
|
declare desc="stops app"
|
||||||
local APP="$1"; verify_app_name "$APP"
|
local APP="$1"; verify_app_name "$APP"
|
||||||
local DOKKU_APP_RUNNING_CONTAINER_IDS=$(get_app_running_container_ids "$APP")
|
local DOKKU_APP_RUNNING_CONTAINER_IDS=$(get_app_running_container_ids "$APP")
|
||||||
|
|
||||||
@@ -117,14 +117,14 @@ ps_stop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ps_rebuild() {
|
ps_rebuild() {
|
||||||
local desc="rebuilds app from base image"
|
declare desc="rebuilds app from base image"
|
||||||
local APP="$1"; verify_app_name "$APP"
|
local APP="$1"; verify_app_name "$APP"
|
||||||
|
|
||||||
plugn trigger receive-app "$APP"
|
plugn trigger receive-app "$APP"
|
||||||
}
|
}
|
||||||
|
|
||||||
ps_restart() {
|
ps_restart() {
|
||||||
local desc="restarts app"
|
declare desc="restarts app"
|
||||||
local APP="$1"; verify_app_name "$APP"
|
local APP="$1"; verify_app_name "$APP"
|
||||||
local IMAGE_TAG=$(get_running_image_tag "$APP")
|
local IMAGE_TAG=$(get_running_image_tag "$APP")
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ ps_restart() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ps_scale() {
|
ps_scale() {
|
||||||
local desc="sets app scaling config according arguments; otherwise according to DOKKU_SCALE file"
|
declare desc="sets app scaling config according arguments; otherwise according to DOKKU_SCALE file"
|
||||||
local APP="$1"; verify_app_name "$APP"
|
local APP="$1"; verify_app_name "$APP"
|
||||||
local IMAGE_TAG=$(get_running_image_tag "$APP")
|
local IMAGE_TAG=$(get_running_image_tag "$APP")
|
||||||
local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||||
|
|
||||||
ps_post_deploy() {
|
ps_post_deploy() {
|
||||||
local desc="ps post-deploy plugin trigger"
|
declare desc="ps post-deploy plugin trigger"
|
||||||
local trigger="ps_post_deploy"
|
local trigger="ps_post_deploy"
|
||||||
local APP="$1"
|
local APP="$1"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||||
|
|
||||||
ps_post_stop() {
|
ps_post_stop() {
|
||||||
local desc="ps post-stop plugin trigger"
|
declare desc="ps post-stop plugin trigger"
|
||||||
local trigger="ps_post_stop"
|
local trigger="ps_post_stop"
|
||||||
local APP="$1"
|
local APP="$1"
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||||
|
|
||||||
ps_pre_deploy() {
|
ps_pre_deploy() {
|
||||||
local desc="ps pre-deploy plugin trigger"
|
declare desc="ps pre-deploy plugin trigger"
|
||||||
local trigger="ps_pre_deploy"
|
local trigger="ps_pre_deploy"
|
||||||
local APP="$1"
|
local APP="$1"
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
ps_main_cmd() {
|
ps_main_cmd() {
|
||||||
local desc="shows running processes in all running app containers"
|
declare desc="shows running processes in all running app containers"
|
||||||
local cmd="ps"
|
local cmd="ps"
|
||||||
[[ -z $2 ]] && 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"
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||||
|
|
||||||
ps_rebuild_cmd() {
|
ps_rebuild_cmd() {
|
||||||
local desc="rebuilds app via command line"
|
declare desc="rebuilds app via command line"
|
||||||
local cmd="ps:rebuild"
|
local cmd="ps:rebuild"
|
||||||
[[ -z $2 ]] && 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"
|
||||||
ps_rebuild "$2"
|
ps_rebuild "$2"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||||
|
|
||||||
ps_rebuildall_cmd() {
|
ps_rebuildall_cmd() {
|
||||||
local desc="rebuilds all deployed apps via command line"
|
declare desc="rebuilds all deployed apps via command line"
|
||||||
local cmd="ps:rebuildall"
|
local cmd="ps:rebuildall"
|
||||||
for app in $(dokku_apps); do
|
for app in $(dokku_apps); do
|
||||||
is_deployed "$app" && ps_rebuild "$app"
|
is_deployed "$app" && ps_rebuild "$app"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||||
|
|
||||||
ps_restart_cmd() {
|
ps_restart_cmd() {
|
||||||
local desc="restarts app via command line"
|
declare desc="restarts app via command line"
|
||||||
local cmd="ps:restart"
|
local cmd="ps:restart"
|
||||||
[[ -z $2 ]] && 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"
|
||||||
ps_restart "$2"
|
ps_restart "$2"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||||
|
|
||||||
ps_restartall_cmd() {
|
ps_restartall_cmd() {
|
||||||
local desc="restarts all apps via command line"
|
declare desc="restarts all apps via command line"
|
||||||
local cmd="ps:restartall"
|
local cmd="ps:restartall"
|
||||||
for app in $(dokku_apps); do
|
for app in $(dokku_apps); do
|
||||||
ps_restart "$app"
|
ps_restart "$app"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||||
|
|
||||||
ps_restore_cmd() {
|
ps_restore_cmd() {
|
||||||
local desc="starts all apps with DOKKU_APP_RESTORE not set to 0 via command line"
|
declare desc="starts all apps with DOKKU_APP_RESTORE not set to 0 via command line"
|
||||||
local cmd="ps:restore"
|
local cmd="ps:restore"
|
||||||
for app in $(dokku_apps); do
|
for app in $(dokku_apps); do
|
||||||
local DOKKU_APP_RESTORE=$(config_get "$app" DOKKU_APP_RESTORE || true)
|
local DOKKU_APP_RESTORE=$(config_get "$app" DOKKU_APP_RESTORE || true)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||||
|
|
||||||
ps_scale_cmd() {
|
ps_scale_cmd() {
|
||||||
local desc="sets app scaling config via command line"
|
declare desc="sets app scaling config via command line"
|
||||||
local cmd="ps:scale"
|
local cmd="ps:scale"
|
||||||
[[ -z $2 ]] && 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"
|
||||||
shift 1
|
shift 1
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||||
|
|
||||||
ps_start_cmd() {
|
ps_start_cmd() {
|
||||||
local desc="starts app via command line"
|
declare desc="starts app via command line"
|
||||||
local cmd="ps:start"
|
local cmd="ps:start"
|
||||||
[[ -z $2 ]] && 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"
|
||||||
ps_start "$2"
|
ps_start "$2"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||||
|
|
||||||
ps_stop_cmd() {
|
ps_stop_cmd() {
|
||||||
local desc="stops app via command line"
|
declare desc="stops app via command line"
|
||||||
local cmd="ps:stop"
|
local cmd="ps:stop"
|
||||||
[[ -z $2 ]] && 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"
|
||||||
ps_stop "$2"
|
ps_stop "$2"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
shell_cmd() {
|
shell_cmd() {
|
||||||
local desc="dokku shell interpreter via command line"
|
declare desc="dokku shell interpreter via command line"
|
||||||
local cmd="shell"
|
local cmd="shell"
|
||||||
local INPUTRC="$PLUGIN_ROOT/inputrc"
|
local INPUTRC="$PLUGIN_ROOT/inputrc"
|
||||||
local HISTFILE=~/.dokku_history
|
local HISTFILE=~/.dokku_history
|
||||||
|
|||||||
@@ -3,19 +3,19 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
verify_paths() {
|
verify_paths() {
|
||||||
local desc="verifies storage paths"
|
declare desc="verifies storage paths"
|
||||||
echo "$1" | grep -qe '^/.*\:/' || dokku_log_fail "Storage path must be two valid paths divided by colon."
|
echo "$1" | grep -qe '^/.*\:/' || dokku_log_fail "Storage path must be two valid paths divided by colon."
|
||||||
}
|
}
|
||||||
|
|
||||||
check_if_path_exists() {
|
check_if_path_exists() {
|
||||||
local desc="checks if path exists"
|
declare desc="checks if path exists"
|
||||||
local -r passed_path=$1
|
local -r passed_path=$1
|
||||||
local -r phase_file_path=$2
|
local -r phase_file_path=$2
|
||||||
[[ -r "$phase_file_path" ]] && grep -qe "^-v $passed_path" "$phase_file_path"
|
[[ -r "$phase_file_path" ]] && grep -qe "^-v $passed_path" "$phase_file_path"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_bind_mounts() {
|
get_bind_mounts() {
|
||||||
local desc="strips docker options and prints mounts"
|
declare desc="strips docker options and prints mounts"
|
||||||
local -r phase_file_path=$1
|
local -r phase_file_path=$1
|
||||||
[[ -r "$phase_file_path" ]] && sed -e '/^-v/!d' -e 's/^-v/ /' < "$phase_file_path"
|
[[ -r "$phase_file_path" ]] && sed -e '/^-v/!d' -e 's/^-v/ /' < "$phase_file_path"
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/storage/functions"
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions"
|
||||||
|
|
||||||
storage_list_cmd() {
|
storage_list_cmd() {
|
||||||
local desc="List all bound mounts"
|
declare desc="List all bound mounts"
|
||||||
local cmd="storage:list"
|
local cmd="storage:list"
|
||||||
local passed_phases="deploy"
|
local passed_phases="deploy"
|
||||||
[[ ! $2 ]] && dokku_log_fail "storage:list requires an app to list."
|
[[ ! $2 ]] && dokku_log_fail "storage:list requires an app to list."
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/storage/functions"
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions"
|
||||||
|
|
||||||
storage_mount_cmd() {
|
storage_mount_cmd() {
|
||||||
local desc="Add bind-mount, redeploy app if running"
|
declare desc="Add bind-mount, redeploy app if running"
|
||||||
local cmd="storage:mount"
|
local cmd="storage:mount"
|
||||||
local passed_phases=(deploy run)
|
local passed_phases=(deploy run)
|
||||||
[[ -z $3 || $4 ]] && dokku_log_fail "storage:mount requires an app and a two paths divided by colon."
|
[[ -z $3 || $4 ]] && dokku_log_fail "storage:mount requires an app and a two paths divided by colon."
|
||||||
|
|||||||
Loaded 100 of 111 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user