refactor: standardize trigger code
This commit is contained in:
@@ -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" <<EOF
|
||||
if [[ ! -f "$DOKKU_EVENTS_LOGFILE" ]]; then
|
||||
touch "$DOKKU_EVENTS_LOGFILE"
|
||||
case "$DOKKU_DISTRO" in
|
||||
arch | debian | centos | rhel)
|
||||
chgrp dokku "$DOKKU_EVENTS_LOGFILE"
|
||||
;;
|
||||
*)
|
||||
# chown syslog:root might not work on SUSE
|
||||
chown syslog:dokku "$DOKKU_EVENTS_LOGFILE"
|
||||
;;
|
||||
esac
|
||||
chmod 664 "$DOKKU_EVENTS_LOGFILE"
|
||||
fi
|
||||
|
||||
if [[ -d "$DOKKU_RSYSLOG_FILTER_DIR" && ! -f "$DOKKU_RSYSLOG_FILTER" ]]; then
|
||||
cat >"$DOKKU_RSYSLOG_FILTER" <<EOF
|
||||
:syslogtag, contains, "dokku-event" $DOKKU_EVENTS_LOGFILE
|
||||
EOF
|
||||
flag_rsyslog_needs_restart=y
|
||||
fi
|
||||
flag_rsyslog_needs_restart=y
|
||||
fi
|
||||
|
||||
if [[ -f "$DOKKU_RSYSLOG_FILTER" ]] && ! grep -q "dokku-event" "$DOKKU_RSYSLOG_FILTER"; then
|
||||
cat >"$DOKKU_RSYSLOG_FILTER" <<EOF
|
||||
if [[ -f "$DOKKU_RSYSLOG_FILTER" ]] && ! grep -q "dokku-event" "$DOKKU_RSYSLOG_FILTER"; then
|
||||
cat >"$DOKKU_RSYSLOG_FILTER" <<EOF
|
||||
:syslogtag, contains, "dokku-event" $DOKKU_EVENTS_LOGFILE
|
||||
EOF
|
||||
flag_rsyslog_needs_restart=y
|
||||
fi
|
||||
flag_rsyslog_needs_restart=y
|
||||
fi
|
||||
|
||||
if [[ ! -f "$DOKKU_LOGROTATE_FILE" ]]; then
|
||||
cat >"$DOKKU_LOGROTATE_FILE" <<EOF
|
||||
if [[ ! -f "$DOKKU_LOGROTATE_FILE" ]]; then
|
||||
cat >"$DOKKU_LOGROTATE_FILE" <<EOF
|
||||
$DOKKU_LOGS_DIR/*.log {
|
||||
daily
|
||||
rotate 7
|
||||
@@ -67,17 +70,20 @@ $DOKKU_LOGS_DIR/*.log {
|
||||
}
|
||||
EOF
|
||||
|
||||
if [[ "$DOKKU_DISTRO" == "debian" ]]; then
|
||||
sed -i 's/ syslog dokku$/ root dokku/g' $DOKKU_LOGROTATE_FILE
|
||||
if [[ "$DOKKU_DISTRO" == "debian" ]]; then
|
||||
sed -i 's/ syslog dokku$/ root dokku/g' $DOKKU_LOGROTATE_FILE
|
||||
fi
|
||||
|
||||
flag_rsyslog_needs_restart=y
|
||||
fi
|
||||
|
||||
flag_rsyslog_needs_restart=y
|
||||
fi
|
||||
if [[ -f "$DOKKU_RSYSLOG_FILTER" && "$flag_rsyslog_needs_restart" == "y" ]]; then
|
||||
service rsyslog restart
|
||||
fi
|
||||
|
||||
if [[ -f "$DOKKU_RSYSLOG_FILTER" && "$flag_rsyslog_needs_restart" == "y" ]]; then
|
||||
service rsyslog restart
|
||||
fi
|
||||
[[ ! "$DOKKU_EVENTS" ]] || dokku_log_plugn_trigger_call "$(basename "$0")" "$@"
|
||||
|
||||
[[ ! "$DOKKU_EVENTS" ]] || dokku_log_plugn_trigger_call "$(basename "$0")" "$@"
|
||||
exit 0
|
||||
}
|
||||
|
||||
exit 0
|
||||
trigger-events-install "$@"
|
||||
|
||||
@@ -4,14 +4,13 @@ set -eo pipefail
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/app-json/internal-functions"
|
||||
|
||||
app_json_post_deploy() {
|
||||
trigger-app-json-post-deploy() {
|
||||
declare desc="app-json scripts execution"
|
||||
local trigger="app_json_post_deploy"
|
||||
local APP="$1"
|
||||
local IMAGE_TAG="$4"
|
||||
declare trigger="post-deploy"
|
||||
declare APP="$1" IMAGE_TAG="$4"
|
||||
local PHASE_SCRIPT_KEY="postdeploy"
|
||||
|
||||
execute_script "$APP" "$IMAGE_TAG" "$PHASE_SCRIPT_KEY"
|
||||
}
|
||||
|
||||
app_json_post_deploy "$@"
|
||||
trigger-app-json-post-deploy "$@"
|
||||
|
||||
@@ -4,15 +4,14 @@ set -eo pipefail
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/app-json/internal-functions"
|
||||
|
||||
app_json_pre_deploy() {
|
||||
trigger-app-json-pre-deploy() {
|
||||
declare desc="app-json scripts execution"
|
||||
local trigger="app_json_pre_deploy"
|
||||
local APP="$1"
|
||||
local IMAGE_TAG="$2"
|
||||
declare trigger="pre-deploy"
|
||||
declare APP="$1" IMAGE_TAG="$2"
|
||||
local PHASE_SCRIPT_KEY="predeploy"
|
||||
|
||||
execute_script "$APP" "$IMAGE_TAG" "$PHASE_SCRIPT_KEY"
|
||||
execute_script "$APP" "$IMAGE_TAG" "release"
|
||||
}
|
||||
|
||||
app_json_pre_deploy "$@"
|
||||
trigger-app-json-pre-deploy "$@"
|
||||
|
||||
@@ -3,12 +3,13 @@ set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
app_post_delete() {
|
||||
trigger-apps-post-delete() {
|
||||
declare desc="apps post-delete plugin trigger"
|
||||
local trigger="app_post_delete"
|
||||
local APP="$1"
|
||||
declare trigger="post-delete"
|
||||
declare APP="$1"
|
||||
local IMAGE_REPO=$(get_app_image_repo "$APP")
|
||||
if [[ -n $APP ]]; then
|
||||
|
||||
if [[ -n "$APP" ]]; then
|
||||
# remove contents for apps that are symlinks to other folders
|
||||
rm -rf "${DOKKU_ROOT:?}/$APP/" >/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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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")"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 <<EOF >"$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 <<EOF >"$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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
|
||||
Reference in New Issue
Block a user