This commit is contained in:
Petr Hlavicka
2025-07-19 15:02:57 +02:00
committed by Jose Diaz-Gonzalez
parent 22c3d34877
commit 3c6796bd7b

View File

@@ -8,7 +8,7 @@ trigger-caddy-vhosts-docker-args-process-deploy() {
declare desc="nginx-vhosts core-post-deploy plugin trigger" declare desc="nginx-vhosts core-post-deploy plugin trigger"
declare trigger="docker-args-process-deploy" declare trigger="docker-args-process-deploy"
declare APP="$1" IMAGE_SOURCE_TYPE="$2" IMAGE_TAG="$3" PROC_TYPE="$4" CONTAINER_INDEX="$5" declare APP="$1" IMAGE_SOURCE_TYPE="$2" IMAGE_TAG="$3" PROC_TYPE="$4" CONTAINER_INDEX="$5"
local app_domains caddy_domains is_app_listening letsencrypt_email output proxy_container_port proxy_host_port port_map proxy_scheme proxy_schemes scheme tls_internal local app_domains caddy_domains is_app_listening letsencrypt_email output proxy_container_port proxy_host_port port_map proxy_scheme proxy_schemes scheme tls_internal label_key
local proxy_container_http_port proxy_container_http_port_candidate proxy_host_http_port_candidate local proxy_container_http_port proxy_container_http_port_candidate proxy_host_http_port_candidate
local proxy_container_https_port proxy_container_https_port_candidate proxy_host_https_port_candidate local proxy_container_https_port proxy_container_https_port_candidate proxy_host_https_port_candidate
local STDIN=$(cat) local STDIN=$(cat)
@@ -88,13 +88,14 @@ trigger-caddy-vhosts-docker-args-process-deploy() {
if [[ -n "$is_app_listening" ]] && [[ -n "$caddy_domains" ]]; then if [[ -n "$is_app_listening" ]] && [[ -n "$caddy_domains" ]]; then
has_443_mapping=false has_443_mapping=false
tls_internal="$(fn-caddy-tls-internal)" tls_internal="$(fn-caddy-tls-internal)"
label_key="$(fn-caddy-label-key "$APP")"
if [[ -n "$proxy_container_https_port" ]] || [[ -n "$proxy_container_https_port_candidate" ]]; then if [[ -n "$proxy_container_https_port" ]] || [[ -n "$proxy_container_https_port_candidate" ]]; then
has_443_mapping=true has_443_mapping=true
fi fi
ssl_warning_mapping="https:443" ssl_warning_mapping="https:443"
if [[ "$tls_internal" == "true" ]]; then if [[ "$tls_internal" == "true" ]]; then
output="--label caddy.tls=internal" output="--label ${label_key}.tls=internal"
if [[ "$has_443_mapping" == "false" ]]; then if [[ "$has_443_mapping" == "false" ]]; then
ssl_warning_mapping="http:80" ssl_warning_mapping="http:80"
proxy_host_https_port_candidate="$proxy_host_http_port_candidate" proxy_host_https_port_candidate="$proxy_host_http_port_candidate"
@@ -105,7 +106,7 @@ trigger-caddy-vhosts-docker-args-process-deploy() {
scheme="http" scheme="http"
if [[ -n "$letsencrypt_email" ]] && [[ "$has_443_mapping" == "true" ]]; then if [[ -n "$letsencrypt_email" ]] && [[ "$has_443_mapping" == "true" ]]; then
output="--label 'caddy=${caddy_domains}'" output="--label '${label_key}=${caddy_domains}'"
scheme="https" scheme="https"
if [[ -z "$proxy_container_https_port" ]]; then if [[ -z "$proxy_container_https_port" ]]; then
warning_scheme="$(awk -F ':' '{ print $1 }' <<<"$ssl_warning_mapping")" warning_scheme="$(awk -F ':' '{ print $1 }' <<<"$ssl_warning_mapping")"
@@ -114,17 +115,17 @@ trigger-caddy-vhosts-docker-args-process-deploy() {
proxy_container_https_port="$proxy_container_https_port_candidate" proxy_container_https_port="$proxy_container_https_port_candidate"
fi fi
output="$output --label \"caddy.reverse_proxy={{ upstreams $proxy_container_https_port }}\"" output="$output --label \"${label_key}.reverse_proxy={{ upstreams $proxy_container_https_port }}\""
elif [[ -n "$proxy_container_http_port" ]] || [[ -n "$proxy_container_http_port_candidate" ]]; then elif [[ -n "$proxy_container_http_port" ]] || [[ -n "$proxy_container_http_port_candidate" ]]; then
caddy_domains="${caddy_domains//, /:80, }" caddy_domains="${caddy_domains//, /:80, }"
output="--label 'caddy=${caddy_domains}:80'" output="--label '${label_key}=${caddy_domains}:80'"
if [[ -z "$proxy_container_http_port" ]]; then if [[ -z "$proxy_container_http_port" ]]; then
dokku_log_warn "Warning: http:80 port mapping not found" dokku_log_warn "Warning: http:80 port mapping not found"
dokku_log_warn "Utilizing first http port mapping, http:$proxy_host_http_port_candidate:$proxy_container_http_port_candidate" dokku_log_warn "Utilizing first http port mapping, http:$proxy_host_http_port_candidate:$proxy_container_http_port_candidate"
proxy_container_http_port="$proxy_container_http_port_candidate" proxy_container_http_port="$proxy_container_http_port_candidate"
fi fi
output="$output --label \"caddy.reverse_proxy={{ upstreams $proxy_container_http_port }}\"" output="$output --label \"${label_key}.reverse_proxy={{ upstreams $proxy_container_http_port }}\""
fi fi
fi fi