Add support for the internal Traefik entrypoint to Conduit

This commit is contained in:
Slavi Pantaleev 2024-01-14 10:40:46 +02:00
parent ee0eb59dc6
commit 4d66c14fd5
4 changed files with 52 additions and 19 deletions

View File

@ -4995,6 +4995,9 @@ matrix_conduit_container_labels_public_client_root_redirection_url: "{{ (('https
matrix_conduit_container_labels_public_federation_api_traefik_entrypoints: "{{ matrix_federation_traefik_entrypoint }}" matrix_conduit_container_labels_public_federation_api_traefik_entrypoints: "{{ matrix_federation_traefik_entrypoint }}"
matrix_conduit_container_labels_internal_client_api_enabled: "{{ matrix_playbook_internal_matrix_client_api_traefik_entrypoint_enabled }}"
matrix_conduit_container_labels_internal_client_api_traefik_entrypoints: "{{ matrix_playbook_internal_matrix_client_api_traefik_entrypoint_name }}"
# Even if TURN doesn't support TLS (it does by default), # Even if TURN doesn't support TLS (it does by default),
# it doesn't hurt to try a secure connection anyway. # it doesn't hurt to try a secure connection anyway.
# #

View File

@ -70,6 +70,14 @@ matrix_conduit_container_labels_public_client_api_traefik_entrypoints: "{{ matri
matrix_conduit_container_labels_public_client_api_traefik_tls: "{{ matrix_conduit_container_labels_public_client_api_traefik_entrypoints != 'web' }}" matrix_conduit_container_labels_public_client_api_traefik_tls: "{{ matrix_conduit_container_labels_public_client_api_traefik_entrypoints != 'web' }}"
matrix_conduit_container_labels_public_client_api_traefik_tls_certResolver: "{{ matrix_conduit_container_labels_traefik_tls_certResolver }}" # noqa var-naming matrix_conduit_container_labels_public_client_api_traefik_tls_certResolver: "{{ matrix_conduit_container_labels_traefik_tls_certResolver }}" # noqa var-naming
# Controls whether labels will be added that expose the Client-Server API on the internal Traefik entrypoint.
# This is similar to `matrix_conduit_container_labels_public_client_api_enabled`, but the entrypoint and intent is different.
matrix_conduit_container_labels_internal_client_api_enabled: false
matrix_conduit_container_labels_internal_client_api_traefik_path_prefix: "{{ matrix_conduit_container_labels_public_client_api_traefik_path_prefix }}"
matrix_conduit_container_labels_internal_client_api_traefik_rule: "PathPrefix(`{{ matrix_conduit_container_labels_internal_client_api_traefik_path_prefix }}`)"
matrix_conduit_container_labels_internal_client_api_traefik_priority: "{{ matrix_conduit_container_labels_public_client_api_traefik_priority }}"
matrix_conduit_container_labels_internal_client_api_traefik_entrypoints: ""
# Controls whether labels will be added that expose the Server-Server API (Federation API) on a public Traefik entrypoint. # Controls whether labels will be added that expose the Server-Server API (Federation API) on a public Traefik entrypoint.
matrix_conduit_container_labels_public_federation_api_enabled: "{{ matrix_conduit_allow_federation }}" matrix_conduit_container_labels_public_federation_api_enabled: "{{ matrix_conduit_allow_federation }}"
matrix_conduit_container_labels_public_federation_api_traefik_hostname: "{{ matrix_conduit_hostname }}" matrix_conduit_container_labels_public_federation_api_traefik_hostname: "{{ matrix_conduit_hostname }}"

View File

@ -8,3 +8,4 @@
with_items: with_items:
- {'name': 'matrix_conduit_hostname', when: true} - {'name': 'matrix_conduit_hostname', when: true}
- {'name': 'matrix_conduit_container_network', when: true} - {'name': 'matrix_conduit_container_network', when: true}
- {'name': 'matrix_conduit_container_labels_internal_client_api_traefik_entrypoints', when: "{{ matrix_conduit_container_labels_internal_client_api_enabled }}"}

View File

@ -21,20 +21,20 @@ traefik.http.middlewares.matrix-conduit-client-root-redirect.redirectregex.regex
traefik.http.middlewares.matrix-conduit-client-root-redirect.redirectregex.replacement={{ matrix_conduit_container_labels_public_client_root_redirection_url }} traefik.http.middlewares.matrix-conduit-client-root-redirect.redirectregex.replacement={{ matrix_conduit_container_labels_public_client_root_redirection_url }}
{% endif %} {% endif %}
traefik.http.routers.matrix-conduit-client-root.rule={{ matrix_conduit_container_labels_public_client_root_traefik_rule }} traefik.http.routers.matrix-conduit-public-client-root.rule={{ matrix_conduit_container_labels_public_client_root_traefik_rule }}
traefik.http.routers.matrix-conduit-client-root.middlewares={{ client_root_middlewares | join(',') }} traefik.http.routers.matrix-conduit-public-client-root.middlewares={{ client_root_middlewares | join(',') }}
{% if matrix_conduit_container_labels_public_client_root_traefik_priority | int > 0 %} {% if matrix_conduit_container_labels_public_client_root_traefik_priority | int > 0 %}
traefik.http.routers.matrix-conduit-client-root.priority={{ matrix_conduit_container_labels_public_client_root_traefik_priority }} traefik.http.routers.matrix-conduit-public-client-root.priority={{ matrix_conduit_container_labels_public_client_root_traefik_priority }}
{% endif %} {% endif %}
traefik.http.routers.matrix-conduit-client-root.service=matrix-conduit traefik.http.routers.matrix-conduit-public-client-root.service=matrix-conduit
traefik.http.routers.matrix-conduit-client-root.entrypoints={{ matrix_conduit_container_labels_public_client_root_traefik_entrypoints }} traefik.http.routers.matrix-conduit-public-client-root.entrypoints={{ matrix_conduit_container_labels_public_client_root_traefik_entrypoints }}
traefik.http.routers.matrix-conduit-client-root.tls={{ matrix_conduit_container_labels_public_client_root_traefik_tls | to_json }} traefik.http.routers.matrix-conduit-public-client-root.tls={{ matrix_conduit_container_labels_public_client_root_traefik_tls | to_json }}
{% if matrix_conduit_container_labels_public_client_root_traefik_tls %} {% if matrix_conduit_container_labels_public_client_root_traefik_tls %}
traefik.http.routers.matrix-conduit-client-root.tls.certResolver={{ matrix_conduit_container_labels_public_client_root_traefik_tls_certResolver }} traefik.http.routers.matrix-conduit-public-client-root.tls.certResolver={{ matrix_conduit_container_labels_public_client_root_traefik_tls_certResolver }}
{% endif %} {% endif %}
{% endif %} {% endif %}
@ -48,18 +48,18 @@ traefik.http.routers.matrix-conduit-client-root.tls.certResolver={{ matrix_condu
#} #}
{% if matrix_conduit_container_labels_public_client_api_enabled %} {% if matrix_conduit_container_labels_public_client_api_enabled %}
traefik.http.routers.matrix-conduit-client-api.rule={{ matrix_conduit_container_labels_public_client_api_traefik_rule }} traefik.http.routers.matrix-conduit-public-client-api.rule={{ matrix_conduit_container_labels_public_client_api_traefik_rule }}
{% if matrix_conduit_container_labels_public_client_api_traefik_priority | int > 0 %} {% if matrix_conduit_container_labels_public_client_api_traefik_priority | int > 0 %}
traefik.http.routers.matrix-conduit-client-api.priority={{ matrix_conduit_container_labels_public_client_api_traefik_priority }} traefik.http.routers.matrix-conduit-public-client-api.priority={{ matrix_conduit_container_labels_public_client_api_traefik_priority }}
{% endif %} {% endif %}
traefik.http.routers.matrix-conduit-client-api.service=matrix-conduit traefik.http.routers.matrix-conduit-public-client-api.service=matrix-conduit
traefik.http.routers.matrix-conduit-client-api.entrypoints={{ matrix_conduit_container_labels_public_client_api_traefik_entrypoints }} traefik.http.routers.matrix-conduit-public-client-api.entrypoints={{ matrix_conduit_container_labels_public_client_api_traefik_entrypoints }}
traefik.http.routers.matrix-conduit-client-api.tls={{ matrix_conduit_container_labels_public_client_api_traefik_tls | to_json }}
traefik.http.routers.matrix-conduit-public-client-api.tls={{ matrix_conduit_container_labels_public_client_api_traefik_tls | to_json }}
{% if matrix_conduit_container_labels_public_client_api_traefik_tls %} {% if matrix_conduit_container_labels_public_client_api_traefik_tls %}
traefik.http.routers.matrix-conduit-client-api.tls.certResolver={{ matrix_conduit_container_labels_public_client_api_traefik_tls_certResolver }} traefik.http.routers.matrix-conduit-public-client-api.tls.certResolver={{ matrix_conduit_container_labels_public_client_api_traefik_tls_certResolver }}
{% endif %} {% endif %}
{% endif %} {% endif %}
@ -68,23 +68,44 @@ traefik.http.routers.matrix-conduit-client-api.tls.certResolver={{ matrix_condui
#} #}
{#
Internal Client-API (/_matrix)
#}
{% if matrix_conduit_container_labels_internal_client_api_enabled %}
traefik.http.routers.matrix-conduit-public-client-api.rule={{ matrix_conduit_container_labels_internal_client_api_traefik_rule }}
{% if matrix_conduit_container_labels_internal_client_api_traefik_priority | int > 0 %}
traefik.http.routers.matrix-conduit-public-client-api.priority={{ matrix_conduit_container_labels_internal_client_api_traefik_priority }}
{% endif %}
traefik.http.routers.matrix-conduit-public-client-api.service=matrix-conduit
traefik.http.routers.matrix-conduit-public-client-api.entrypoints={{ matrix_conduit_container_labels_internal_client_api_traefik_entrypoints }}
{% endif %}
{% endif %}
{#
/Internal Client-API (/_matrix)
#}
{# {#
Public Federation-API (/_matrix) Public Federation-API (/_matrix)
#} #}
{% if matrix_conduit_container_labels_public_federation_api_enabled %} {% if matrix_conduit_container_labels_public_federation_api_enabled %}
traefik.http.routers.matrix-conduit-federation-api.rule={{ matrix_conduit_container_labels_public_federation_api_traefik_rule }} traefik.http.routers.matrix-conduit-public-federation-api.rule={{ matrix_conduit_container_labels_public_federation_api_traefik_rule }}
{% if matrix_conduit_container_labels_public_federation_api_traefik_priority | int > 0 %} {% if matrix_conduit_container_labels_public_federation_api_traefik_priority | int > 0 %}
traefik.http.routers.matrix-conduit-federation-api.priority={{ matrix_conduit_container_labels_public_federation_api_traefik_priority }} traefik.http.routers.matrix-conduit-public-federation-api.priority={{ matrix_conduit_container_labels_public_federation_api_traefik_priority }}
{% endif %} {% endif %}
traefik.http.routers.matrix-conduit-federation-api.service=matrix-conduit traefik.http.routers.matrix-conduit-public-federation-api.service=matrix-conduit
traefik.http.routers.matrix-conduit-federation-api.entrypoints={{ matrix_conduit_container_labels_public_federation_api_traefik_entrypoints }} traefik.http.routers.matrix-conduit-public-federation-api.entrypoints={{ matrix_conduit_container_labels_public_federation_api_traefik_entrypoints }}
traefik.http.routers.matrix-conduit-federation-api.tls={{ matrix_conduit_container_labels_public_federation_api_traefik_tls | to_json }}
traefik.http.routers.matrix-conduit-public-federation-api.tls={{ matrix_conduit_container_labels_public_federation_api_traefik_tls | to_json }}
{% if matrix_conduit_container_labels_public_federation_api_traefik_tls %} {% if matrix_conduit_container_labels_public_federation_api_traefik_tls %}
traefik.http.routers.matrix-conduit-federation-api.tls.certResolver={{ matrix_conduit_container_labels_public_federation_api_traefik_tls_certResolver }} traefik.http.routers.matrix-conduit-public-federation-api.tls.certResolver={{ matrix_conduit_container_labels_public_federation_api_traefik_tls_certResolver }}
{% endif %} {% endif %}
{% endif %} {% endif %}