fix: remove not working method to change the caddy label-key

This was never actually used by caddy-docker-proxy so its better to just remove it.
This commit is contained in:
Jose Diaz-Gonzalez
2025-11-16 16:45:56 -05:00
parent edf9653ebf
commit 003f6a5bd8
6 changed files with 9 additions and 52 deletions

View File

@@ -5,3 +5,4 @@
- Support for the `DOKKU_DOCKERFILE_CACHE_BUILD` environment variable has been removed. Use the `docker-options` plugin to set build arguments for your app instead. - Support for the `DOKKU_DOCKERFILE_CACHE_BUILD` environment variable has been removed. Use the `docker-options` plugin to set build arguments for your app instead.
- Support for the `DOKKU_DOCKER_BUILD_OPTS` environment variable has been removed. Use the `docker-options` plugin to set build arguments for your app instead. - Support for the `DOKKU_DOCKER_BUILD_OPTS` environment variable has been removed. Use the `docker-options` plugin to set build arguments for your app instead.
- Support for the `no-cache` nixpacks property has been removed. Use the `docker-options` plugin to set build arguments for your app instead. - Support for the `no-cache` nixpacks property has been removed. Use the `docker-options` plugin to set build arguments for your app instead.
- Support for customizing the label-key for the caddy proxy has been removed. Always use `caddy.` as a prefix for your caddy directives.

View File

@@ -117,16 +117,6 @@ dokku caddy:set --global log-level DEBUG
After modifying, the Caddy container will need to be restarted. After modifying, the Caddy container will need to be restarted.
### Changing the label key for the app
The default label key for the app is `caddy`. This can be changed by setting the `label-key` property:
```shell
dokku caddy:set node-js-app label-key caddy_0
```
This will update the app's label key to `caddy_0`. The label key is used to identify the app in the Caddy configuration. If you change the label key, you will need to restart or rebuild the app to apply the updates.
### SSL Configuration ### SSL Configuration
The caddy plugin only supports automatic ssl certificates from its letsencrypt integration. Managed certificates provided by the `certs` plugin are ignored. The caddy plugin only supports automatic ssl certificates from its letsencrypt integration. Managed certificates provided by the `certs` plugin are ignored.

View File

@@ -9,7 +9,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 label_key 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 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)
@@ -89,14 +89,13 @@ 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 ${label_key}.tls=internal" output="--label caddy.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"
@@ -107,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 '${label_key}=${caddy_domains}'" output="--label 'caddy=${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")"
@@ -116,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 \"${label_key}.reverse_proxy={{ upstreams $proxy_container_https_port }}\"" output="$output --label \"caddy.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 '${label_key}=${caddy_domains}:80'" output="--label 'caddy=${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 \"${label_key}.reverse_proxy={{ upstreams $proxy_container_http_port }}\"" output="$output --label \"caddy.reverse_proxy={{ upstreams $proxy_container_http_port }}\""
fi fi
fi fi

View File

@@ -71,8 +71,3 @@ fn-caddy-tls-internal() {
declare APP="$1" declare APP="$1"
fn-plugin-property-get-default "caddy" "$APP" "tls-internal" "false" fn-plugin-property-get-default "caddy" "$APP" "tls-internal" "false"
} }
fn-caddy-label-key() {
declare APP="$1"
fn-plugin-property-get-default "caddy" "$APP" "label-key" "caddy"
}

View File

@@ -9,13 +9,13 @@ cmd-caddy-set() {
declare cmd="caddy:set" declare cmd="caddy:set"
[[ "$1" == "$cmd" ]] && shift 1 [[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" KEY="$2" VALUE="$3" declare APP="$1" KEY="$2" VALUE="$3"
local VALID_KEYS=("image" "letsencrypt-email" "letsencrypt-server" "log-level" "polling-interval" "label-key" "tls-internal") local VALID_KEYS=("image" "letsencrypt-email" "letsencrypt-server" "log-level" "polling-interval" "tls-internal")
local GLOBAL_KEYS=("image" "letsencrypt-email" "letsencrypt-server" "log-level" "polling-interval") local GLOBAL_KEYS=("image" "letsencrypt-email" "letsencrypt-server" "log-level" "polling-interval")
[[ -z "$KEY" ]] && dokku_log_fail "No key specified" [[ -z "$KEY" ]] && dokku_log_fail "No key specified"
if ! fn-in-array "$KEY" "${VALID_KEYS[@]}"; then if ! fn-in-array "$KEY" "${VALID_KEYS[@]}"; then
dokku_log_fail "Invalid key specified, valid keys include: image letsencrypt-email letsencrypt-server log-level polling-interval label-key tls-internal" dokku_log_fail "Invalid key specified, valid keys include: image letsencrypt-email letsencrypt-server log-level polling-interval tls-internal"
fi fi
if ! fn-in-array "$KEY" "${GLOBAL_KEYS[@]}"; then if ! fn-in-array "$KEY" "${GLOBAL_KEYS[@]}"; then

View File

@@ -50,34 +50,6 @@ teardown() {
assert_output_contains "python/http.server" assert_output_contains "python/http.server"
} }
@test "(caddy) custom label key" {
run /bin/bash -c "dokku builder-herokuish:set $TEST_APP allowed true"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku proxy:set $TEST_APP caddy"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku caddy:set $TEST_APP label-key caddy_0"
echo "output: $output"
echo "status: $status"
assert_success
run deploy_app
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"caddy_0\" }}'"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "$TEST_APP.${DOKKU_DOMAIN}:80"
}
@test "(caddy) multiple domains" { @test "(caddy) multiple domains" {
run /bin/bash -c "dokku proxy:set $TEST_APP caddy" run /bin/bash -c "dokku proxy:set $TEST_APP caddy"
echo "output: $output" echo "output: $output"