feat: refactor to use network plugin
- Add proxy-build-config hook to rebuild network and proxy settings for an application - Scope nginx:build-config to work only when it is the configured proxy for an application - Refactor deploy code to interact with network plugin for computed and actual ipaddr/port settings - Ensure the proxy-build-config plugin trigger is called on ps:restore - Expose a few plugin triggers for retrieving networking information for a given APP/PROC_TYPE/CONTAINER_ID combination
This commit is contained in:
1 parent
ec9b8be5f8
commit
1835b04809
10 files changed
+182
-44
No files matched your search
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/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_build_config() {
|
||||
declare desc="build nginx config to proxy app containers from command line"
|
||||
declare APP="$1"
|
||||
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
|
||||
if [[ "$(get_app_proxy_type "$1")" = "nginx" ]]; then
|
||||
plugn trigger network-build-config "$APP"
|
||||
nginx_build_config "$APP"
|
||||
fi
|
||||
}
|
||||
|
||||
nginx_build_config_cmd "$@"
|
||||
@@ -1,14 +1,20 @@
|
||||
#!/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"
|
||||
|
||||
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