fix: fix issue with multiple domain support for caddy
This commit is contained in:
1 parent
591fe8642d
commit
741ffc635c
2 files changed
+87
-3
No files matched your search
@@ -75,6 +75,7 @@ trigger-caddy-vhosts-docker-args-process-deploy() {
|
|||||||
app_domains="$(plugn trigger domains-list "$APP")"
|
app_domains="$(plugn trigger domains-list "$APP")"
|
||||||
if [[ -n "$app_domains" ]]; then
|
if [[ -n "$app_domains" ]]; then
|
||||||
caddy_domains="$(echo "$app_domains" | xargs)"
|
caddy_domains="$(echo "$app_domains" | xargs)"
|
||||||
|
caddy_domains="${caddy_domains// /, }"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# add the labels for caddy here
|
# add the labels for caddy here
|
||||||
@@ -100,7 +101,7 @@ trigger-caddy-vhosts-docker-args-process-deploy() {
|
|||||||
letsencrypt_email="$(fn-caddy-letsencrypt-email)"
|
letsencrypt_email="$(fn-caddy-letsencrypt-email)"
|
||||||
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 '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")"
|
||||||
@@ -111,8 +112,8 @@ trigger-caddy-vhosts-docker-args-process-deploy() {
|
|||||||
|
|
||||||
output="$output --label \"caddy.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 caddy=${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"
|
||||||
|
|||||||
@@ -0,0 +1,83 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
load test_helper
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
global_setup
|
||||||
|
dokku nginx:stop
|
||||||
|
dokku caddy:start
|
||||||
|
create_app
|
||||||
|
}
|
||||||
|
|
||||||
|
teardown() {
|
||||||
|
global_teardown
|
||||||
|
destroy_app
|
||||||
|
dokku caddy:stop
|
||||||
|
dokku nginx:start
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "(caddy) caddy:help" {
|
||||||
|
run /bin/bash -c "dokku caddy"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_output_contains "Manage the caddy proxy integration"
|
||||||
|
help_output="$output"
|
||||||
|
|
||||||
|
run /bin/bash -c "dokku caddy:help"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_output_contains "Manage the caddy proxy integration"
|
||||||
|
assert_output "$help_output"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "(caddy) single domain" {
|
||||||
|
run /bin/bash -c "dokku proxy:set $TEST_APP caddy"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run deploy_app
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run /bin/bash -c "curl $(dokku url $TEST_APP)"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
assert_output_contains "python/http.server"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "(caddy) multiple domains" {
|
||||||
|
run /bin/bash -c "dokku proxy:set $TEST_APP caddy"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run /bin/bash -c "dokku domains:add $TEST_APP $TEST_APP.dokku.me"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run /bin/bash -c "dokku domains:add $TEST_APP $TEST_APP-2.dokku.me"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run deploy_app
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run /bin/bash -c "curl $TEST_APP.dokku.me"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
assert_output "python/http.server"
|
||||||
|
|
||||||
|
run /bin/bash -c "curl $TEST_APP-2.dokku.me"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
assert_output "python/http.server"
|
||||||
|
}
|
||||||
Reference in new issue
Block a user