mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2026-06-30 15:31:18 +00:00
mautrix-meta-messenger: expose bridge HTTP API (for mautrix-manager and similar)
Auto-generate the provisioning shared secret (to enable the provisioning API), route the whole bridge HTTP port via Traefik under `<matrix-fqn>/bridges/meta-messenger`, and populate appservice.public_address, reusing the matrix_bridges_exposure_* mechanism. The labels template gate is widened so the exposure router is emitted even when metrics are disabled (the exposure router reuses the existing appservice Traefik service on port 29319). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -197,7 +197,7 @@ appservice:
|
||||
address: {{ matrix_mautrix_meta_messenger_appservice_address | to_json }}
|
||||
# A public address that external services can use to reach this appservice.
|
||||
# This value doesn't affect the registration file.
|
||||
public_address: https://bridge.example.com
|
||||
public_address: {{ matrix_mautrix_meta_messenger_bridge_public_address | to_json }}
|
||||
|
||||
# The hostname and port where this appservice should listen.
|
||||
# For Docker, you generally have to change the hostname to 0.0.0.0.
|
||||
|
||||
@@ -4,15 +4,19 @@ SPDX-FileCopyrightText: 2024 Slavi Pantaleev
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#}
|
||||
|
||||
{% if matrix_mautrix_meta_messenger_container_labels_traefik_enabled and matrix_mautrix_meta_messenger_container_labels_metrics_enabled %}
|
||||
{% if matrix_mautrix_meta_messenger_container_labels_traefik_enabled and (matrix_mautrix_meta_messenger_container_labels_metrics_enabled or matrix_mautrix_meta_messenger_container_labels_exposure_enabled) %}
|
||||
traefik.enable=true
|
||||
|
||||
{% if matrix_mautrix_meta_messenger_container_labels_traefik_docker_network %}
|
||||
traefik.docker.network={{ matrix_mautrix_meta_messenger_container_labels_traefik_docker_network }}
|
||||
{% endif %}
|
||||
|
||||
{% if matrix_mautrix_meta_messenger_container_labels_exposure_enabled %}
|
||||
traefik.http.services.{{ matrix_mautrix_meta_messenger_identifier }}-appservice.loadbalancer.server.port=29319
|
||||
{% endif %}
|
||||
{% if matrix_mautrix_meta_messenger_container_labels_metrics_enabled %}
|
||||
traefik.http.services.{{ matrix_mautrix_meta_messenger_identifier }}-metrics.loadbalancer.server.port=8000
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if matrix_mautrix_meta_messenger_container_labels_metrics_enabled %}
|
||||
@@ -48,6 +52,37 @@ traefik.http.routers.{{ matrix_mautrix_meta_messenger_identifier }}-metrics.tls.
|
||||
############################################################
|
||||
{% endif %}
|
||||
|
||||
{% if matrix_mautrix_meta_messenger_container_labels_exposure_enabled %}
|
||||
############################################################
|
||||
# #
|
||||
# Bridge API exposure #
|
||||
# #
|
||||
############################################################
|
||||
|
||||
traefik.http.middlewares.{{ matrix_mautrix_meta_messenger_identifier }}-exposure-strip-prefix.stripprefix.prefixes={{ matrix_mautrix_meta_messenger_exposure_path_prefix }}
|
||||
traefik.http.routers.{{ matrix_mautrix_meta_messenger_identifier }}-exposure.middlewares={{ matrix_mautrix_meta_messenger_identifier }}-exposure-strip-prefix
|
||||
|
||||
traefik.http.routers.{{ matrix_mautrix_meta_messenger_identifier }}-exposure.rule={{ matrix_mautrix_meta_messenger_container_labels_exposure_traefik_rule }}
|
||||
|
||||
{% if matrix_mautrix_meta_messenger_container_labels_exposure_traefik_priority | int > 0 %}
|
||||
traefik.http.routers.{{ matrix_mautrix_meta_messenger_identifier }}-exposure.priority={{ matrix_mautrix_meta_messenger_container_labels_exposure_traefik_priority }}
|
||||
{% endif %}
|
||||
|
||||
traefik.http.routers.{{ matrix_mautrix_meta_messenger_identifier }}-exposure.service={{ matrix_mautrix_meta_messenger_identifier }}-appservice
|
||||
traefik.http.routers.{{ matrix_mautrix_meta_messenger_identifier }}-exposure.entrypoints={{ matrix_mautrix_meta_messenger_container_labels_exposure_traefik_entrypoints }}
|
||||
|
||||
traefik.http.routers.{{ matrix_mautrix_meta_messenger_identifier }}-exposure.tls={{ matrix_mautrix_meta_messenger_container_labels_exposure_traefik_tls | to_json }}
|
||||
{% if matrix_mautrix_meta_messenger_container_labels_exposure_traefik_tls %}
|
||||
traefik.http.routers.{{ matrix_mautrix_meta_messenger_identifier }}-exposure.tls.certResolver={{ matrix_mautrix_meta_messenger_container_labels_exposure_traefik_tls_certResolver }}
|
||||
{% endif %}
|
||||
|
||||
############################################################
|
||||
# #
|
||||
# /Bridge API exposure #
|
||||
# #
|
||||
############################################################
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user