From 7357579af26763a37223e284a0637dfbb95511c8 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 10 Feb 2020 02:40:59 -0500 Subject: [PATCH] refactor: standardize trigger code --- plugins/20_events/install | 92 +++++---- plugins/app-json/post-deploy | 9 +- plugins/app-json/pre-deploy | 9 +- plugins/apps/post-delete | 11 +- plugins/builder-dockerfile/builder-build | 6 +- plugins/builder-dockerfile/builder-release | 6 +- plugins/builder-herokuish/builder-build | 6 +- plugins/builder-herokuish/builder-release | 6 +- plugins/builder-herokuish/docker-args-build | 12 +- plugins/builder-herokuish/pre-build-buildpack | 6 +- plugins/certs/post-app-clone-setup | 5 +- plugins/checks/install | 11 +- plugins/config/docker-args-deploy | 5 +- plugins/docker-options/docker-args-deploy | 9 +- plugins/domains/install | 17 +- plugins/domains/post-app-clone-setup | 5 +- plugins/git/deploy-source | 6 +- plugins/git/git-revision | 1 + plugins/git/install | 4 +- plugins/git/post-delete | 2 + plugins/nginx-vhosts/core-post-deploy | 14 +- plugins/nginx-vhosts/dependencies | 6 +- plugins/nginx-vhosts/install | 185 +++++++++--------- plugins/nginx-vhosts/post-app-clone-setup | 5 +- plugins/nginx-vhosts/post-certs-update | 9 +- plugins/nginx-vhosts/post-delete | 9 +- plugins/nginx-vhosts/post-domains-update | 7 +- plugins/nginx-vhosts/post-proxy-ports-update | 9 +- plugins/nginx-vhosts/pre-disable-vhost | 9 +- plugins/nginx-vhosts/pre-enable-vhost | 9 +- plugins/nginx-vhosts/proxy-build-config | 8 +- plugins/nginx-vhosts/proxy-clear-config | 8 +- plugins/nginx-vhosts/proxy-disable | 10 +- plugins/nginx-vhosts/proxy-enable | 10 +- plugins/proxy/post-certs-remove | 4 +- plugins/ps/app-restart | 8 +- plugins/ps/core-post-deploy | 8 +- plugins/ps/install | 1 + plugins/ps/post-create | 6 +- plugins/ps/post-stop | 8 +- plugins/ps/pre-deploy | 9 +- plugins/scheduler-docker-local/check-deploy | 12 +- .../scheduler-docker-local/core-post-deploy | 6 +- plugins/scheduler-docker-local/install | 6 +- .../post-app-clone-setup | 5 +- plugins/scheduler-docker-local/post-create | 6 +- plugins/scheduler-docker-local/post-delete | 6 +- plugins/scheduler-docker-local/pre-deploy | 6 +- plugins/scheduler-docker-local/pre-restore | 6 +- .../scheduler-app-status | 6 +- .../scheduler-docker-local/scheduler-deploy | 6 +- .../scheduler-docker-cleanup | 6 +- .../scheduler-docker-local/scheduler-inspect | 6 +- .../scheduler-is-deployed | 5 +- plugins/scheduler-docker-local/scheduler-logs | 6 +- .../scheduler-logs-failed | 6 +- .../scheduler-docker-local/scheduler-retire | 6 +- plugins/scheduler-docker-local/scheduler-run | 6 +- plugins/scheduler-docker-local/scheduler-stop | 6 +- .../scheduler-tags-create | 6 +- .../scheduler-tags-destroy | 6 +- plugins/storage/install | 11 +- plugins/tar/deploy-source | 6 +- 63 files changed, 382 insertions(+), 329 deletions(-) diff --git a/plugins/20_events/install b/plugins/20_events/install index d4b7131e3..22fefc8df 100755 --- a/plugins/20_events/install +++ b/plugins/20_events/install @@ -3,55 +3,58 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -DOKKU_RSYSLOG_FILTER_DIR=/etc/rsyslog.d -DOKKU_RSYSLOG_FILTER=$DOKKU_RSYSLOG_FILTER_DIR/99-dokku.conf -DOKKU_LOGROTATE_FILE=/etc/logrotate.d/dokku +trigger-events-install() { + declare desc="20_events install plugin trigger" + declare trigger="install" + DOKKU_RSYSLOG_FILTER_DIR=/etc/rsyslog.d + DOKKU_RSYSLOG_FILTER=$DOKKU_RSYSLOG_FILTER_DIR/99-dokku.conf + DOKKU_LOGROTATE_FILE=/etc/logrotate.d/dokku -flag_rsyslog_needs_restart=n + flag_rsyslog_needs_restart=n -# This can be done unconditionally as mkdir -p -# exits gracefully if the path already exists -# shellcheck disable=SC2174 -mkdir -m 775 -p "$DOKKU_LOGS_DIR" -case "$DOKKU_DISTRO" in - arch | debian | centos | rhel) - chgrp dokku "$DOKKU_LOGS_DIR" - ;; - *) - chown syslog:dokku "$DOKKU_LOGS_DIR" - ;; -esac - -if [[ ! -f "$DOKKU_EVENTS_LOGFILE" ]]; then - touch "$DOKKU_EVENTS_LOGFILE" + # This can be done unconditionally as mkdir -p + # exits gracefully if the path already exists + # shellcheck disable=SC2174 + mkdir -m 775 -p "$DOKKU_LOGS_DIR" case "$DOKKU_DISTRO" in arch | debian | centos | rhel) - chgrp dokku "$DOKKU_EVENTS_LOGFILE" + chgrp dokku "$DOKKU_LOGS_DIR" ;; *) - # chown syslog:root might not work on SUSE - chown syslog:dokku "$DOKKU_EVENTS_LOGFILE" + chown syslog:dokku "$DOKKU_LOGS_DIR" ;; esac - chmod 664 "$DOKKU_EVENTS_LOGFILE" -fi -if [[ -d "$DOKKU_RSYSLOG_FILTER_DIR" && ! -f "$DOKKU_RSYSLOG_FILTER" ]]; then - cat >"$DOKKU_RSYSLOG_FILTER" <"$DOKKU_RSYSLOG_FILTER" <"$DOKKU_RSYSLOG_FILTER" <"$DOKKU_RSYSLOG_FILTER" <"$DOKKU_LOGROTATE_FILE" <"$DOKKU_LOGROTATE_FILE" </dev/null # then remove the folder and/or the symlink @@ -19,4 +20,4 @@ app_post_delete() { "$DOCKER_BIN" image rm $("$DOCKER_BIN" image list --quiet "$IMAGE_REPO" | xargs) &>/dev/null || true } -app_post_delete "$@" +trigger-apps-post-delete "$@" diff --git a/plugins/builder-dockerfile/builder-build b/plugins/builder-dockerfile/builder-build index c2ca9bfe6..2a1cf3f53 100755 --- a/plugins/builder-dockerfile/builder-build +++ b/plugins/builder-dockerfile/builder-build @@ -3,9 +3,9 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_AVAILABLE_PATH/config/functions" -trigger-builder-build-builder-dockerfile() { +trigger-builder-dockerfile-builder-build() { declare desc="builder-dockerfile builder-build plugin trigger" - declare trigger="trigger-builder-build-builder-dockerfile" + declare trigger="builder-build" declare BUILDER_TYPE="$1" APP="$2" SOURCECODE_WORK_DIR="$3" if [[ "$BUILDER_TYPE" != "dockerfile" ]]; then @@ -42,4 +42,4 @@ trigger-builder-build-builder-dockerfile() { plugn trigger post-build-dockerfile "$APP" } -trigger-builder-build-builder-dockerfile "$@" +trigger-builder-dockerfile-builder-build "$@" diff --git a/plugins/builder-dockerfile/builder-release b/plugins/builder-dockerfile/builder-release index 0fec86494..7b8cef709 100755 --- a/plugins/builder-dockerfile/builder-release +++ b/plugins/builder-dockerfile/builder-release @@ -2,9 +2,9 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x -trigger-builder-release-builder-dockerfile() { +trigger-builder-dockerfile-builder-release() { declare desc="builder-dockerfile builder-release plugin trigger" - declare trigger="trigger-builder-release-builder-dockerfile" + declare trigger="builder-release" declare BUILDER_TYPE="$1" APP="$2" IMAGE_TAG="$3" if [[ "$BUILDER_TYPE" != "dockerfile" ]]; then @@ -16,4 +16,4 @@ trigger-builder-release-builder-dockerfile() { plugn trigger post-release-dockerfile "$APP" "$IMAGE_TAG" } -trigger-builder-release-builder-dockerfile "$@" +trigger-builder-dockerfile-builder-release "$@" diff --git a/plugins/builder-herokuish/builder-build b/plugins/builder-herokuish/builder-build index 2627d74c5..44992119d 100755 --- a/plugins/builder-herokuish/builder-build +++ b/plugins/builder-herokuish/builder-build @@ -3,9 +3,9 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_AVAILABLE_PATH/config/functions" -trigger-builder-build-builder-herokuish() { +trigger-builder-herokuish-builder-build() { declare desc="builder-herokuish builder-build plugin trigger" - declare trigger="trigger-builder-build-builder-herokuish" + declare trigger="builder-build" declare BUILDER_TYPE="$1" APP="$2" SOURCECODE_WORK_DIR="$3" if [[ "$BUILDER_TYPE" != "herokuish" ]]; then @@ -62,4 +62,4 @@ trigger-builder-build-builder-herokuish() { plugn trigger post-build-buildpack "$APP" "$SOURCECODE_WORK_DIR" } -trigger-builder-build-builder-herokuish "$@" +trigger-builder-herokuish-builder-build "$@" diff --git a/plugins/builder-herokuish/builder-release b/plugins/builder-herokuish/builder-release index 952e6de92..762b5f619 100755 --- a/plugins/builder-herokuish/builder-release +++ b/plugins/builder-herokuish/builder-release @@ -3,9 +3,9 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_AVAILABLE_PATH/config/functions" -trigger-builder-release-builder-herokuish() { +trigger-builder-herokuish-builder-release() { declare desc="builder-herokuish builder-release plugin trigger" - declare trigger="trigger-builder-release-builder-herokuish" + declare trigger="builder-release" declare BUILDER_TYPE="$1" APP="$2" IMAGE_TAG="$3" if [[ "$BUILDER_TYPE" != "herokuish" ]]; then @@ -39,4 +39,4 @@ trigger-builder-release-builder-herokuish() { plugn trigger post-release-buildpack "$APP" "$IMAGE_TAG" } -trigger-builder-release-builder-herokuish "$@" +trigger-builder-herokuish-builder-release "$@" diff --git a/plugins/builder-herokuish/docker-args-build b/plugins/builder-herokuish/docker-args-build index e207d266a..b720e1def 100755 --- a/plugins/builder-herokuish/docker-args-build +++ b/plugins/builder-herokuish/docker-args-build @@ -3,13 +3,11 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_AVAILABLE_PATH/config/functions" -trigger-docker-args-builder-herokuish() { +trigger-builder-herokuish-docker-args() { declare desc="builder-herokuish docker-args plugin trigger" - declare trigger="trigger-docker-args-builder-herokuish" - local APP="$1" - local STDIN - local DOKKU_APP_TYPE - local DOKKU_APP_USER + declare trigger="docker-args" + declare APP="$1" + local STDIN DOKKU_APP_TYPE DOKKU_APP_USER STDIN=$(cat) DOKKU_APP_TYPE=$(config_get "$APP" DOKKU_APP_TYPE || true) @@ -25,4 +23,4 @@ trigger-docker-args-builder-herokuish() { echo -n "$docker_args" } -trigger-docker-args-builder-herokuish "$@" +trigger-builder-herokuish-docker-args "$@" diff --git a/plugins/builder-herokuish/pre-build-buildpack b/plugins/builder-herokuish/pre-build-buildpack index e0f2ff6e3..e4e4f5e3c 100755 --- a/plugins/builder-herokuish/pre-build-buildpack +++ b/plugins/builder-herokuish/pre-build-buildpack @@ -4,9 +4,9 @@ set -eo pipefail source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions" -trigger-pre-build-buildpack-builder-herokuish() { +trigger-builder-herokuish-pre-build-buildpack() { declare desc="builder-herokuish pre-build-buildpack plugin trigger" - declare trigger="trigger-pre-build-buildpack-builder-herokuish" + declare trigger="pre-build-buildpack" declare APP="$1" local IMAGE CID @@ -40,4 +40,4 @@ trigger-pre-build-buildpack-builder-herokuish() { "$DOCKER_BIN" container commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" "$CID" "$IMAGE" >/dev/null } -trigger-pre-build-buildpack-builder-herokuish "$@" +trigger-builder-herokuish-pre-build-buildpack "$@" diff --git a/plugins/certs/post-app-clone-setup b/plugins/certs/post-app-clone-setup index dcfe877ea..a0b5918a5 100755 --- a/plugins/certs/post-app-clone-setup +++ b/plugins/certs/post-app-clone-setup @@ -2,8 +2,9 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x -certs_post_app_clone_setup() { +trigger-certs-post-app-clone-setup() { declare desc="removes cert file when setting up a clone" + declare trigger="post-app-clone-setup" declare OLD_APP="$1" NEW_APP="$2" local APP_DIR="$DOKKU_ROOT/$NEW_APP" @@ -11,4 +12,4 @@ certs_post_app_clone_setup() { plugn trigger post-certs-remove "$NEW_APP" } -certs_post_app_clone_setup "$@" +trigger-certs-post-app-clone-setup "$@" diff --git a/plugins/checks/install b/plugins/checks/install index 48ec06086..b3e738e1e 100755 --- a/plugins/checks/install +++ b/plugins/checks/install @@ -56,5 +56,12 @@ migrate_checks_vars_0_6_0() { done } -migrate_checks_vars_0_5_0 "$@" -migrate_checks_vars_0_6_0 "$@" +trigger-checks-install() { + declare desc="installs the checks plugin" + declare trigger="install" + + migrate_checks_vars_0_5_0 "$@" + migrate_checks_vars_0_6_0 "$@" +} + +trigger-checks-install "$@" diff --git a/plugins/config/docker-args-deploy b/plugins/config/docker-args-deploy index 4334e5839..b4a0c0d6e 100755 --- a/plugins/config/docker-args-deploy +++ b/plugins/config/docker-args-deploy @@ -4,8 +4,9 @@ set -eo pipefail source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions" -config_docker_args() { +trigger-config-docker-args() { declare desc="config docker-args plugin trigger" + declare trigger="docker-args" declare APP="$1" IMAGE_TAG="$2" local ENV_ARGS IMAGE STDIN trigger @@ -22,4 +23,4 @@ config_docker_args() { fi } -config_docker_args "$@" +trigger-config-docker-args "$@" diff --git a/plugins/docker-options/docker-args-deploy b/plugins/docker-options/docker-args-deploy index 29f457ec0..f49741cfc 100755 --- a/plugins/docker-options/docker-args-deploy +++ b/plugins/docker-options/docker-args-deploy @@ -2,12 +2,11 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x -docker_args() { +trigger-docker-options-docker-args() { declare desc="docker args plugin trigger" - local trigger="$0" + declare trigger="$0" + declare APP="$1" IMAGE_SOURCE_TYPE="$2" local STDIN=$(cat) - local APP="$1" - local IMAGE_SOURCE_TYPE="$2" case "$0" in *docker-args-build) @@ -77,4 +76,4 @@ docker_args() { echo -n "$STDIN$output" } -docker_args "$@" +trigger-docker-options-docker-args "$@" diff --git a/plugins/domains/install b/plugins/domains/install index ff8f02b82..3a220e1a5 100755 --- a/plugins/domains/install +++ b/plugins/domains/install @@ -2,9 +2,16 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_AVAILABLE_PATH/domains/functions" -shopt -s nullglob -for app in $DOKKU_ROOT/*/CONTAINER; do - APP=$(basename "$(dirname "$app")") - domains_setup "$APP" -done +trigger-domains-install() { + declare desc="domains install trigger" + declare trigger="install" + + shopt -s nullglob + for app in $DOKKU_ROOT/*/CONTAINER; do + APP=$(basename "$(dirname "$app")") + domains_setup "$APP" + done +} + +trigger-domains-install "$@" diff --git a/plugins/domains/post-app-clone-setup b/plugins/domains/post-app-clone-setup index 8fe3e5c60..a8ff2bcc5 100755 --- a/plugins/domains/post-app-clone-setup +++ b/plugins/domains/post-app-clone-setup @@ -2,12 +2,13 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x -domains_post_app_clone_setup() { +trigger-domains-post-app-clone-setup() { declare desc="removes domain files when setting up a clone" + declare trigger="post-app-clone-setup" declare OLD_APP="$1" NEW_APP="$2" local APP_DIR="$DOKKU_ROOT/$NEW_APP" rm -rf "$APP_DIR/URLS" "$APP_DIR/VHOST" } -domains_post_app_clone_setup "$@" +trigger-domains-post-app-clone-setup "$@" diff --git a/plugins/git/deploy-source b/plugins/git/deploy-source index cc243b081..c9c26e707 100755 --- a/plugins/git/deploy-source +++ b/plugins/git/deploy-source @@ -2,9 +2,9 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x -git_deploy_source() { +trigger-git-deploy-source() { declare desc="git deploy-source plugin trigger" - declare trigger="git_deploy_source" + declare trigger="deploy-source" declare APP="$1" local STDIN STDIN=$(cat) @@ -20,4 +20,4 @@ git_deploy_source() { fi } -git_deploy_source "$@" +trigger-git-deploy-source "$@" diff --git a/plugins/git/git-revision b/plugins/git/git-revision index 7157a6868..0ed28fe7a 100755 --- a/plugins/git/git-revision +++ b/plugins/git/git-revision @@ -6,6 +6,7 @@ set -eo pipefail trigger-git-git-revision() { declare desc="fetches the current git revision value for an application" + declare trigger="git-revision" declare APP="$1" ENV_VAR_NAME="$(fn-plugin-property-get "git" "$APP" "rev-env-var")" diff --git a/plugins/git/install b/plugins/git/install index 01f38de3b..bb13e8ef7 100755 --- a/plugins/git/install +++ b/plugins/git/install @@ -7,7 +7,10 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions" trigger-git-install() { declare desc="installs the git plugin" + declare trigger="install" + fn-plugin-property-setup "git" + migrate_git_vars_0_12_0 "$@" } migrate_git_vars_0_12_0() { @@ -31,4 +34,3 @@ migrate_git_vars_0_12_0() { } trigger-git-install "$@" -migrate_git_vars_0_12_0 "$@" diff --git a/plugins/git/post-delete b/plugins/git/post-delete index 735b3cf32..9caa12790 100755 --- a/plugins/git/post-delete +++ b/plugins/git/post-delete @@ -5,7 +5,9 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions" trigger-git-post-delete() { declare desc="destroys the git properties for a given app" + declare trigger="post-delete" declare APP="$1" + fn-plugin-property-destroy "git" "$APP" } diff --git a/plugins/nginx-vhosts/core-post-deploy b/plugins/nginx-vhosts/core-post-deploy index 9dd2c3a49..ea4293174 100755 --- a/plugins/nginx-vhosts/core-post-deploy +++ b/plugins/nginx-vhosts/core-post-deploy @@ -6,12 +6,16 @@ source "$PLUGIN_AVAILABLE_PATH/domains/functions" source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions" source "$PLUGIN_AVAILABLE_PATH/proxy/functions" -nginx_core_post_deploy() { +trigger-nginx-vhosts-core-post-deploy() { declare desc="nginx-vhosts core-post-deploy plugin trigger" - local trigger="nginx_core_post_deploy" - local APP="$1" + declare trigger="nginx_core_post_deploy" + declare APP="$1" local HAS_NETWORK_CONFIG + if [[ "$(get_app_proxy_type "$1")" != "nginx" ]]; then + return + fi + HAS_NETWORK_CONFIG="$(plugn trigger network-config-exists "$APP")" if [[ "$HAS_NETWORK_CONFIG" == "true" ]]; then if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]]; then @@ -24,6 +28,4 @@ nginx_core_post_deploy() { fi } -if [[ "$(get_app_proxy_type "$1")" == "nginx" ]]; then - nginx_core_post_deploy "$@" -fi +trigger-nginx-vhosts-core-post-deploy "$@" diff --git a/plugins/nginx-vhosts/dependencies b/plugins/nginx-vhosts/dependencies index 2d92cc838..842aad16a 100755 --- a/plugins/nginx-vhosts/dependencies +++ b/plugins/nginx-vhosts/dependencies @@ -29,8 +29,10 @@ nginx_install() { apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes -qq -y nginx dnsutils } -nginx_dependencies() { +trigger-nginx-vhosts-dependencies() { declare desc="installs dependencies for the nginx-vhosts plugin" + declare trigger="dependencies" + case "$DOKKU_DISTRO" in debian) nginx_install @@ -71,4 +73,4 @@ nginx_dependencies() { esac } -nginx_dependencies "$@" +trigger-nginx-vhosts-dependencies "$@" diff --git a/plugins/nginx-vhosts/install b/plugins/nginx-vhosts/install index 882c8e87c..34739247d 100755 --- a/plugins/nginx-vhosts/install +++ b/plugins/nginx-vhosts/install @@ -6,58 +6,62 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions" source "$PLUGIN_AVAILABLE_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions" -fn-plugin-property-setup "nginx" +trigger-nginx-vhosts-install() { + declare desc="nginx-vhosts install trigger" + declare trigger="install" -NGINX_BIN="$(fn-nginx-vhosts-nginx-location)" -NGINX_ROOT="/etc/nginx" -NGINX_LOG_ROOT="/var/log/nginx" -NGINX_INIT_NAME="nginx" -NGINX_SUDOERS_FILE="/etc/sudoers.d/dokku-nginx" -if fn-nginx-vhosts-uses-openresty; then - NGINX_ROOT="/usr/local/openresty/nginx/conf" - NGINX_LOG_ROOT="/var/log/openresty" - NGINX_INIT_NAME="openresty" - NGINX_SUDOERS_FILE="/etc/sudoers.d/dokku-openresty" -fi + fn-plugin-property-setup "nginx" -case "$DOKKU_DISTRO" in - debian) - echo "%dokku ALL=(ALL) NOPASSWD:/usr/sbin/invoke-rc.d $NGINX_INIT_NAME reload, $NGINX_BIN -t, ${NGINX_BIN} -t -c *" >"$NGINX_SUDOERS_FILE" - ;; + NGINX_BIN="$(fn-nginx-vhosts-nginx-location)" + NGINX_ROOT="/etc/nginx" + NGINX_LOG_ROOT="/var/log/nginx" + NGINX_INIT_NAME="nginx" + NGINX_SUDOERS_FILE="/etc/sudoers.d/dokku-nginx" + if fn-nginx-vhosts-uses-openresty; then + NGINX_ROOT="/usr/local/openresty/nginx/conf" + NGINX_LOG_ROOT="/var/log/openresty" + NGINX_INIT_NAME="openresty" + NGINX_SUDOERS_FILE="/etc/sudoers.d/dokku-openresty" + fi - ubuntu) - if [[ -x /usr/bin/sv ]]; then - echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/sv reload $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE" - else - echo "%dokku ALL=(ALL) NOPASSWD:/etc/init.d/$NGINX_INIT_NAME reload, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE" - fi - ;; + case "$DOKKU_DISTRO" in + debian) + echo "%dokku ALL=(ALL) NOPASSWD:/usr/sbin/invoke-rc.d $NGINX_INIT_NAME reload, $NGINX_BIN -t, ${NGINX_BIN} -t -c *" >"$NGINX_SUDOERS_FILE" + ;; - opensuse) - echo "%dokku ALL=(ALL) NOPASSWD:/sbin/service $NGINX_INIT_NAME reload, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE" - ;; + ubuntu) + if [[ -x /usr/bin/sv ]]; then + echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/sv reload $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE" + else + echo "%dokku ALL=(ALL) NOPASSWD:/etc/init.d/$NGINX_INIT_NAME reload, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE" + fi + ;; - arch) - echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/systemctl reload $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE" - ;; + opensuse) + echo "%dokku ALL=(ALL) NOPASSWD:/sbin/service $NGINX_INIT_NAME reload, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE" + ;; - centos | rhel) - echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/systemctl reload $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE" - echo "Defaults:dokku !requiretty" >>"$NGINX_SUDOERS_FILE" - ;; -esac + arch) + echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/systemctl reload $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE" + ;; -chmod 0440 "$NGINX_SUDOERS_FILE" + centos | rhel) + echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/systemctl reload $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE" + echo "Defaults:dokku !requiretty" >>"$NGINX_SUDOERS_FILE" + ;; + esac -# if dhparam.pem has not been created, create it the first time -if [[ ! -f "$NGINX_ROOT/dhparam.pem" ]]; then - openssl dhparam -out "$NGINX_ROOT/dhparam.pem" 2048 -fi + chmod 0440 "$NGINX_SUDOERS_FILE" -mkdir -p "$NGINX_ROOT/conf.d" -chown root:root "$NGINX_ROOT/dhparam.pem" -chown root:root "$NGINX_ROOT/conf.d" -cat <"$NGINX_ROOT/conf.d/dokku.conf" + # if dhparam.pem has not been created, create it the first time + if [[ ! -f "$NGINX_ROOT/dhparam.pem" ]]; then + openssl dhparam -out "$NGINX_ROOT/dhparam.pem" 2048 + fi + + mkdir -p "$NGINX_ROOT/conf.d" + chown root:root "$NGINX_ROOT/dhparam.pem" + chown root:root "$NGINX_ROOT/conf.d" + cat <"$NGINX_ROOT/conf.d/dokku.conf" include $DOKKU_ROOT/*/nginx.conf; server_tokens off; @@ -72,51 +76,54 @@ ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDS EOF -# allow users to override their server_names_hash_bucket_size -if [[ ! -f "$NGINX_ROOT/conf.d/server_names_hash_bucket_size.conf" ]]; then - echo 'server_names_hash_bucket_size 512;' >|"$NGINX_ROOT/conf.d/server_names_hash_bucket_size.conf" -fi - -# revert dokku group changes -mkdir -p "$NGINX_LOG_ROOT" -gpasswd -a dokku adm -chgrp --quiet -R adm "$NGINX_LOG_ROOT" -gpasswd -M "$(egrep ^dokku: /etc/group | awk -F ":" '{ print $4 }')" dokku -[[ -f /etc/logrotate.d/nginx ]] && sed -i -e 's/create 0640 www-data dokku/create 0640 www-data adm/g' /etc/logrotate.d/nginx - -# Create nginx error templates -mkdir -p "${DOKKU_LIB_ROOT}/data/nginx-vhosts/dokku-errors" -cp "${PLUGIN_CORE_AVAILABLE_PATH}/nginx-vhosts/templates/400-error.html" "${DOKKU_LIB_ROOT}/data/nginx-vhosts/dokku-errors/400-error.html" -cp "${PLUGIN_CORE_AVAILABLE_PATH}/nginx-vhosts/templates/404-error.html" "${DOKKU_LIB_ROOT}/data/nginx-vhosts/dokku-errors/404-error.html" -cp "${PLUGIN_CORE_AVAILABLE_PATH}/nginx-vhosts/templates/500-error.html" "${DOKKU_LIB_ROOT}/data/nginx-vhosts/dokku-errors/500-error.html" - -# patch broken nginx 1.8.0 logrotate -[[ -f /etc/logrotate.d/nginx ]] && sed -i -e 's/invoke-rc.d/service/g' /etc/logrotate.d/nginx - -# @TODO: Remove this after a few versions -for app in $(dokku_apps); do - nginx_port="$(config_get "$app" DOKKU_NGINX_PORT || true)" - nginx_ssl_port="$(config_get "$app" DOKKU_NGINX_SSL_PORT || true)" - if [[ -n "$nginx_port" ]] || [[ -n "$nginx_ssl_port" ]]; then - dokku_log_info1 "Migrating DOKKU_NGINX env variables. The following variables will be migrated" - dokku_log_info2 "DOKKU_NGINX_PORT -> DOKKU_PROXY_PORT" - dokku_log_info2 "DOKKU_NGINX_SSL_PORT -> DOKKU_PROXY_SSL_PORT" + # allow users to override their server_names_hash_bucket_size + if [[ ! -f "$NGINX_ROOT/conf.d/server_names_hash_bucket_size.conf" ]]; then + echo 'server_names_hash_bucket_size 512;' >|"$NGINX_ROOT/conf.d/server_names_hash_bucket_size.conf" fi - if [[ -n "$nginx_port" ]]; then - dokku_log_info1 "Migrating DOKKU_NGINX_PORT to DOKKU_PROXY_PORT for $app" - DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$app" DOKKU_PROXY_PORT="$nginx_port" - DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$app" DOKKU_NGINX_PORT - fi - if [[ -n "$nginx_ssl_port" ]]; then - dokku_log_info1 "Migrating DOKKU_NGINX_SSL_PORT to DOKKU_PROXY_SSL_PORT for $app" - DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$app" DOKKU_PROXY_SSL_PORT="$nginx_ssl_port" - DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$app" DOKKU_NGINX_SSL_PORT - fi -done -# avoid failing runit init calls on install -# the runit binaries are not yet available during dockerfile building -# and therefore both these calls will fail -if [[ ! -x /usr/bin/sv ]]; then - fn-nginx-vhosts-nginx-init-cmd start || fn-nginx-vhosts-nginx-init-cmd reload -fi + # revert dokku group changes + mkdir -p "$NGINX_LOG_ROOT" + gpasswd -a dokku adm + chgrp --quiet -R adm "$NGINX_LOG_ROOT" + gpasswd -M "$(egrep ^dokku: /etc/group | awk -F ":" '{ print $4 }')" dokku + [[ -f /etc/logrotate.d/nginx ]] && sed -i -e 's/create 0640 www-data dokku/create 0640 www-data adm/g' /etc/logrotate.d/nginx + + # Create nginx error templates + mkdir -p "${DOKKU_LIB_ROOT}/data/nginx-vhosts/dokku-errors" + cp "${PLUGIN_CORE_AVAILABLE_PATH}/nginx-vhosts/templates/400-error.html" "${DOKKU_LIB_ROOT}/data/nginx-vhosts/dokku-errors/400-error.html" + cp "${PLUGIN_CORE_AVAILABLE_PATH}/nginx-vhosts/templates/404-error.html" "${DOKKU_LIB_ROOT}/data/nginx-vhosts/dokku-errors/404-error.html" + cp "${PLUGIN_CORE_AVAILABLE_PATH}/nginx-vhosts/templates/500-error.html" "${DOKKU_LIB_ROOT}/data/nginx-vhosts/dokku-errors/500-error.html" + + # patch broken nginx 1.8.0 logrotate + [[ -f /etc/logrotate.d/nginx ]] && sed -i -e 's/invoke-rc.d/service/g' /etc/logrotate.d/nginx + + # @TODO: Remove this after a few versions + for app in $(dokku_apps); do + nginx_port="$(config_get "$app" DOKKU_NGINX_PORT || true)" + nginx_ssl_port="$(config_get "$app" DOKKU_NGINX_SSL_PORT || true)" + if [[ -n "$nginx_port" ]] || [[ -n "$nginx_ssl_port" ]]; then + dokku_log_info1 "Migrating DOKKU_NGINX env variables. The following variables will be migrated" + dokku_log_info2 "DOKKU_NGINX_PORT -> DOKKU_PROXY_PORT" + dokku_log_info2 "DOKKU_NGINX_SSL_PORT -> DOKKU_PROXY_SSL_PORT" + fi + if [[ -n "$nginx_port" ]]; then + dokku_log_info1 "Migrating DOKKU_NGINX_PORT to DOKKU_PROXY_PORT for $app" + DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$app" DOKKU_PROXY_PORT="$nginx_port" + DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$app" DOKKU_NGINX_PORT + fi + if [[ -n "$nginx_ssl_port" ]]; then + dokku_log_info1 "Migrating DOKKU_NGINX_SSL_PORT to DOKKU_PROXY_SSL_PORT for $app" + DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$app" DOKKU_PROXY_SSL_PORT="$nginx_ssl_port" + DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$app" DOKKU_NGINX_SSL_PORT + fi + done + + # avoid failing runit init calls on install + # the runit binaries are not yet available during dockerfile building + # and therefore both these calls will fail + if [[ ! -x /usr/bin/sv ]]; then + fn-nginx-vhosts-nginx-init-cmd start || fn-nginx-vhosts-nginx-init-cmd reload + fi +} + +trigger-nginx-vhosts-install "$@" diff --git a/plugins/nginx-vhosts/post-app-clone-setup b/plugins/nginx-vhosts/post-app-clone-setup index 0afdcb9b6..c35608d1f 100755 --- a/plugins/nginx-vhosts/post-app-clone-setup +++ b/plugins/nginx-vhosts/post-app-clone-setup @@ -2,12 +2,13 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x -nginx_post_app_clone_setup() { +trigger-nginx-vhosts-post-app-clone-setup() { declare desc="removes nginx files when setting up a clone" + declare trigger="post-app-clone-setup" declare OLD_APP="$1" NEW_APP="$2" local APP_DIR="$DOKKU_ROOT/$NEW_APP" rm -rf "$APP_DIR/nginx.conf" } -nginx_post_app_clone_setup "$@" +trigger-nginx-vhosts-post-app-clone-setup "$@" diff --git a/plugins/nginx-vhosts/post-certs-update b/plugins/nginx-vhosts/post-certs-update index 936bc7135..308a75ed0 100755 --- a/plugins/nginx-vhosts/post-certs-update +++ b/plugins/nginx-vhosts/post-certs-update @@ -5,10 +5,11 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/proxy/functions" -nginx_post_certs_update() { +trigger-nginx-vhosts-post-certs-update() { declare desc="unset port config vars after SSL cert is added" - local trigger="nginx_post_certs_update" - local APP="$1" + declare trigger="post-certs-update" + declare APP="$1" + if [[ "$(get_app_proxy_type "$APP")" == "nginx" ]]; then local DOKKU_PROXY_PORT=$(config_get "$APP" DOKKU_PROXY_PORT) local DOKKU_PROXY_SSL_PORT=$(config_get "$APP" DOKKU_PROXY_SSL_PORT) @@ -31,4 +32,4 @@ nginx_post_certs_update() { fi } -nginx_post_certs_update "$@" +trigger-nginx-vhosts-post-certs-update "$@" diff --git a/plugins/nginx-vhosts/post-delete b/plugins/nginx-vhosts/post-delete index f857dc99c..6f5194c07 100755 --- a/plugins/nginx-vhosts/post-delete +++ b/plugins/nginx-vhosts/post-delete @@ -3,4 +3,11 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions" -restart_nginx "$@" >/dev/null +trigger-nginx-vhosts-post-delete() { + declare desc="nginx-vhosts post-delete trigger" + declare trigger="post-delete" + + restart_nginx "$@" >/dev/null +} + +trigger-nginx-vhosts-post-delete "$@" diff --git a/plugins/nginx-vhosts/post-domains-update b/plugins/nginx-vhosts/post-domains-update index 04dc70d1a..0a1e82b2f 100755 --- a/plugins/nginx-vhosts/post-domains-update +++ b/plugins/nginx-vhosts/post-domains-update @@ -5,10 +5,11 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions" source "$PLUGIN_AVAILABLE_PATH/proxy/functions" -nginx_post_domains_update() { +trigger-nginx-vhosts-post-domains-update() { declare desc="calls nginx build_config when domains are updated" - declare trigger="nginx_post_domains_update" + declare trigger="post-domains-update" declare APP="$1" + [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" if [[ "$(get_app_proxy_type "$APP")" == "nginx" ]]; then @@ -16,4 +17,4 @@ nginx_post_domains_update() { fi } -nginx_post_domains_update "$@" +trigger-nginx-vhosts-post-domains-update "$@" diff --git a/plugins/nginx-vhosts/post-proxy-ports-update b/plugins/nginx-vhosts/post-proxy-ports-update index 71af92f92..e6135d8b8 100755 --- a/plugins/nginx-vhosts/post-proxy-ports-update +++ b/plugins/nginx-vhosts/post-proxy-ports-update @@ -5,13 +5,14 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions" source "$PLUGIN_AVAILABLE_PATH/proxy/functions" -nginx_post_proxy_ports_update() { +trigger-nginx-vhosts-post-proxy-ports-update() { declare desc="calls nginx build_config when domains are updated" - local trigger="nginx_post_proxy_ports_update" - local APP="$1" ACTION="$2" + declare trigger="post-proxy-ports-update" + declare APP="$1" ACTION="$2" + if [[ "$(get_app_proxy_type "$APP")" == "nginx" ]]; then nginx_build_config "$APP" fi } -nginx_post_proxy_ports_update "$@" +trigger-nginx-vhosts-post-proxy-ports-update "$@" diff --git a/plugins/nginx-vhosts/pre-disable-vhost b/plugins/nginx-vhosts/pre-disable-vhost index 8c2244f23..3ddbd6444 100755 --- a/plugins/nginx-vhosts/pre-disable-vhost +++ b/plugins/nginx-vhosts/pre-disable-vhost @@ -5,13 +5,14 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/proxy/functions" -nginx_pre_disable_vhost_trigger() { +trigger-nginx-vhosts-pre-disable-vhost() { declare desc="unset port prior to vhosts being disabled" - local trigger="nginx_pre_disable_vhost_trigger" - local APP="$1" + declare trigger="pre-disable-vhost" + declare APP="$1" + if [[ "$(get_app_proxy_type "$APP")" == "nginx" ]]; then DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$APP" DOKKU_PROXY_PORT DOKKU_PROXY_SSL_PORT DOKKU_PROXY_PORT_MAP fi } -nginx_pre_disable_vhost_trigger "$@" +trigger-nginx-vhosts-pre-disable-vhost "$@" diff --git a/plugins/nginx-vhosts/pre-enable-vhost b/plugins/nginx-vhosts/pre-enable-vhost index 2cec7b511..13c7584e3 100755 --- a/plugins/nginx-vhosts/pre-enable-vhost +++ b/plugins/nginx-vhosts/pre-enable-vhost @@ -5,13 +5,14 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/proxy/functions" -nginx_pre_enable_vhost_trigger() { +trigger-nginx-vhosts-pre-enable-vhost() { declare desc="unset port prior to vhosts being enabled" - local trigger="nginx_pre_enable_vhost_trigger" - local APP="$1" + declare trigger="pre-enable-vhost" + declare APP="$1" + if [[ "$(get_app_proxy_type "$APP")" == "nginx" ]]; then DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$APP" DOKKU_PROXY_PORT DOKKU_PROXY_SSL_PORT DOKKU_PROXY_PORT_MAP fi } -nginx_pre_enable_vhost_trigger "$@" +trigger-nginx-vhosts-pre-enable-vhost "$@" diff --git a/plugins/nginx-vhosts/proxy-build-config b/plugins/nginx-vhosts/proxy-build-config index 0f2991f40..0abb97320 100755 --- a/plugins/nginx-vhosts/proxy-build-config +++ b/plugins/nginx-vhosts/proxy-build-config @@ -5,16 +5,16 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions" source "$PLUGIN_AVAILABLE_PATH/proxy/functions" -nginx_proxy_build_config() { +trigger-nginx-vhosts-proxy-build-config() { declare desc="build nginx config to proxy app containers from command line" - declare trigger="nginx_proxy_build_config" + declare trigger="proxy-build-config" declare APP="$1" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" + [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" if [[ "$(get_app_proxy_type "$APP")" == "nginx" ]]; then plugn trigger network-build-config "$APP" nginx_build_config "$APP" fi } -nginx_proxy_build_config "$@" +trigger-nginx-vhosts-proxy-build-config "$@" diff --git a/plugins/nginx-vhosts/proxy-clear-config b/plugins/nginx-vhosts/proxy-clear-config index 24712eb95..d9daad61a 100755 --- a/plugins/nginx-vhosts/proxy-clear-config +++ b/plugins/nginx-vhosts/proxy-clear-config @@ -5,16 +5,16 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions" source "$PLUGIN_AVAILABLE_PATH/proxy/functions" -trigger-nginx-vhosts-clear-config() { +trigger-nginx-vhosts-proxy-clear-config() { declare desc="clear nginx config for proxy app containers from command line" - declare trigger="trigger-nginx-vhosts-clear-config" + declare trigger="proxy-clear-config" declare APP="$1" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" + [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" if [[ "$(get_app_proxy_type "$APP")" == "nginx" ]]; then plugn trigger network-clear-config "$APP" nginx_clear_config "$APP" fi } -trigger-nginx-vhosts-clear-config "$@" +trigger-nginx-vhosts-proxy-clear-config "$@" diff --git a/plugins/nginx-vhosts/proxy-disable b/plugins/nginx-vhosts/proxy-disable index 0e4c50139..e0ce5f7f0 100755 --- a/plugins/nginx-vhosts/proxy-disable +++ b/plugins/nginx-vhosts/proxy-disable @@ -6,16 +6,16 @@ source "$PLUGIN_AVAILABLE_PATH/domains/functions" source "$PLUGIN_AVAILABLE_PATH/proxy/functions" source "$PLUGIN_AVAILABLE_PATH/ps/functions" -nginx_proxy_disable() { +trigger-nginx-vhosts-proxy-disable() { declare desc="disable nginx proxy" - local trigger="nginx_proxy_disable" - local APP="$1" - verify_app_name "$APP" + declare trigger="proxy-disable" + declare APP="$1" + verify_app_name "$APP" if [[ "$(get_app_proxy_type "$APP")" == "nginx" ]]; then disable_app_vhost "$APP" --no-restart ps_restart "$APP" fi } -nginx_proxy_disable "$@" +trigger-nginx-vhosts-proxy-disable "$@" diff --git a/plugins/nginx-vhosts/proxy-enable b/plugins/nginx-vhosts/proxy-enable index ea00bd76b..65340ee05 100755 --- a/plugins/nginx-vhosts/proxy-enable +++ b/plugins/nginx-vhosts/proxy-enable @@ -6,16 +6,16 @@ source "$PLUGIN_AVAILABLE_PATH/domains/functions" source "$PLUGIN_AVAILABLE_PATH/proxy/functions" source "$PLUGIN_AVAILABLE_PATH/ps/functions" -nginx_proxy_enable() { +trigger-nginx-vhosts-proxy-enable() { declare desc="enable nginx proxy" - local trigger="nginx_proxy_enable" - local APP="$1" - verify_app_name "$APP" + declare trigger="proxy-enable" + declare APP="$1" + verify_app_name "$APP" if [[ "$(get_app_proxy_type "$APP")" == "nginx" ]]; then enable_app_vhost "$APP" --no-restart ps_restart "$APP" fi } -nginx_proxy_enable "$@" +trigger-nginx-vhosts-proxy-enable "$@" diff --git a/plugins/proxy/post-certs-remove b/plugins/proxy/post-certs-remove index 426dd03c3..07d3fe9d2 100755 --- a/plugins/proxy/post-certs-remove +++ b/plugins/proxy/post-certs-remove @@ -7,8 +7,8 @@ source "$PLUGIN_AVAILABLE_PATH/proxy/functions" trigger-proxy-post-certs-remove() { declare desc="unset port config vars after SSL cert is removed" - local trigger="nginx_post_certs_remove" - local APP="$1" + declare trigger="post-certs-remove" + declare APP="$1" DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$APP" DOKKU_PROXY_SSL_PORT diff --git a/plugins/ps/app-restart b/plugins/ps/app-restart index 8f7692fac..064bfd845 100755 --- a/plugins/ps/app-restart +++ b/plugins/ps/app-restart @@ -4,12 +4,12 @@ set -eo pipefail source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/ps/functions" -ps_app_restart() { +trigger-ps-app-restart() { declare desc="ps app-restart plugin trigger" - local trigger="ps_app_restart" - local APP="$1" + declare trigger="app-restart" + declare APP="$1" ps_restart "$APP" } -ps_app_restart "$@" +trigger-ps-app-restart "$@" diff --git a/plugins/ps/core-post-deploy b/plugins/ps/core-post-deploy index 51e87263d..b789ddc20 100755 --- a/plugins/ps/core-post-deploy +++ b/plugins/ps/core-post-deploy @@ -5,13 +5,13 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/ps/functions" -ps_core_post_deploy() { +trigger-ps-core-post-deploy() { declare desc="ps core-post-deploy plugin trigger" - local trigger="ps_core_post_deploy" - local APP="$1" + declare trigger="core-post-deploy" + declare APP="$1" remove_procfile "$APP" DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$APP" DOKKU_APP_RESTORE=1 } -ps_core_post_deploy "$@" +trigger-ps-core-post-deploy "$@" diff --git a/plugins/ps/install b/plugins/ps/install index dd9125f78..4d57b90be 100755 --- a/plugins/ps/install +++ b/plugins/ps/install @@ -7,6 +7,7 @@ source "$PLUGIN_AVAILABLE_PATH/ps/functions" trigger-ps-install() { declare desc="set the default restart policy for all applications if there is not one already set" + declare trigger="install" local APPS="$(dokku_apps)" local APP diff --git a/plugins/ps/post-create b/plugins/ps/post-create index bcdbaa2ad..8434d5444 100755 --- a/plugins/ps/post-create +++ b/plugins/ps/post-create @@ -5,13 +5,13 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/docker-options/functions" source "$PLUGIN_AVAILABLE_PATH/ps/functions" -ps_post_create() { +trigger-ps-post-create() { declare desc="ps post-create plugin trigger" - local trigger="ps_post_create" + declare trigger="post-create" local APP="$1" local passed_phases=(deploy) add_passed_docker_option passed_phases[@] "--restart=on-failure:10" } -ps_post_create "$@" +trigger-ps-post-create "$@" diff --git a/plugins/ps/post-stop b/plugins/ps/post-stop index 0dd4c91d2..4d091c180 100755 --- a/plugins/ps/post-stop +++ b/plugins/ps/post-stop @@ -5,12 +5,12 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/ps/functions" -ps_post_stop() { +trigger-ps-post-stop() { declare desc="ps post-stop plugin trigger" - local trigger="ps_post_stop" - local APP="$1" + declare trigger="post-stop" + declare APP="$1" DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$APP" DOKKU_APP_RESTORE=0 } -ps_post_stop "$@" +trigger-ps-post-stop "$@" diff --git a/plugins/ps/pre-deploy b/plugins/ps/pre-deploy index 67cab2171..4e4e85db8 100755 --- a/plugins/ps/pre-deploy +++ b/plugins/ps/pre-deploy @@ -4,14 +4,13 @@ set -eo pipefail source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/ps/functions" -ps_pre_deploy() { +trigger-ps-pre-deploy() { declare desc="ps pre-deploy plugin trigger" - local trigger="ps_pre_deploy" - local APP="$1" - local IMAGE_TAG="$2" + declare trigger="pre-deploy" + declare APP="$1" IMAGE_TAG="$2" extract_procfile "$APP" "$IMAGE_TAG" generate_scale_file "$APP" "$IMAGE_TAG" } -ps_pre_deploy "$@" +trigger-ps-pre-deploy "$@" diff --git a/plugins/scheduler-docker-local/check-deploy b/plugins/scheduler-docker-local/check-deploy index be127dfbb..6e624a1d2 100755 --- a/plugins/scheduler-docker-local/check-deploy +++ b/plugins/scheduler-docker-local/check-deploy @@ -39,14 +39,10 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/checks/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions" -scheduler-docker-local-check-deploy() { +trigger-scheduler-docker-local-check-deploy() { declare desc="scheduler-docker-local check-deploy plugin trigger" - local trigger="scheduler-docker-local-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" + declare trigger="check-deploy" + declare APP="$1" DOKKU_APP_CONTAINER_ID="$2" DOKKU_APP_CONTAINER_TYPE="$3" DOKKU_APP_LISTEN_PORT="$4" DOKKU_APP_LISTEN_IP="$5" local DOKKU_SCHEDULER=$(get_app_scheduler "$APP") if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then @@ -242,4 +238,4 @@ scheduler-docker-local-check-deploy() { dokku_log_verbose "All checks successful!" } -scheduler-docker-local-check-deploy "$@" +trigger-scheduler-docker-local-check-deploy "$@" diff --git a/plugins/scheduler-docker-local/core-post-deploy b/plugins/scheduler-docker-local/core-post-deploy index c2bb39db5..53f89c928 100755 --- a/plugins/scheduler-docker-local/core-post-deploy +++ b/plugins/scheduler-docker-local/core-post-deploy @@ -4,9 +4,9 @@ set -eo pipefail source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions" -scheduler-docker-local-core-post-deploy() { +trigger-scheduler-docker-local-core-post-deploy() { declare desc="scheduler-docker-local core-post-deploy state cleanup" - declare trigger="scheduler-docker-local core-post-deploy" + declare trigger="core-post-deploy" declare APP="$1" local APP_ROOT="$DOKKU_ROOT/$APP" @@ -62,4 +62,4 @@ scheduler-docker-local-core-post-deploy() { shopt -u nullglob } -scheduler-docker-local-core-post-deploy "$@" +trigger-scheduler-docker-local-core-post-deploy "$@" diff --git a/plugins/scheduler-docker-local/install b/plugins/scheduler-docker-local/install index 41e05975d..780159608 100755 --- a/plugins/scheduler-docker-local/install +++ b/plugins/scheduler-docker-local/install @@ -4,9 +4,9 @@ set -eo pipefail source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions" -scheduler-docker-local-install() { +trigger-scheduler-docker-local-install() { declare desc="scheduler-docker-local install plugin trigger" - declare trigger="scheduler-docker-local-install" + declare trigger="install" local DOKKU_PATH mkdir -p "${DOKKU_LIB_ROOT}/data/scheduler-docker-local" @@ -58,4 +58,4 @@ EOF fi } -scheduler-docker-local-install "$@" +trigger-scheduler-docker-local-install "$@" diff --git a/plugins/scheduler-docker-local/post-app-clone-setup b/plugins/scheduler-docker-local/post-app-clone-setup index ee923ab1c..f829496a5 100755 --- a/plugins/scheduler-docker-local/post-app-clone-setup +++ b/plugins/scheduler-docker-local/post-app-clone-setup @@ -2,12 +2,13 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x -scheduler-docker-local-post-app-clone-setup() { +trigger-scheduler-docker-local-post-app-clone-setup() { declare desc="removes docker-local files when setting up a clone" + declare trigger="post-app-clone-setup" declare OLD_APP="$1" NEW_APP="$2" local APP_DIR="$DOKKU_ROOT/$NEW_APP" find "$APP_DIR" -type f -name 'CONTAINER.*' -exec rm {} \; } -scheduler-docker-local-post-app-clone-setup "$@" +trigger-scheduler-docker-local-post-app-clone-setup "$@" diff --git a/plugins/scheduler-docker-local/post-create b/plugins/scheduler-docker-local/post-create index c888fd291..3315876ab 100755 --- a/plugins/scheduler-docker-local/post-create +++ b/plugins/scheduler-docker-local/post-create @@ -2,13 +2,13 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x -scheduler-docker-local-post-create() { +trigger-scheduler-docker-local-post-create() { declare desc="scheduler-docker-local post-create plugin trigger" - declare trigger="scheduler-docker-local-post-create" + declare trigger="post-create" declare APP="$1" mkdir -p "${DOKKU_LIB_ROOT}/data/scheduler-docker-local/${APP}" chown -R "${DOKKU_SYSTEM_USER}:${DOKKU_SYSTEM_GROUP}" "${DOKKU_LIB_ROOT}/data/scheduler-docker-local/${APP}" } -scheduler-docker-local-post-create "$@" +trigger-scheduler-docker-local-post-create "$@" diff --git a/plugins/scheduler-docker-local/post-delete b/plugins/scheduler-docker-local/post-delete index 75df108a9..af97a2817 100755 --- a/plugins/scheduler-docker-local/post-delete +++ b/plugins/scheduler-docker-local/post-delete @@ -4,9 +4,9 @@ set -eo pipefail source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions" -scheduler-docker-local-post-delete() { +trigger-scheduler-docker-local-post-delete() { declare desc="scheduler-docker-local post-delete plugin trigger" - declare trigger="scheduler-docker-local post-delete" + declare trigger="post-delete" declare APP="$1" local DOKKU_SCHEDULER=$(get_app_scheduler "$APP") @@ -28,4 +28,4 @@ scheduler-docker-local-post-delete() { "$DOCKER_BIN" image rm $("$DOCKER_BIN" image list --quiet "$IMAGE_REPO" | xargs) &>/dev/null || true } -scheduler-docker-local-post-delete "$@" +trigger-scheduler-docker-local-post-delete "$@" diff --git a/plugins/scheduler-docker-local/pre-deploy b/plugins/scheduler-docker-local/pre-deploy index e3b2f64dd..843fffd5b 100755 --- a/plugins/scheduler-docker-local/pre-deploy +++ b/plugins/scheduler-docker-local/pre-deploy @@ -5,9 +5,9 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions" source "$PLUGIN_AVAILABLE_PATH/config/functions" -scheduler-docker-local-pre-deploy() { +trigger-scheduler-docker-local-pre-deploy() { declare desc="scheduler-docker-local pre-deploy plugin trigger" - declare trigger="scheduler-docker-local pre-deploy" + declare trigger="pre-deploy" declare APP="$1" IMAGE_TAG="$2" local DOKKU_SCHEDULER=$(get_app_scheduler "$APP") @@ -70,4 +70,4 @@ scheduler-docker-local-pre-deploy-precheck() { fi } -scheduler-docker-local-pre-deploy "$@" +trigger-scheduler-docker-local-pre-deploy "$@" diff --git a/plugins/scheduler-docker-local/pre-restore b/plugins/scheduler-docker-local/pre-restore index a2a427c9b..db4e8f34f 100755 --- a/plugins/scheduler-docker-local/pre-restore +++ b/plugins/scheduler-docker-local/pre-restore @@ -3,9 +3,9 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -scheduler-docker-local-pre-restore() { +trigger-scheduler-docker-local-pre-restore() { declare desc="scheduler-docker-local pre-restore plugin trigger" - declare trigger="scheduler-docker-local pre-restore" + declare trigger="pre-restore" declare DOKKU_SCHEDULER="$1" if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then @@ -17,4 +17,4 @@ scheduler-docker-local-pre-restore() { "$DOCKER_BIN" container rm $("$DOCKER_BIN" container list --all --format "{{.Names}}" --filter "label=$DOKKU_CONTAINER_LABEL" --quiet | grep -E '(.+\..+\.[0-9]+\.[0-9]+$)') &>/dev/null || true } -scheduler-docker-local-pre-restore "$@" +trigger-scheduler-docker-local-pre-restore "$@" diff --git a/plugins/scheduler-docker-local/scheduler-app-status b/plugins/scheduler-docker-local/scheduler-app-status index 89eddeb50..146b6df89 100755 --- a/plugins/scheduler-docker-local/scheduler-app-status +++ b/plugins/scheduler-docker-local/scheduler-app-status @@ -3,9 +3,9 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -scheduler-app-status() { +trigger-scheduler-app-status() { declare desc="fetches the status for a given app" - declare trigger="scheduler-docker-local scheduler-app-status" + declare trigger="scheduler-app-status" declare DOKKU_SCHEDULER="$1" APP="$2" if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then @@ -35,4 +35,4 @@ scheduler-app-status() { echo "$PROCS $RUNNING" } -scheduler-app-status "$@" +trigger-scheduler-app-status "$@" diff --git a/plugins/scheduler-docker-local/scheduler-deploy b/plugins/scheduler-docker-local/scheduler-deploy index 6e3b6557d..dbb439665 100755 --- a/plugins/scheduler-docker-local/scheduler-deploy +++ b/plugins/scheduler-docker-local/scheduler-deploy @@ -7,9 +7,9 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/ps/functions" source "$PLUGIN_AVAILABLE_PATH/scheduler-docker-local/internal-functions" -scheduler-docker-local-scheduler-deploy() { +trigger-scheduler-docker-local-scheduler-deploy() { declare desc="deploys an image tag for a given application" - declare trigger="scheduler-docker-local scheduler-deploy" + declare trigger="scheduler-deploy" declare DOKKU_SCHEDULER="$1" APP="$2" IMAGE_TAG="$3" if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then @@ -220,4 +220,4 @@ fn-scheduler-docker-local-extract-start-cmd() { echo "$START_CMD" } -scheduler-docker-local-scheduler-deploy "$@" +trigger-scheduler-docker-local-scheduler-deploy "$@" diff --git a/plugins/scheduler-docker-local/scheduler-docker-cleanup b/plugins/scheduler-docker-local/scheduler-docker-cleanup index 6c041d1a5..1496a0b37 100755 --- a/plugins/scheduler-docker-local/scheduler-docker-cleanup +++ b/plugins/scheduler-docker-local/scheduler-docker-cleanup @@ -3,9 +3,9 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -scheduler-docker-local-scheduler-docker-cleanup() { +trigger-scheduler-docker-local-scheduler-docker-cleanup() { declare desc="scheduler-docker-local scheduler-docker-cleanup plugin trigger" - declare trigger="scheduler-docker-local scheduler-docker-cleanup" + declare trigger="scheduler-docker-cleanup" declare DOKKU_SCHEDULER="$1" APP="$2" FORCE_CLEANUP="$3" if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then @@ -42,4 +42,4 @@ scheduler-docker-local-scheduler-docker-cleanup() { fi } -scheduler-docker-local-scheduler-docker-cleanup "$@" +trigger-scheduler-docker-local-scheduler-docker-cleanup "$@" diff --git a/plugins/scheduler-docker-local/scheduler-inspect b/plugins/scheduler-docker-local/scheduler-inspect index bb79895ef..39be0638e 100755 --- a/plugins/scheduler-docker-local/scheduler-inspect +++ b/plugins/scheduler-docker-local/scheduler-inspect @@ -4,9 +4,9 @@ set -eo pipefail source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions" -scheduler-docker-local-scheduler-inspect() { +trigger-scheduler-docker-local-scheduler-inspect() { declare desc="scheduler-docker-local scheduler-inspect plugin trigger" - declare trigger="scheduler-docker-local scheduler-inspect" + declare trigger="scheduler-inspect" declare DOKKU_SCHEDULER="$1" APP="$2" if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then @@ -60,4 +60,4 @@ EOF } -scheduler-docker-local-scheduler-inspect "$@" +trigger-scheduler-docker-local-scheduler-inspect "$@" diff --git a/plugins/scheduler-docker-local/scheduler-is-deployed b/plugins/scheduler-docker-local/scheduler-is-deployed index c86f34f98..fd71e9a41 100755 --- a/plugins/scheduler-docker-local/scheduler-is-deployed +++ b/plugins/scheduler-docker-local/scheduler-is-deployed @@ -2,8 +2,9 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x -scheduler-docker-local-scheduler-is-deployed() { +trigger-scheduler-docker-local-scheduler-is-deployed() { declare desc="checks if an app is deployed" + declare trigger="scheduler-is-deployed" declare DOKKU_SCHEDULER="$1" APP="$2" if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then @@ -20,4 +21,4 @@ scheduler-docker-local-scheduler-is-deployed() { return 1 } -scheduler-docker-local-scheduler-is-deployed "$@" +trigger-scheduler-docker-local-scheduler-is-deployed "$@" diff --git a/plugins/scheduler-docker-local/scheduler-logs b/plugins/scheduler-docker-local/scheduler-logs index d785388e8..b9c7d672b 100755 --- a/plugins/scheduler-docker-local/scheduler-logs +++ b/plugins/scheduler-docker-local/scheduler-logs @@ -3,9 +3,9 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -scheduler-docker-local-scheduler-logs() { +trigger-scheduler-docker-local-scheduler-logs() { declare desc="scheduler-docker-local scheduler-logs plugin trigger" - declare trigger="scheduler-docker-local scheduler-logs" + declare trigger="scheduler-logs" declare DOKKU_SCHEDULER="$1" APP="$2" PROCESS_TYPE="$3" TAIL="$4" PRETTY_PRINT="$5" NUM="$6" local DOKKU_LOGS_ARGS="" @@ -47,4 +47,4 @@ scheduler-docker-local-scheduler-logs() { bash -c "($DOKKU_LOGS_CMD)" } -scheduler-docker-local-scheduler-logs "$@" +trigger-scheduler-docker-local-scheduler-logs "$@" diff --git a/plugins/scheduler-docker-local/scheduler-logs-failed b/plugins/scheduler-docker-local/scheduler-logs-failed index f231b9bdc..ed0d45349 100755 --- a/plugins/scheduler-docker-local/scheduler-logs-failed +++ b/plugins/scheduler-docker-local/scheduler-logs-failed @@ -3,9 +3,9 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -scheduler-docker-local-scheduler-logs-failed() { +trigger-scheduler-docker-local-scheduler-logs-failed() { declare desc="scheduler-docker-local scheduler-logs-failed plugin trigger" - declare trigger="scheduler-docker-local scheduler-logs-failed" + declare trigger="scheduler-logs-failed" declare DOKKU_SCHEDULER="$1" APP="$2" local FAILED_CONTAINERS_FILE="${DOKKU_LIB_ROOT}/data/scheduler-docker-local/$APP/failed-containers" local DEAD_CONTAINERS=() DOKKU_LOGS_CMD=() RUNNING_CONTAINERS=() @@ -54,4 +54,4 @@ scheduler-docker-local-scheduler-logs-failed() { bash -c "($DOKKU_LOGS_CMD)" } -scheduler-docker-local-scheduler-logs-failed "$@" +trigger-scheduler-docker-local-scheduler-logs-failed "$@" diff --git a/plugins/scheduler-docker-local/scheduler-retire b/plugins/scheduler-docker-local/scheduler-retire index d60d8f8e2..d81f24fa0 100755 --- a/plugins/scheduler-docker-local/scheduler-retire +++ b/plugins/scheduler-docker-local/scheduler-retire @@ -4,9 +4,9 @@ set -eo pipefail source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/scheduler-docker-local/internal-functions" -scheduler-docker-local-scheduler-retire() { +trigger-scheduler-docker-local-scheduler-retire() { declare desc="retires all old containers once they have aged out" - declare trigger="scheduler-docker-local scheduler-retire" + declare trigger="scheduler-retire" local DEAD_CONTAINER_FILE="${DOKKU_LIB_ROOT}/data/scheduler-docker-local/dead-containers" local APP CID CURRENT_TIME DEAD_TIME STATE @@ -52,4 +52,4 @@ scheduler-docker-local-scheduler-retire() { done } -scheduler-docker-local-scheduler-retire "$@" +trigger-scheduler-docker-local-scheduler-retire "$@" diff --git a/plugins/scheduler-docker-local/scheduler-run b/plugins/scheduler-docker-local/scheduler-run index cc3f347f7..074b90c33 100755 --- a/plugins/scheduler-docker-local/scheduler-run +++ b/plugins/scheduler-docker-local/scheduler-run @@ -5,9 +5,9 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/ps/functions" -scheduler-docker-local-scheduler-run() { +trigger-scheduler-docker-local-scheduler-run() { declare desc="runs command in container based on app image" - declare trigger="scheduler-docker-local scheduler-run" + declare trigger="scheduler-run" declare DOKKU_SCHEDULER="$1" APP="$2" ENV_COUNT="$3" local CONTAINER_ID shift 3 @@ -98,4 +98,4 @@ scheduler-docker-local-scheduler-run() { return "$DOKKU_CONTAINER_EXIT_CODE" } -scheduler-docker-local-scheduler-run "$@" +trigger-scheduler-docker-local-scheduler-run "$@" diff --git a/plugins/scheduler-docker-local/scheduler-stop b/plugins/scheduler-docker-local/scheduler-stop index f5a8787ca..d1f5134c8 100755 --- a/plugins/scheduler-docker-local/scheduler-stop +++ b/plugins/scheduler-docker-local/scheduler-stop @@ -4,9 +4,9 @@ set -eo pipefail source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions" -scheduler-docker-local-scheduler-stop() { +trigger-scheduler-docker-local-scheduler-stop() { declare desc="scheduler-docker-local scheduler-stop plugin trigger" - declare trigger="scheduler-docker-local scheduler-stop" + declare trigger="scheduler-stop" declare DOKKU_SCHEDULER="$1" APP="$2" REMOVE_CONTAINERS="$3" if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then @@ -37,4 +37,4 @@ scheduler-docker-local-scheduler-stop() { fi } -scheduler-docker-local-scheduler-stop "$@" +trigger-scheduler-docker-local-scheduler-stop "$@" diff --git a/plugins/scheduler-docker-local/scheduler-tags-create b/plugins/scheduler-docker-local/scheduler-tags-create index 128d499da..37214fe95 100755 --- a/plugins/scheduler-docker-local/scheduler-tags-create +++ b/plugins/scheduler-docker-local/scheduler-tags-create @@ -3,9 +3,9 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -scheduler-docker-local-scheduler-tags-create() { +trigger-scheduler-docker-local-scheduler-tags-create() { declare desc="scheduler-docker-local scheduler-tags-create plugin trigger" - declare trigger="scheduler-docker-local scheduler-tags-create" + declare trigger="scheduler-tags-create" declare DOKKU_SCHEDULER="$1" APP="$2" SOURCE_IMAGE="$3" TARGET_IMAGE="$4" if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then @@ -34,4 +34,4 @@ is_tag_force_available() { fi } -scheduler-docker-local-scheduler-tags-create "$@" +trigger-scheduler-docker-local-scheduler-tags-create "$@" diff --git a/plugins/scheduler-docker-local/scheduler-tags-destroy b/plugins/scheduler-docker-local/scheduler-tags-destroy index 078905659..0974d3626 100755 --- a/plugins/scheduler-docker-local/scheduler-tags-destroy +++ b/plugins/scheduler-docker-local/scheduler-tags-destroy @@ -3,9 +3,9 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -scheduler-docker-local-scheduler-tags-destroy() { +trigger-scheduler-docker-local-scheduler-tags-destroy() { declare desc="scheduler-docker-local scheduler-tags-destroy plugin trigger" - declare trigger="scheduler-docker-local scheduler-tags-destroy" + declare trigger="scheduler-tags-destroy" declare DOKKU_SCHEDULER="$1" APP="$2" IMAGE_REPO="$3" IMAGE_TAG="$4" if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then @@ -15,4 +15,4 @@ scheduler-docker-local-scheduler-tags-destroy() { "$DOCKER_BIN" image rm "$IMAGE_REPO:$IMAGE_TAG" } -scheduler-docker-local-scheduler-tags-destroy "$@" +trigger-scheduler-docker-local-scheduler-tags-destroy "$@" diff --git a/plugins/storage/install b/plugins/storage/install index fb23f28d0..9c9ce83bd 100755 --- a/plugins/storage/install +++ b/plugins/storage/install @@ -2,5 +2,12 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x -mkdir -p "${DOKKU_LIB_ROOT}/data/storage" -chown dokku:dokku "${DOKKU_LIB_ROOT}/data/storage" +trigger-storage-install() { + declare desc="storage install trigger" + declare trigger="install" + + mkdir -p "${DOKKU_LIB_ROOT}/data/storage" + chown dokku:dokku "${DOKKU_LIB_ROOT}/data/storage" +} + +trigger-storage-install "$@" diff --git a/plugins/tar/deploy-source b/plugins/tar/deploy-source index d83e51c9e..449f9dc85 100755 --- a/plugins/tar/deploy-source +++ b/plugins/tar/deploy-source @@ -2,9 +2,9 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x -tar_deploy_source() { +trigger-tar-deploy-source() { declare desc="tar deploy-source plugin trigger" - declare trigger="tar_deploy_source" + declare trigger="deploy-source" declare APP="$1" local STDIN STDIN=$(cat) @@ -20,4 +20,4 @@ tar_deploy_source() { fi } -tar_deploy_source "$@" +trigger-tar-deploy-source "$@"