refactor: use http and https as traefik entrypoints

This makes it a bit more clear as to where things are being redirected for web containers.

Also gate the https entrypoint behind the letsencrypt integration.
This commit is contained in:
Jose Diaz-Gonzalez
2022-08-10 04:52:29 -04:00
parent bebb05268c
commit 12d5bc4649
2 changed files with 12 additions and 10 deletions

View File

@@ -72,8 +72,8 @@ trigger-traefik-vhosts-docker-args-process-deploy() {
done
# add the labels for traefik here
# any `http:80` port mapping is treated as a `web` traefik entrypoint
# any `https:443` port mapping is treated as a `websecure` traefik entrypoint
# any `http:80` port mapping is treated as a `http` traefik entrypoint
# any `https:443` port mapping is treated as a `https` traefik entrypoint
if [[ -n "$is_app_listening" ]]; then
app_domains="$(plugn trigger domains-list "$APP")"
if [[ -n "$app_domains" ]]; then
@@ -90,7 +90,7 @@ trigger-traefik-vhosts-docker-args-process-deploy() {
fi
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=web"
output="$output --label traefik.http.routers.$APP-$PROC_TYPE.entrypoints=http"
if [[ -n "$traefik_domains" ]]; then
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"
@@ -105,10 +105,10 @@ trigger-traefik-vhosts-docker-args-process-deploy() {
proxy_container_https_port="$proxy_container_https_port_candidate"
fi
output="$output --label traefik.http.services.$APP-$PROC_TYPE-secure.loadbalancer.server.port=$proxy_container_https_port"
output="$output --label traefik.http.routers.$APP-$PROC_TYPE-secure.entrypoints=websecure"
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"
if [[ -n "$traefik_domains" ]]; then
output="$output --label \"traefik.http.routers.$APP-$PROC_TYPE-secure.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"
xargs -I{} echo "https://{}" <<<"$(echo "${app_domains}" | tr ' ' '\n' | sort -u)" >>"$app_urls_path"
fi