Merge pull request #5313 from dokku/5311-proxy-tests
Fix issues with multiple domains in new proxy plugins
This commit is contained in:
7 files changed
+175
-6
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"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ cmd-caddy-help() {
|
|||||||
declare desc="help command"
|
declare desc="help command"
|
||||||
declare CMD="$1"
|
declare CMD="$1"
|
||||||
local plugin_name="caddy"
|
local plugin_name="caddy"
|
||||||
local plugin_description="Manage mounted volumes"
|
local plugin_description="Manage the caddy proxy integration"
|
||||||
|
|
||||||
if [[ "$CMD" == "${plugin_name}:help" ]]; then
|
if [[ "$CMD" == "${plugin_name}:help" ]]; then
|
||||||
echo -e "Usage: dokku ${plugin_name}[:COMMAND]"
|
echo -e "Usage: dokku ${plugin_name}[:COMMAND]"
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ trigger-traefik-vhosts-docker-args-process-deploy() {
|
|||||||
|
|
||||||
output="$output --label traefik.http.services.$APP-$PROC_TYPE.loadbalancer.server.port=$proxy_container_http_port"
|
output="$output --label traefik.http.services.$APP-$PROC_TYPE.loadbalancer.server.port=$proxy_container_http_port"
|
||||||
output="$output --label traefik.http.routers.$APP-$PROC_TYPE.entrypoints=http"
|
output="$output --label traefik.http.routers.$APP-$PROC_TYPE.entrypoints=http"
|
||||||
|
output="$output --label traefik.http.routers.$APP-$PROC_TYPE.service=$APP-$PROC_TYPE"
|
||||||
if [[ -n "$traefik_domains" ]]; then
|
if [[ -n "$traefik_domains" ]]; then
|
||||||
output="$output --label \"traefik.http.routers.$APP-$PROC_TYPE.rule=Host(\\\`$traefik_domains\\\`)\""
|
output="$output --label \"traefik.http.routers.$APP-$PROC_TYPE.rule=Host(\\\`$traefik_domains\\\`)\""
|
||||||
echo "# THIS FILE IS GENERATED BY DOKKU - DO NOT EDIT, YOUR CHANGES WILL BE OVERWRITTEN" >"$app_urls_path"
|
echo "# THIS FILE IS GENERATED BY DOKKU - DO NOT EDIT, YOUR CHANGES WILL BE OVERWRITTEN" >"$app_urls_path"
|
||||||
@@ -107,6 +108,7 @@ trigger-traefik-vhosts-docker-args-process-deploy() {
|
|||||||
|
|
||||||
output="$output --label traefik.http.services.$APP-$PROC_TYPE-https.loadbalancer.server.port=$proxy_container_https_port"
|
output="$output --label traefik.http.services.$APP-$PROC_TYPE-https.loadbalancer.server.port=$proxy_container_https_port"
|
||||||
output="$output --label traefik.http.routers.$APP-$PROC_TYPE-https.entrypoints=https"
|
output="$output --label traefik.http.routers.$APP-$PROC_TYPE-https.entrypoints=https"
|
||||||
|
output="$output --label traefik.http.routers.$APP-$PROC_TYPE-https.service=$APP-$PROC_TYPE-https"
|
||||||
if [[ -n "$traefik_domains" ]]; then
|
if [[ -n "$traefik_domains" ]]; then
|
||||||
output="$output --label \"traefik.http.routers.$APP-$PROC_TYPE-https.rule=Host(\\\`$traefik_domains\\\`)\""
|
output="$output --label \"traefik.http.routers.$APP-$PROC_TYPE-https.rule=Host(\\\`$traefik_domains\\\`)\""
|
||||||
echo "# THIS FILE IS GENERATED BY DOKKU - DO NOT EDIT, YOUR CHANGES WILL BE OVERWRITTEN" >"$app_urls_path"
|
echo "# THIS FILE IS GENERATED BY DOKKU - DO NOT EDIT, YOUR CHANGES WILL BE OVERWRITTEN" >"$app_urls_path"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ cmd-traefik-help() {
|
|||||||
declare desc="help command"
|
declare desc="help command"
|
||||||
declare CMD="$1"
|
declare CMD="$1"
|
||||||
local plugin_name="traefik"
|
local plugin_name="traefik"
|
||||||
local plugin_description="Manage mounted volumes"
|
local plugin_description="Manage the traefik proxy integration"
|
||||||
|
|
||||||
if [[ "$CMD" == "${plugin_name}:help" ]]; then
|
if [[ "$CMD" == "${plugin_name}:help" ]]; then
|
||||||
echo -e "Usage: dokku ${plugin_name}[:COMMAND]"
|
echo -e "Usage: dokku ${plugin_name}[:COMMAND]"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ services:
|
|||||||
- --log.format=json
|
- --log.format=json
|
||||||
|
|
||||||
{{ if $.TRAEFIK_LETSENCRYPT_EMAIL }}
|
{{ if $.TRAEFIK_LETSENCRYPT_EMAIL }}
|
||||||
- --certificatesresolvers.leresolver.acme.caserver={{ $.TRAEFIK_LETSENCRYPT_SERVER }}"
|
- --certificatesresolvers.leresolver.acme.caserver={{ $.TRAEFIK_LETSENCRYPT_SERVER }}
|
||||||
- --certificatesresolvers.leresolver.acme.email={{ $.TRAEFIK_LETSENCRYPT_EMAIL }}
|
- --certificatesresolvers.leresolver.acme.email={{ $.TRAEFIK_LETSENCRYPT_EMAIL }}
|
||||||
- --certificatesresolvers.leresolver.acme.storage=/acme.json
|
- --certificatesresolvers.leresolver.acme.storage=/acme.json
|
||||||
- --certificatesresolvers.leresolver.acme.tlschallenge=true
|
- --certificatesresolvers.leresolver.acme.tlschallenge=true
|
||||||
|
|||||||
@@ -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 --silent $(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 --silent $TEST_APP.dokku.me"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
assert_output "python/http.server"
|
||||||
|
|
||||||
|
run /bin/bash -c "curl --silent $TEST_APP-2.dokku.me"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
assert_output "python/http.server"
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
load test_helper
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
global_setup
|
||||||
|
dokku nginx:stop
|
||||||
|
dokku traefik:start
|
||||||
|
create_app
|
||||||
|
}
|
||||||
|
|
||||||
|
teardown() {
|
||||||
|
global_teardown
|
||||||
|
destroy_app
|
||||||
|
dokku traefik:stop
|
||||||
|
dokku nginx:start
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "(traefik) traefik:help" {
|
||||||
|
run /bin/bash -c "dokku traefik"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_output_contains "Manage the traefik proxy integration"
|
||||||
|
help_output="$output"
|
||||||
|
|
||||||
|
run /bin/bash -c "dokku traefik:help"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_output_contains "Manage the traefik proxy integration"
|
||||||
|
assert_output "$help_output"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "(traefik) single domain" {
|
||||||
|
run /bin/bash -c "dokku proxy:set $TEST_APP traefik"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run deploy_app
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run /bin/bash -c "curl --silent $(dokku url $TEST_APP)"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
assert_output_contains "python/http.server"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "(traefik) multiple domains" {
|
||||||
|
run /bin/bash -c "dokku proxy:set $TEST_APP traefik"
|
||||||
|
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 --silent $TEST_APP.dokku.me"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
assert_output "python/http.server"
|
||||||
|
|
||||||
|
run /bin/bash -c "curl --silent $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