Merge branch 'master' into feature-config-golang
This commit is contained in:
@@ -9,7 +9,10 @@ nginx_core_post_deploy() {
|
||||
declare desc="nginx-vhosts core-post-deploy plugin trigger"
|
||||
local trigger="nginx_core_post_deploy"
|
||||
local APP="$1"
|
||||
if [[ -f "$DOKKU_ROOT/$APP/IP.web.1" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT.web.1" ]]; then
|
||||
local HAS_NETWORK_CONFIG
|
||||
|
||||
HAS_NETWORK_CONFIG="$(plugn trigger network-config-exists "$APP")"
|
||||
if [[ "$HAS_NETWORK_CONFIG" == "true" ]]; then
|
||||
if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]]; then
|
||||
dokku_log_info1 "VHOST support disabled. Skipping domains setup"
|
||||
elif [[ ! -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
|
||||
@@ -4,6 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||
|
||||
get_nginx_location() {
|
||||
@@ -222,22 +223,13 @@ nginx_build_config() {
|
||||
local NGINX_TEMPLATE="$DEFAULT_NGINX_TEMPLATE"; local SCHEME=http
|
||||
local NGINX_TEMPLATE_SOURCE="built-in"; local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
local RAW_TCP_PORTS="$(get_app_raw_tcp_ports "$APP")"
|
||||
local DOKKU_APP_LISTENERS
|
||||
|
||||
local DOKKU_DISABLE_PROXY=$(config_get "$APP" DOKKU_DISABLE_PROXY)
|
||||
local IS_APP_VHOST_ENABLED=$(is_app_vhost_enabled "$APP")
|
||||
|
||||
if [[ -z "$DOKKU_DISABLE_PROXY" ]]; then
|
||||
if [[ "$(is_app_proxy_enabled "$APP")" == "true" ]]; then
|
||||
if [[ -z "$DOKKU_APP_LISTEN_PORT" ]] && [[ -z "$DOKKU_APP_LISTEN_IP" ]]; then
|
||||
shopt -s nullglob
|
||||
local DOKKU_APP_IP_FILE
|
||||
for DOKKU_APP_IP_FILE in $DOKKU_ROOT/$APP/IP.web.*; do
|
||||
local DOKKU_APP_PORT_FILE="${DOKKU_APP_IP_FILE//IP/PORT}"
|
||||
local DOKKU_APP_LISTENER_IP=$(< "$DOKKU_APP_IP_FILE")
|
||||
local DOKKU_APP_LISTENER_PORT=$(< "$DOKKU_APP_PORT_FILE")
|
||||
local DOKKU_APP_LISTENERS+="$DOKKU_APP_LISTENER_IP:$DOKKU_APP_LISTENER_PORT "
|
||||
done
|
||||
local DOKKU_APP_LISTENERS="$(echo "$DOKKU_APP_LISTENERS" | xargs)"
|
||||
shopt -u nullglob
|
||||
DOKKU_APP_LISTENERS="$(plugn trigger network-get-listeners "$APP" | xargs)"
|
||||
elif [[ -n "$DOKKU_APP_LISTEN_PORT" ]] && [[ -n "$DOKKU_APP_LISTEN_IP" ]]; then
|
||||
local PASSED_LISTEN_IP_PORT=true
|
||||
fi
|
||||
@@ -343,7 +335,7 @@ nginx_build_config() {
|
||||
xargs -i echo "$SCHEME://{}" <<< "$(echo "${SSL_VHOSTS}" "${NONSSL_VHOSTS}" | tr ' ' '\n' | sort -u)" >> "$URLS_PATH"
|
||||
fi
|
||||
else
|
||||
# note because this clause is long. if $DOKKU_DISABLE_PROXY is set:
|
||||
# note because this clause is long. if the proxy is disabled:
|
||||
dokku_log_info1 "nginx support is disabled for app ($APP)."
|
||||
if [[ -f "$DOKKU_ROOT/$APP/nginx.conf" ]]; then
|
||||
dokku_log_info1 "deleting nginx.conf"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core nginx-vhosts plugin"
|
||||
version = "0.10.4"
|
||||
version = "0.10.5"
|
||||
[plugin.config]
|
||||
|
||||
@@ -6,9 +6,12 @@ source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||
|
||||
nginx_post_domains_update() {
|
||||
declare desc="calls nginx build_config when domains are updated"
|
||||
local trigger="nginx_post_domains_update"
|
||||
if [[ "$(get_app_proxy_type "$1")" == "nginx" ]]; then
|
||||
nginx_build_config "$1"
|
||||
declare trigger="nginx_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
|
||||
nginx_build_config "$APP"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
19
plugins/nginx-vhosts/proxy-build-config
Executable file
19
plugins/nginx-vhosts/proxy-build-config
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||
|
||||
nginx_proxy_build_config() {
|
||||
declare desc="build nginx config to proxy app containers from command line"
|
||||
declare trigger="nginx_proxy_build_config"
|
||||
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
|
||||
plugn trigger network-build-config "$APP"
|
||||
nginx_build_config "$APP"
|
||||
fi
|
||||
}
|
||||
|
||||
nginx_proxy_build_config "$@"
|
||||
@@ -1,14 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||
|
||||
nginx_build_config_cmd() {
|
||||
declare desc="build nginx config to proxy app containers from command line"
|
||||
declare APP="$2"
|
||||
local cmd="nginx:build-config"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
nginx_build_config "$2"
|
||||
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
local PROXY_APP_TYPE
|
||||
PROXY_APP_TYPE="$(get_app_proxy_type "$APP")"
|
||||
|
||||
if [[ "$PROXY_APP_TYPE" == "nginx" ]]; then
|
||||
plugn trigger proxy-build-config "$APP"
|
||||
else
|
||||
dokku_log_fail "Configured proxy for ${APP} is ${PROXY_APP_TYPE}"
|
||||
fi
|
||||
}
|
||||
|
||||
nginx_build_config_cmd "$@"
|
||||
|
||||
Reference in New Issue
Block a user