Add support for the internal Traefik entrypoint to matrix-media-repo

This commit is contained in:
Slavi Pantaleev 2024-01-14 11:57:51 +02:00
parent 6b5f42fa81
commit 69ca30d1b1
4 changed files with 34 additions and 5 deletions

View File

@ -3263,6 +3263,9 @@ matrix_media_repo_container_labels_traefik_docker_network: "{{ matrix_playbook_r
matrix_media_repo_container_labels_traefik_entrypoints: "{{ devture_traefik_entrypoint_primary }}"
matrix_media_repo_container_labels_traefik_tls_certResolver: "{{ devture_traefik_certResolver_primary }}"
matrix_media_repo_container_labels_traefik_internal_media_enabled: "{{ matrix_playbook_internal_matrix_client_api_traefik_entrypoint_enabled }}"
matrix_media_repo_container_labels_traefik_internal_media_entrypoints: "{{ matrix_playbook_internal_matrix_client_api_traefik_entrypoint_name }}"
matrix_media_repo_database_hostname: "{{ devture_postgres_connection_hostname if devture_postgres_enabled else '' }}"
matrix_media_repo_database_username: matrix_media_repo
matrix_media_repo_database_password: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'mediarepo.db', rounds=655555) | to_uuid }}"
@ -4844,11 +4847,6 @@ matrix_dendrite_container_labels_public_federation_api_traefik_entrypoints: "{{
matrix_dendrite_container_labels_public_metrics_middleware_basic_auth_enabled: "{{ matrix_metrics_exposure_http_basic_auth_enabled }}"
matrix_dendrite_container_labels_public_metrics_middleware_basic_auth_users: "{{ matrix_metrics_exposure_http_basic_auth_users }}"
matrix_dendrite_container_labels_internal_client_api_enabled: "{{ matrix_playbook_internal_matrix_client_api_traefik_entrypoint_enabled }}"
matrix_dendrite_container_labels_internal_client_api_traefik_entrypoints: "{{ matrix_playbook_internal_matrix_client_api_traefik_entrypoint_name }}"
matrix_dendrite_container_extra_arguments_auto: "{{ matrix_homeserver_container_extra_arguments_auto }}"
matrix_dendrite_metrics_enabled: "{{ prometheus_enabled }}"
matrix_dendrite_metrics_proxying_enabled: "{{ matrix_dendrite_metrics_enabled and matrix_metrics_exposure_enabled }}"

View File

@ -71,6 +71,13 @@ matrix_media_repo_container_labels_traefik_media_entrypoints: web-secure
matrix_media_repo_container_labels_traefik_media_tls: "{{ matrix_media_repo_container_labels_traefik_media_entrypoints != 'web' }}"
matrix_media_repo_container_labels_traefik_media_tls_certResolver: default # noqa var-naming
# This is like `matrix_media_repo_container_labels_traefik_media_*`, but on an internal Traefik entrypoint.
matrix_media_repo_container_labels_traefik_internal_media_enabled: false
matrix_media_repo_container_labels_traefik_internal_media_path_prefix: "{{ matrix_media_repo_container_labels_traefik_media_path_prefix }}"
matrix_media_repo_container_labels_traefik_internal_media_rule: "PathPrefix(`{{ matrix_media_repo_container_labels_traefik_internal_media_path_prefix | quote }}`)"
matrix_media_repo_container_labels_traefik_internal_media_priority: "{{ matrix_media_repo_container_labels_traefik_media_priority }}"
matrix_media_repo_container_labels_traefik_internal_media_entrypoints: ""
# /_matrix/client/r0/logout
# /_matrix/client/r0/logout/all
matrix_media_repo_container_labels_traefik_logout_path_prefix: "/_matrix/client/{version:(r0|v1|v3|unstable)}/{endpoint:(logout|logout/all)}"

View File

@ -7,6 +7,7 @@
when: "item.when | bool and vars[item.name] == ''"
with_items:
- {'name': 'matrix_media_repo_database_hostname', when: true}
- {'name': 'matrix_media_repo_container_labels_traefik_internal_media_entrypoints', when: "{{ matrix_media_repo_container_labels_traefik_internal_media_enabled }}"}
- name: (Deprecation) Catch and report renamed matrix-media-repo settings
ansible.builtin.fail:

View File

@ -45,6 +45,29 @@ traefik.http.routers.matrix-media-repo-public-media.tls.certResolver={{ matrix_m
#}
{#
Internal Media (/_matrix/media)
#}
{% if matrix_media_repo_container_labels_traefik_internal_media_enabled %}
traefik.http.routers.matrix-media-repo-internal-media.rule={{ matrix_media_repo_container_labels_traefik_internal_media_rule }}
{% if matrix_media_repo_container_labels_traefik_internal_media_priority | int > 0 %}
traefik.http.routers.matrix-media-repo-internal-media.priority={{ matrix_media_repo_container_labels_traefik_internal_media_priority }}
{% endif %}
{% if middlewares | length > 0 %}
traefik.http.routers.matrix-media-repo-internal-media.middlewares={{ middlewares | join(',') }}
{% endif %}
traefik.http.routers.matrix-media-repo-internal-media.service=matrix-media-repo
traefik.http.routers.matrix-media-repo-internal-media.entrypoints={{ matrix_media_repo_container_labels_traefik_internal_media_entrypoints }}
{% endif %}
{#
/Internal Media (/_matrix/media)
#}
{#
Public Client Logout (/_matrix/client/r0/logout, /_matrix/client/r0/logout/all)
#}