traefik: Allow to define additional entrypoints

This patch allows users to easily add new entrypoints on different ports.
Such functionality comes in handy when having to deploy something like a docker registry on the same host but on a different port while still utilizing a shared certificate.
This commit is contained in:
saibotk 2021-08-15 23:55:23 +02:00
parent d2666eb72c
commit 19eb9e1196
Signed by: saibotk
GPG key ID: 67585F0065E261D5
2 changed files with 15 additions and 0 deletions

View file

@ -76,6 +76,15 @@ traefik_dynamic_conf:
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
# This config allows to add new entrypoints to traefik which are also automatically exposed / the port is automatically allocated.
# Can be used in cases where traefik needs to be used as a proxy because of the certificates it holds. Eg. gitlab registry on the
# same domain, where we want to use the existing certificate for the registry too.
#
# Example entry:
# - name: gitlabregistry
# port: 5050
traefik_additional_entrypoints: []
# Enables debug log level
traefik_debug: false

View file

@ -95,6 +95,9 @@ services:
ports:
- "80:80"
- "443:443"
{% for entrypoint in traefik_additional_entrypoints %}
- "{{ entrypoint.port }}:{{ entrypoint.port }}"
{% endfor %}
volumes:
- "{{ traefik_acme_location }}:/etc/traefik/acme"
@ -105,6 +108,9 @@ services:
command:
- "--entryPoints.web.address=:80"
- "--entryPoints.websecure.address=:443"
{% for entrypoint in traefik_additional_entrypoints %}
- "--entryPoints.{{ entrypoint.name }}.address=:{{ entrypoint.port }}"
{% endfor %}
- "--accesslog={{ traefik_access_log_enabled | bool | lower }}"
{% if traefik_dynamic_conf != omit %}
- "--providers.file.directory=/etc/traefik/dynamic_conf"