When an app has no web listeners (not yet deployed, no web process type, or web processes not running), generate a minimal nginx config that returns 502 Bad Gateway instead of having no config at all. This ensures domains resolve, monitoring tools detect non-200 status codes, and SSL certificate provisioning tools like letsencrypt can function.
22 lines
522 B
Bash
22 lines
522 B
Bash
#!/usr/bin/env bash
|
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
|
|
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
|
set -eo pipefail
|
|
[[ $DOKKU_TRACE ]] && set -x
|
|
|
|
trigger-nginx-vhosts-post-create() {
|
|
declare desc="nginx-vhosts post-create trigger"
|
|
declare trigger="post-create"
|
|
declare APP="$1"
|
|
|
|
fn-plugin-property-setup-app "nginx" "$APP"
|
|
|
|
if [[ "$(plugn trigger proxy-type "$APP")" != "nginx" ]]; then
|
|
return
|
|
fi
|
|
|
|
nginx_build_config "$APP"
|
|
}
|
|
|
|
trigger-nginx-vhosts-post-create "$@"
|