Add documentation and unit tests for custom Traefik entrypoints

These changes include updates to documentation, command functions, and related unit tests.
This commit is contained in:
Coffee2CodeNL committed 2024-04-08 15:25:44 +02:00
1 parent c915b67d86
commit be4c54b878
3 files changed
+75

No files matched your search

+11
View File
@@ -67,6 +67,17 @@ dokku traefik:stop
The Traefik container will be stopped and removed from the system. If the container is not running, this command will do nothing. The Traefik container will be stopped and removed from the system. If the container is not running, this command will do nothing.
### Changing the Traefik entrypoint names
When you use a self-hosted Traefik instance, your entrypoint names might be different from the default `http` and `https`
Use `traefik:set` to set both `http-entry-point` and `https-entry-point` to custom values
```shell
dokku traefik:set --global http-entry-point web
dokku traefik:set --global https-entry-point websecure
```
### Showing the Traefik compose config ### Showing the Traefik compose config
For debugging purposes, it may be useful to show the Traefik compose config. This can be achieved via the `traefik:show-config` command. For debugging purposes, it may be useful to show the Traefik compose config. This can be achieved via the `traefik:show-config` command.
+2
View File
@@ -44,6 +44,8 @@ cmd-traefik-report-single() {
"--traefik-letsencrypt-email: $(fn-traefik-letsencrypt-email)" "--traefik-letsencrypt-email: $(fn-traefik-letsencrypt-email)"
"--traefik-letsencrypt-server: $(fn-traefik-letsencrypt-server)" "--traefik-letsencrypt-server: $(fn-traefik-letsencrypt-server)"
"--traefik-log-level: $(fn-traefik-log-level)" "--traefik-log-level: $(fn-traefik-log-level)"
"--traefik-http-entry-point: $(fn-traefik-http-entry-point)"
"--traefik-https-entry-point: $(fn-traefik-https-entry-point)"
) )
if [[ -z "$INFO_FLAG" ]]; then if [[ -z "$INFO_FLAG" ]]; then
+62
View File
@@ -237,3 +237,65 @@ teardown() {
assert_success assert_success
assert_line ' - "traefik.http.routers.api.middlewares=auth"' assert_line ' - "traefik.http.routers.api.middlewares=auth"'
} }
@test "(traefik) change traefik entry point http" {
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 traefik"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku traefik:set --global http-entry-point web"
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 \"traefik.http.routers.$TEST_APP-web-http.entrypoints\" }}'"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "web"
}
@test "(traefik) change traefik entry point https" {
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 traefik"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku traefik:set --global letsencrypt-email test@example.com"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku traefik:set --global https-entry-point websecure"
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 \"traefik.http.routers.$TEST_APP-web-https.entrypoints\" }}'"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "websecure"
}