refactor: standardize trigger code
This commit is contained in:
@@ -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 "$@"
|
||||
|
||||
Reference in New Issue
Block a user