refactor: move domain manipulation into triggers
This allows other plugins to avoid understanding the underlying details of how domains might be integrated with.
This commit is contained in:
1 parent
5458d5b341
commit
61a306664f
22 files changed
+225
-48
No files matched your search
@@ -531,6 +531,96 @@ verify_app_name "$APP"
|
|||||||
# TODO
|
# TODO
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### `domains-add`
|
||||||
|
|
||||||
|
- Description: Adds a domain to an app
|
||||||
|
- Invoked by:
|
||||||
|
- Arguments: `$APP` `$DOMAIN`
|
||||||
|
- Example:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
```
|
||||||
|
|
||||||
|
### `domains-disable`
|
||||||
|
|
||||||
|
- Description: Disables domains for an app
|
||||||
|
- Invoked by:
|
||||||
|
- Arguments: `$APP` `$RESTART_APP`
|
||||||
|
- Example:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
```
|
||||||
|
|
||||||
|
### `domains-enable`
|
||||||
|
|
||||||
|
- Description: Enables domains for an app
|
||||||
|
- Invoked by:
|
||||||
|
- Arguments: `$APP` `$RESTART_APP`
|
||||||
|
- Example:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
```
|
||||||
|
|
||||||
|
### `domains-list`
|
||||||
|
|
||||||
|
- Description: Lists all domains for an app
|
||||||
|
- Invoked by:
|
||||||
|
- Arguments: `$APP`
|
||||||
|
- Example:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
```
|
||||||
|
|
||||||
|
### `domains-setup`
|
||||||
|
|
||||||
|
- Description: Initializes domains for an app if enabled
|
||||||
|
- Invoked by:
|
||||||
|
- Arguments: `$APP`
|
||||||
|
- Example:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
```
|
||||||
|
|
||||||
|
### `domains-vhost-enabled`
|
||||||
|
|
||||||
|
- Description: Checks if a virtual hosts are enabled for an app
|
||||||
|
- Invoked by:
|
||||||
|
- Arguments: `$APP`
|
||||||
|
- Example:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
```
|
||||||
|
|
||||||
### `git-deploy-branch`
|
### `git-deploy-branch`
|
||||||
|
|
||||||
- Description: Outputs the deploy branch for an app, inherited or not
|
- Description: Outputs the deploy branch for an app, inherited or not
|
||||||
|
|||||||
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
hook
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
hook
|
||||||
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
hook
|
||||||
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
hook
|
||||||
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
hook
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
hook
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
[[ $DOKKU_TRACE ]] && set -x
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
|
||||||
|
|
||||||
cmd-certs-generate() {
|
cmd-certs-generate() {
|
||||||
declare desc="generates a self-signed SSL certificate/key combo"
|
declare desc="generates a self-signed SSL certificate/key combo"
|
||||||
@@ -29,7 +28,7 @@ cmd-certs-generate() {
|
|||||||
chmod 750 "$APP_SSL_PATH"
|
chmod 750 "$APP_SSL_PATH"
|
||||||
chmod 640 "$APP_SSL_PATH/server.crt" "$APP_SSL_PATH/server.csr" "$APP_SSL_PATH/server.key"
|
chmod 640 "$APP_SSL_PATH/server.crt" "$APP_SSL_PATH/server.csr" "$APP_SSL_PATH/server.key"
|
||||||
plugn trigger post-certs-update "$APP"
|
plugn trigger post-certs-update "$APP"
|
||||||
[[ -n "$DOMAIN" ]] && (domains_add "$APP" "$DOMAIN" || plugn trigger post-domains-update "$APP")
|
[[ -n "$DOMAIN" ]] && (plugn trigger domains-add "$APP" "$DOMAIN" || plugn trigger post-domains-update "$APP")
|
||||||
dokku_log_info1 "The following is a certificate signing request that can be used"
|
dokku_log_info1 "The following is a certificate signing request that can be used"
|
||||||
dokku_log_info1 "to generate an 'officially' signed SSL certificate for $APP at $DOMAIN"
|
dokku_log_info1 "to generate an 'officially' signed SSL certificate for $APP at $DOMAIN"
|
||||||
dokku_log_info1 "by a CA of your choosing."
|
dokku_log_info1 "by a CA of your choosing."
|
||||||
|
|||||||
@@ -849,7 +849,6 @@ internal_get_app_urls() {
|
|||||||
declare desc="print an app's available urls"
|
declare desc="print an app's available urls"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
|
||||||
|
|
||||||
local APP="$2"
|
local APP="$2"
|
||||||
local RAW_TCP_PORTS="$(get_app_raw_tcp_ports "$APP")"
|
local RAW_TCP_PORTS="$(get_app_raw_tcp_ports "$APP")"
|
||||||
@@ -860,7 +859,7 @@ internal_get_app_urls() {
|
|||||||
local app_urls="$(grep -v -E "^#" "$URLS_FILE")"
|
local app_urls="$(grep -v -E "^#" "$URLS_FILE")"
|
||||||
if [[ -n "$DOKKU_PROXY_PORT_MAP" ]]; then
|
if [[ -n "$DOKKU_PROXY_PORT_MAP" ]]; then
|
||||||
local port_map app_vhost
|
local port_map app_vhost
|
||||||
local app_vhosts=$(get_app_domains "$APP")
|
local app_vhosts=$(plugn trigger domains-list "$APP")
|
||||||
for port_map in $DOKKU_PROXY_PORT_MAP; do
|
for port_map in $DOKKU_PROXY_PORT_MAP; do
|
||||||
local scheme="$(awk -F ':' '{ print $1 }' <<<"$port_map")"
|
local scheme="$(awk -F ':' '{ print $1 }' <<<"$port_map")"
|
||||||
local listen_port="$(awk -F ':' '{ print $2 }' <<<"$port_map")"
|
local listen_port="$(awk -F ':' '{ print $2 }' <<<"$port_map")"
|
||||||
|
|||||||
Executable
+14
@@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||||
|
set -eo pipefail
|
||||||
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
|
trigger-domains-domains-add() {
|
||||||
|
declare desc="adds a domain to an app"
|
||||||
|
declare trigger="domains-add"
|
||||||
|
declare APP="$1" DOMAIN="$2"
|
||||||
|
|
||||||
|
domains_add "$APP" "$DOMAIN"
|
||||||
|
}
|
||||||
|
|
||||||
|
trigger-domains-domains-add "$@"
|
||||||
Executable
+18
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||||
|
set -eo pipefail
|
||||||
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
|
trigger-domains-domains-disable() {
|
||||||
|
declare desc="disables domains for an app"
|
||||||
|
declare trigger="domains-disable"
|
||||||
|
declare APP="$1" RESTART_APP="$2"
|
||||||
|
|
||||||
|
if [[ "$RESTART_APP" == "true" ]]; then
|
||||||
|
disable_app_vhost "$APP"
|
||||||
|
else
|
||||||
|
disable_app_vhost "$APP" --no-restart
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
trigger-domains-domains-disable "$@"
|
||||||
Executable
+18
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||||
|
set -eo pipefail
|
||||||
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
|
trigger-domains-domains-enable() {
|
||||||
|
declare desc="enables domains for an app"
|
||||||
|
declare trigger="domains-enable"
|
||||||
|
declare APP="$1" RESTART_APP="$2"
|
||||||
|
|
||||||
|
if [[ "$RESTART_APP" == "true" ]]; then
|
||||||
|
enable_app_vhost "$APP"
|
||||||
|
else
|
||||||
|
enable_app_vhost "$APP" --no-restart
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
trigger-domains-domains-enable "$@"
|
||||||
Executable
+14
@@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||||
|
set -eo pipefail
|
||||||
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
|
trigger-domains-domains-list() {
|
||||||
|
declare desc="returns all domains for an app"
|
||||||
|
declare trigger="domains-list"
|
||||||
|
declare APP="$1"
|
||||||
|
|
||||||
|
get_app_domains "$APP"
|
||||||
|
}
|
||||||
|
|
||||||
|
trigger-domains-domains-list "$@"
|
||||||
Executable
+19
@@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||||
|
set -eo pipefail
|
||||||
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
|
trigger-domains-domains-setup() {
|
||||||
|
declare desc="creates vhost files as necessary"
|
||||||
|
declare trigger="domains-setup"
|
||||||
|
declare APP="$1"
|
||||||
|
|
||||||
|
if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]]; then
|
||||||
|
dokku_log_info1 "App virtual host support disabled, skipping domains setup"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
domains_setup "$APP"
|
||||||
|
}
|
||||||
|
|
||||||
|
trigger-domains-domains-setup "$@"
|
||||||
Executable
+16
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||||
|
set -eo pipefail
|
||||||
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
|
trigger-domains-domains-vhost-enabled() {
|
||||||
|
declare desc="returns whether vhosts are enabled or not"
|
||||||
|
declare trigger="domains-vhost-enabled"
|
||||||
|
declare APP="$1"
|
||||||
|
|
||||||
|
if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
trigger-domains-domains-vhost-enabled "$@"
|
||||||
+15
-23
@@ -1,28 +1,23 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
[[ $DOKKU_TRACE ]] && set -x
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|
||||||
|
|
||||||
disable_app_vhost() {
|
disable_app_vhost() {
|
||||||
declare desc="disable vhost support for given application"
|
declare desc="disable vhost support for given application"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
declare APP=$1 RESTART_APP="$2"
|
||||||
|
|
||||||
local APP=$1
|
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
local APP_VHOST_FILE="$DOKKU_ROOT/$APP/VHOST"
|
local APP_VHOST_FILE="$DOKKU_ROOT/$APP/VHOST"
|
||||||
local APP_URLS_FILE="$DOKKU_ROOT/$APP/URLS"
|
local APP_URLS_FILE="$DOKKU_ROOT/$APP/URLS"
|
||||||
|
|
||||||
plugn trigger pre-disable-vhost "$APP"
|
plugn trigger pre-disable-vhost "$APP"
|
||||||
if [[ -f "$APP_VHOST_FILE" ]]; then
|
if [[ -f "$APP_VHOST_FILE" ]] || [[ -f "$APP_URLS_FILE" ]]; then
|
||||||
dokku_log_info1 "VHOST support disabled, deleting $APP/VHOST"
|
dokku_log_info1 "App virtual host support disabled"
|
||||||
rm "$APP_VHOST_FILE"
|
rm -f "$APP_VHOST_FILE" "$APP_URLS_FILE"
|
||||||
fi
|
|
||||||
if [[ -f "$APP_URLS_FILE" ]]; then
|
|
||||||
dokku_log_info1 "VHOST support disabled, deleting $APP/URLS"
|
|
||||||
rm "$APP_URLS_FILE"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ "$2" == "--no-restart" ]] && local CONFIG_SET_ARGS=$2
|
[[ "$RESTART_APP" == "--no-restart" ]] && local CONFIG_SET_ARGS=$RESTART_APP
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
DOKKU_QUIET_OUTPUT=1 config_set $CONFIG_SET_ARGS $APP NO_VHOST=1
|
DOKKU_QUIET_OUTPUT=1 config_set $CONFIG_SET_ARGS $APP NO_VHOST=1
|
||||||
}
|
}
|
||||||
@@ -39,10 +34,10 @@ domains_setup() {
|
|||||||
|
|
||||||
if [[ ! -f $APP_VHOST_PATH ]]; then
|
if [[ ! -f $APP_VHOST_PATH ]]; then
|
||||||
if [[ -n "$DEFAULT_VHOSTS" ]]; then
|
if [[ -n "$DEFAULT_VHOSTS" ]]; then
|
||||||
dokku_log_info1 "Creating new $APP_VHOST_PATH..."
|
dokku_log_info1 "Creating new app virtual host file..."
|
||||||
echo "$DEFAULT_VHOSTS" >"$APP_VHOST_PATH"
|
echo "$DEFAULT_VHOSTS" >"$APP_VHOST_PATH"
|
||||||
else
|
else
|
||||||
dokku_log_info2 "no global VHOST set. disabling vhost support"
|
dokku_log_info2 "Global server virtual host not set, disabling app vhost..."
|
||||||
disable_app_vhost "$APP" --no-restart
|
disable_app_vhost "$APP" --no-restart
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -129,14 +124,14 @@ domains_disable() {
|
|||||||
if [[ "$(is_app_vhost_enabled "$APP")" == "true" ]]; then
|
if [[ "$(is_app_vhost_enabled "$APP")" == "true" ]]; then
|
||||||
disable_app_vhost "$APP"
|
disable_app_vhost "$APP"
|
||||||
else
|
else
|
||||||
dokku_log_info1 "domains (VHOST) support is already disabled for app ($APP)"
|
dokku_log_info1 "Domains (VHOST) support is already disabled for app ($APP)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
domains_enable() {
|
domains_enable() {
|
||||||
declare desc="enable domains/VHOST support"
|
declare desc="enable domains/VHOST support"
|
||||||
verify_app_name "$1"
|
verify_app_name "$1"
|
||||||
local APP="$1"
|
local APP="$1" RESTART_APP="$2"
|
||||||
local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||||
local DEFAULT_VHOSTS="$(get_default_vhosts "$APP")"
|
local DEFAULT_VHOSTS="$(get_default_vhosts "$APP")"
|
||||||
|
|
||||||
@@ -145,10 +140,10 @@ domains_enable() {
|
|||||||
if [[ -n "$DEFAULT_VHOSTS" ]]; then
|
if [[ -n "$DEFAULT_VHOSTS" ]]; then
|
||||||
echo "$DEFAULT_VHOSTS" >"$APP_VHOST_PATH"
|
echo "$DEFAULT_VHOSTS" >"$APP_VHOST_PATH"
|
||||||
fi
|
fi
|
||||||
[[ "$2" == "--no-restart" ]] && local ENABLE_APP_VHOST_ARGS=$2
|
[[ "$RESTART_APP" == "--no-restart" ]] && local ENABLE_APP_VHOST_ARGS=$RESTART_APP
|
||||||
enable_app_vhost "$APP" "$ENABLE_APP_VHOST_ARGS"
|
enable_app_vhost "$APP" "$ENABLE_APP_VHOST_ARGS"
|
||||||
else
|
else
|
||||||
dokku_log_info1 "domains (VHOST) support is already enabled for app ($APP)"
|
dokku_log_info1 "Domains (VHOST) support is already enabled for app ($APP)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,13 +207,11 @@ domains_set_global() {
|
|||||||
|
|
||||||
enable_app_vhost() {
|
enable_app_vhost() {
|
||||||
declare desc="enable vhost support for given application"
|
declare desc="enable vhost support for given application"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
declare APP=$1 RESTART_APP="$2"
|
||||||
|
|
||||||
local APP=$1
|
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
|
|
||||||
plugn trigger pre-enable-vhost "$APP"
|
plugn trigger pre-enable-vhost "$APP"
|
||||||
[[ "$2" == "--no-restart" ]] && local CONFIG_SET_ARGS=$2
|
[[ "$RESTART_APP" == "--no-restart" ]] && local CONFIG_SET_ARGS=$RESTART_APP
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
DOKKU_QUIET_OUTPUT=1 config_set $CONFIG_SET_ARGS "$APP" NO_VHOST=0
|
DOKKU_QUIET_OUTPUT=1 config_set $CONFIG_SET_ARGS "$APP" NO_VHOST=0
|
||||||
}
|
}
|
||||||
@@ -278,7 +271,6 @@ get_global_vhosts() {
|
|||||||
|
|
||||||
is_app_vhost_enabled() {
|
is_app_vhost_enabled() {
|
||||||
declare desc="returns true or false if vhost support is enabled for a given application"
|
declare desc="returns true or false if vhost support is enabled for a given application"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
|
||||||
|
|
||||||
local APP=$1
|
local APP=$1
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
[[ $DOKKU_TRACE ]] && set -x
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
|
||||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||||
|
|
||||||
trigger-nginx-vhosts-core-post-deploy() {
|
trigger-nginx-vhosts-core-post-deploy() {
|
||||||
@@ -17,12 +16,7 @@ trigger-nginx-vhosts-core-post-deploy() {
|
|||||||
|
|
||||||
HAS_NETWORK_CONFIG="$(plugn trigger network-config-exists "$APP")"
|
HAS_NETWORK_CONFIG="$(plugn trigger network-config-exists "$APP")"
|
||||||
if [[ "$HAS_NETWORK_CONFIG" == "true" ]]; then
|
if [[ "$HAS_NETWORK_CONFIG" == "true" ]]; then
|
||||||
if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]]; then
|
plugn trigger domains-setup "$APP"
|
||||||
dokku_log_info1 "VHOST support disabled. Skipping domains setup"
|
|
||||||
elif [[ ! -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
|
||||||
domains_setup "$APP"
|
|
||||||
fi
|
|
||||||
|
|
||||||
nginx_build_config "$APP"
|
nginx_build_config "$APP"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ set -eo pipefail
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
|
||||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions"
|
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions"
|
||||||
|
|
||||||
@@ -112,8 +111,9 @@ configure_nginx_ports() {
|
|||||||
local DOKKU_PROXY_PORT=$(config_get "$APP" DOKKU_PROXY_PORT)
|
local DOKKU_PROXY_PORT=$(config_get "$APP" DOKKU_PROXY_PORT)
|
||||||
local DOKKU_PROXY_SSL_PORT=$(config_get "$APP" DOKKU_PROXY_SSL_PORT)
|
local DOKKU_PROXY_SSL_PORT=$(config_get "$APP" DOKKU_PROXY_SSL_PORT)
|
||||||
local DOKKU_PROXY_PORT_MAP=$(config_get "$APP" DOKKU_PROXY_PORT_MAP)
|
local DOKKU_PROXY_PORT_MAP=$(config_get "$APP" DOKKU_PROXY_PORT_MAP)
|
||||||
local IS_APP_VHOST_ENABLED="$(is_app_vhost_enabled "$APP")"
|
local IS_APP_VHOST_ENABLED=true
|
||||||
local UPSTREAM_PORT="5000"
|
local UPSTREAM_PORT="5000"
|
||||||
|
plugn trigger domains-vhost-enabled "$APP" || IS_APP_VHOST_ENABLED=false
|
||||||
|
|
||||||
if [[ -z "$DOKKU_PROXY_PORT" ]] && [[ -z "$RAW_TCP_PORTS" ]]; then
|
if [[ -z "$DOKKU_PROXY_PORT" ]] && [[ -z "$RAW_TCP_PORTS" ]]; then
|
||||||
if [[ "$IS_APP_VHOST_ENABLED" == "false" ]]; then
|
if [[ "$IS_APP_VHOST_ENABLED" == "false" ]]; then
|
||||||
@@ -164,6 +164,7 @@ validate_ssl_domains() {
|
|||||||
declare desc="check configured domains against SSL cert contents and show warning if mismatched"
|
declare desc="check configured domains against SSL cert contents and show warning if mismatched"
|
||||||
local APP=$1
|
local APP=$1
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
|
local VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||||
local SSL_HOSTNAME=$(get_ssl_hostnames "$APP")
|
local SSL_HOSTNAME=$(get_ssl_hostnames "$APP")
|
||||||
local SSL_HOSTNAME_REGEX=$(echo "$SSL_HOSTNAME" | xargs | sed 's|\.|\\.|g' | sed 's/\*/\[^\.\]\*/g' | sed 's/ /|/g')
|
local SSL_HOSTNAME_REGEX=$(echo "$SSL_HOSTNAME" | xargs | sed 's|\.|\\.|g' | sed 's/\*/\[^\.\]\*/g' | sed 's/ /|/g')
|
||||||
|
|
||||||
@@ -317,7 +318,8 @@ nginx_build_config() {
|
|||||||
local RAW_TCP_PORTS="$(get_app_raw_tcp_ports "$APP")"
|
local RAW_TCP_PORTS="$(get_app_raw_tcp_ports "$APP")"
|
||||||
local DOKKU_APP_LISTENERS
|
local DOKKU_APP_LISTENERS
|
||||||
|
|
||||||
local IS_APP_VHOST_ENABLED=$(is_app_vhost_enabled "$APP")
|
local IS_APP_VHOST_ENABLED=true
|
||||||
|
plugn trigger domains-vhost-enabled "$APP" || IS_APP_VHOST_ENABLED=false
|
||||||
|
|
||||||
if [[ "$(plugn trigger proxy-is-enabled "$APP")" == "true" ]]; then
|
if [[ "$(plugn trigger proxy-is-enabled "$APP")" == "true" ]]; then
|
||||||
if [[ -z "$DOKKU_APP_LISTEN_PORT" ]] && [[ -z "$DOKKU_APP_LISTEN_IP" ]]; then
|
if [[ -z "$DOKKU_APP_LISTEN_PORT" ]] && [[ -z "$DOKKU_APP_LISTEN_IP" ]]; then
|
||||||
@@ -342,7 +344,7 @@ nginx_build_config() {
|
|||||||
local PROXY_UPSTREAM_PORTS="$(echo "$PROXY_UPSTREAM_PORTS" | xargs)"
|
local PROXY_UPSTREAM_PORTS="$(echo "$PROXY_UPSTREAM_PORTS" | xargs)"
|
||||||
|
|
||||||
local SSL_INUSE=
|
local SSL_INUSE=
|
||||||
local NONSSL_VHOSTS=$(get_app_domains "$APP")
|
local NONSSL_VHOSTS=$(plugn trigger domains-list "$APP")
|
||||||
local NOSSL_SERVER_NAME=$(echo "$NONSSL_VHOSTS" | xargs)
|
local NOSSL_SERVER_NAME=$(echo "$NONSSL_VHOSTS" | xargs)
|
||||||
if is_ssl_enabled "$APP"; then
|
if is_ssl_enabled "$APP"; then
|
||||||
local SSL_INUSE=true
|
local SSL_INUSE=true
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ set -eo pipefail
|
|||||||
[[ $DOKKU_TRACE ]] && set -x
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||||
|
|
||||||
trigger-nginx-vhosts-post-domains-update() {
|
trigger-nginx-vhosts-post-domains-update() {
|
||||||
declare desc="calls nginx build_config when domains are updated"
|
declare desc="calls nginx build_config when domains are updated"
|
||||||
declare trigger="post-domains-update"
|
declare trigger="post-domains-update"
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
[[ $DOKKU_TRACE ]] && set -x
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
|
||||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
|
||||||
|
|
||||||
trigger-nginx-vhosts-proxy-disable() {
|
trigger-nginx-vhosts-proxy-disable() {
|
||||||
declare desc="disable nginx proxy"
|
declare desc="disable nginx proxy"
|
||||||
@@ -12,8 +10,8 @@ trigger-nginx-vhosts-proxy-disable() {
|
|||||||
|
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
if [[ "$(plugn trigger proxy-type "$APP")" == "nginx" ]]; then
|
if [[ "$(plugn trigger proxy-type "$APP")" == "nginx" ]]; then
|
||||||
disable_app_vhost "$APP" --no-restart
|
plugn trigger domains-disable "$APP" false
|
||||||
ps_restart "$APP"
|
plugn trigger app-restart "$APP"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
[[ $DOKKU_TRACE ]] && set -x
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
|
||||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
|
||||||
|
|
||||||
trigger-nginx-vhosts-proxy-enable() {
|
trigger-nginx-vhosts-proxy-enable() {
|
||||||
declare desc="enable nginx proxy"
|
declare desc="enable nginx proxy"
|
||||||
@@ -12,8 +10,8 @@ trigger-nginx-vhosts-proxy-enable() {
|
|||||||
|
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
if [[ "$(plugn trigger proxy-type "$APP")" == "nginx" ]]; then
|
if [[ "$(plugn trigger proxy-type "$APP")" == "nginx" ]]; then
|
||||||
enable_app_vhost "$APP" --no-restart
|
plugn trigger domains-enable "$APP" "false"
|
||||||
ps_restart "$APP"
|
plugn trigger app-restart "$APP"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
[[ $DOKKU_TRACE ]] && set -x
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
|
||||||
|
|
||||||
cmd-ps-restart() {
|
cmd-ps-restart() {
|
||||||
declare desc="restarts app via command line"
|
declare desc="restarts app via command line"
|
||||||
@@ -11,7 +10,7 @@ cmd-ps-restart() {
|
|||||||
declare APP="$1"
|
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"
|
||||||
ps_restart "$APP"
|
plugn trigger app-restart "$APP"
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd-ps-restart "$@"
|
cmd-ps-restart "$@"
|
||||||
Reference in new issue
Block a user