Move matrix-bridge-mautrix-signal to its own container network and add native Traefik support

This commit is contained in:
Slavi Pantaleev 2024-01-07 17:15:58 +02:00
parent 7ec6fd3dfe
commit d6911503a0
12 changed files with 144 additions and 73 deletions

View File

@ -1154,6 +1154,13 @@ matrix_mautrix_hangouts_database_password: "{{ '%s' | format(matrix_homeserver_g
# We don't enable bridges by default. # We don't enable bridges by default.
matrix_mautrix_instagram_enabled: false matrix_mautrix_instagram_enabled: false
matrix_mautrix_instagram_systemd_required_services_list_auto: |
{{
matrix_addons_homeserver_systemd_services_list
+
([devture_postgres_identifier ~ '.service'] if (devture_postgres_enabled and matrix_mautrix_instagram_database_hostname == devture_postgres_connection_hostname) else [])
}}
matrix_mautrix_instagram_container_image_self_build: "{{ matrix_architecture not in ['amd64', 'arm64'] }}" matrix_mautrix_instagram_container_image_self_build: "{{ matrix_architecture not in ['amd64', 'arm64'] }}"
matrix_mautrix_instagram_container_network: "{{ matrix_addons_container_network }}" matrix_mautrix_instagram_container_network: "{{ matrix_addons_container_network }}"
@ -1163,7 +1170,7 @@ matrix_mautrix_instagram_container_additional_networks_auto: |-
( (
([] if matrix_addons_homeserver_container_network == '' else [matrix_addons_homeserver_container_network]) ([] if matrix_addons_homeserver_container_network == '' else [matrix_addons_homeserver_container_network])
+ +
([devture_postgres_container_network] if devture_postgres_enabled and matrix_mautrix_instagram_database_hostname == devture_postgres_connection_hostname else []) ([devture_postgres_container_network] if (devture_postgres_enabled and matrix_mautrix_instagram_database_hostname == devture_postgres_connection_hostname and matrix_mautrix_instagram_container_network != devture_postgres_container_network) else [])
+ +
([matrix_playbook_reverse_proxyable_services_additional_network] if matrix_playbook_reverse_proxyable_services_additional_network and matrix_mautrix_instagram_container_labels_traefik_enabled else []) ([matrix_playbook_reverse_proxyable_services_additional_network] if matrix_playbook_reverse_proxyable_services_additional_network and matrix_mautrix_instagram_container_labels_traefik_enabled else [])
) | unique ) | unique
@ -1177,17 +1184,9 @@ matrix_mautrix_instagram_container_labels_traefik_tls_certResolver: "{{ devture_
matrix_mautrix_instagram_container_labels_metrics_middleware_basic_auth_enabled: "{{ matrix_metrics_exposure_http_basic_auth_enabled }}" matrix_mautrix_instagram_container_labels_metrics_middleware_basic_auth_enabled: "{{ matrix_metrics_exposure_http_basic_auth_enabled }}"
matrix_mautrix_instagram_container_labels_metrics_middleware_basic_auth_users: "{{ matrix_metrics_exposure_http_basic_auth_users }}" matrix_mautrix_instagram_container_labels_metrics_middleware_basic_auth_users: "{{ matrix_metrics_exposure_http_basic_auth_users }}"
matrix_mautrix_instagram_systemd_required_services_list_auto: |
{{
matrix_addons_homeserver_systemd_services_list
+
([devture_postgres_identifier ~ '.service'] if devture_postgres_enabled and matrix_mautrix_instagram_database_hostname == devture_postgres_connection_hostname else [])
}}
matrix_mautrix_instagram_appservice_token: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'ig.as.token', rounds=655555) | to_uuid }}" matrix_mautrix_instagram_appservice_token: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'ig.as.token', rounds=655555) | to_uuid }}"
matrix_mautrix_instagram_homeserver_address: "{{ matrix_addons_homeserver_client_api_url }}" matrix_mautrix_instagram_homeserver_address: "{{ matrix_addons_homeserver_client_api_url }}"
matrix_mautrix_instagram_homeserver_token: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'ig.hs.token', rounds=655555) | to_uuid }}" matrix_mautrix_instagram_homeserver_token: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'ig.hs.token', rounds=655555) | to_uuid }}"
matrix_mautrix_instagram_login_shared_secret: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret if matrix_synapse_ext_password_provider_shared_secret_auth_enabled else '' }}" matrix_mautrix_instagram_login_shared_secret: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret if matrix_synapse_ext_password_provider_shared_secret_auth_enabled else '' }}"
@ -1221,23 +1220,38 @@ matrix_mautrix_instagram_database_password: "{{ '%s' | format(matrix_homeserver_
# We don't enable bridges by default. # We don't enable bridges by default.
matrix_mautrix_signal_enabled: false matrix_mautrix_signal_enabled: false
matrix_mautrix_signal_container_image_self_build: "{{ matrix_architecture not in ['arm64', 'amd64'] }}" matrix_mautrix_signal_systemd_required_services_list_auto: |
matrix_mautrix_signal_systemd_required_services_list: |
{{ {{
['docker.service'] matrix_addons_homeserver_systemd_services_list
+ +
['matrix-' + matrix_homeserver_implementation + '.service'] ([devture_postgres_identifier ~ '.service'] if (devture_postgres_enabled and matrix_mautrix_signal_database_hostname == devture_postgres_connection_hostname) else [])
+
([devture_postgres_identifier ~ '.service'] if devture_postgres_enabled else [])
+
(['matrix-nginx-proxy.service'] if matrix_nginx_proxy_enabled else [])
}} }}
matrix_mautrix_signal_container_image_self_build: "{{ matrix_architecture not in ['arm64', 'amd64'] }}"
matrix_mautrix_signal_container_network: "{{ matrix_addons_container_network }}"
matrix_mautrix_signal_container_additional_networks_auto: |-
{{
(
([] if matrix_addons_homeserver_container_network == '' else [matrix_addons_homeserver_container_network])
+
([devture_postgres_container_network] if (devture_postgres_enabled and matrix_mautrix_signal_database_hostname == devture_postgres_connection_hostname and matrix_mautrix_signal_container_network != devture_postgres_container_network) else [])
+
([matrix_playbook_reverse_proxyable_services_additional_network] if matrix_playbook_reverse_proxyable_services_additional_network and matrix_mautrix_signal_container_labels_traefik_enabled else [])
) | unique
}}
matrix_mautrix_signal_container_labels_traefik_enabled: "{{ matrix_playbook_reverse_proxy_type in ['playbook-managed-traefik', 'other-traefik-container'] }}"
matrix_mautrix_signal_container_labels_traefik_docker_network: "{{ matrix_playbook_reverse_proxyable_services_additional_network }}"
matrix_mautrix_signal_container_labels_traefik_entrypoints: "{{ devture_traefik_entrypoint_primary }}"
matrix_mautrix_signal_container_labels_traefik_tls_certResolver: "{{ devture_traefik_certResolver_primary }}"
matrix_mautrix_signal_container_labels_metrics_middleware_basic_auth_enabled: "{{ matrix_metrics_exposure_http_basic_auth_enabled }}"
matrix_mautrix_signal_container_labels_metrics_middleware_basic_auth_users: "{{ matrix_metrics_exposure_http_basic_auth_users }}"
matrix_mautrix_signal_homeserver_domain: '{{ matrix_domain }}' matrix_mautrix_signal_homeserver_domain: '{{ matrix_domain }}'
matrix_mautrix_signal_homeserver_address: "{{ matrix_addons_homeserver_client_api_url }}" matrix_mautrix_signal_homeserver_address: "{{ matrix_addons_homeserver_client_api_url }}"
matrix_mautrix_signal_homeserver_token: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'si.hs.token', rounds=655555) | to_uuid }}" matrix_mautrix_signal_homeserver_token: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'si.hs.token', rounds=655555) | to_uuid }}"
matrix_mautrix_signal_appservice_token: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'si.as.token', rounds=655555) | to_uuid }}" matrix_mautrix_signal_appservice_token: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'si.as.token', rounds=655555) | to_uuid }}"
@ -1246,7 +1260,9 @@ matrix_mautrix_signal_login_shared_secret: "{{ matrix_synapse_ext_password_provi
matrix_mautrix_signal_metrics_enabled: "{{ prometheus_enabled }}" matrix_mautrix_signal_metrics_enabled: "{{ prometheus_enabled }}"
# TODO - add support for exposing metrics matrix_mautrix_signal_metrics_proxying_enabled: "{{ matrix_mautrix_signal_metrics_enabled and matrix_metrics_exposure_enabled }}"
matrix_mautrix_signal_metrics_proxying_hostname: "{{ matrix_metrics_exposure_hostname }}"
matrix_mautrix_signal_metrics_proxying_path_prefix: "{{ matrix_metrics_exposure_path_prefix }}/mautrix-signal"
matrix_mautrix_signal_database_engine: "{{ 'postgres' if devture_postgres_enabled else 'sqlite' }}" matrix_mautrix_signal_database_engine: "{{ 'postgres' if devture_postgres_enabled else 'sqlite' }}"
matrix_mautrix_signal_database_hostname: "{{ devture_postgres_connection_hostname if devture_postgres_enabled else '' }}" matrix_mautrix_signal_database_hostname: "{{ devture_postgres_connection_hostname if devture_postgres_enabled else '' }}"

View File

@ -38,7 +38,6 @@ matrix_mautrix_instagram_container_additional_networks: "{{ matrix_mautrix_insta
matrix_mautrix_instagram_container_additional_networks_auto: [] matrix_mautrix_instagram_container_additional_networks_auto: []
matrix_mautrix_instagram_container_additional_networks_custom: [] matrix_mautrix_instagram_container_additional_networks_custom: []
# matrix_mautrix_instagram_container_labels_traefik_enabled controls whether labels to assist a Traefik reverse-proxy will be attached to the container. # matrix_mautrix_instagram_container_labels_traefik_enabled controls whether labels to assist a Traefik reverse-proxy will be attached to the container.
# See `../templates/labels.j2` for details. # See `../templates/labels.j2` for details.
# #

View File

@ -8,4 +8,7 @@
- {'name': 'matrix_mautrix_instagram_appservice_token', when: true} - {'name': 'matrix_mautrix_instagram_appservice_token', when: true}
- {'name': 'matrix_mautrix_instagram_homeserver_address', when: true} - {'name': 'matrix_mautrix_instagram_homeserver_address', when: true}
- {'name': 'matrix_mautrix_instagram_homeserver_token', when: true} - {'name': 'matrix_mautrix_instagram_homeserver_token', when: true}
- {'name': 'matrix_mautrix_instagram_container_network', when: true}
- {'name': 'matrix_mautrix_instagram_database_hostname', when: "{{ matrix_mautrix_instagram_database_engine == 'postgres' }}"} - {'name': 'matrix_mautrix_instagram_database_hostname', when: "{{ matrix_mautrix_instagram_database_engine == 'postgres' }}"}
- {'name': 'matrix_mautrix_instagram_metrics_proxying_hostname', when: "{{ matrix_mautrix_instagram_metrics_proxying_enabled }}"}
- {'name': 'matrix_mautrix_instagram_metrics_proxying_path_prefix', when: "{{ matrix_mautrix_instagram_metrics_proxying_enabled }}"}

View File

@ -28,6 +28,7 @@ ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
--network={{ matrix_mautrix_instagram_container_network }} \ --network={{ matrix_mautrix_instagram_container_network }} \
--mount type=bind,src={{ matrix_mautrix_instagram_config_path }},dst=/config \ --mount type=bind,src={{ matrix_mautrix_instagram_config_path }},dst=/config \
--mount type=bind,src={{ matrix_mautrix_instagram_data_path }},dst=/data \ --mount type=bind,src={{ matrix_mautrix_instagram_data_path }},dst=/data \
--label-file={{ matrix_mautrix_instagram_base_path }}/labels \
{% for arg in matrix_mautrix_instagram_container_extra_arguments %} {% for arg in matrix_mautrix_instagram_container_extra_arguments %}
{{ arg }} \ {{ arg }} \
{% endfor %} {% endfor %}

View File

@ -40,11 +40,49 @@ matrix_mautrix_signal_bridge_relay_enabled: "{{ matrix_bridges_relay_enabled }}"
# Only allow admins on this home server to set themselves as a relay user # Only allow admins on this home server to set themselves as a relay user
matrix_mautrix_signal_bridge_relay_admin_only: true matrix_mautrix_signal_bridge_relay_admin_only: true
matrix_mautrix_signal_container_network: ""
matrix_mautrix_signal_container_additional_networks: "{{ matrix_mautrix_signal_container_additional_networks_auto + matrix_mautrix_signal_container_additional_networks_custom }}"
matrix_mautrix_signal_container_additional_networks_auto: []
matrix_mautrix_signal_container_additional_networks_custom: []
# matrix_mautrix_signal_container_labels_traefik_enabled controls whether labels to assist a Traefik reverse-proxy will be attached to the container.
# See `../templates/labels.j2` for details.
#
# To inject your own other container labels, see `matrix_mautrix_signal_container_labels_additional_labels`.
matrix_mautrix_signal_container_labels_traefik_enabled: true
matrix_mautrix_signal_container_labels_traefik_docker_network: "{{ matrix_mautrix_signal_container_network }}"
matrix_mautrix_signal_container_labels_traefik_entrypoints: web-secure
matrix_mautrix_signal_container_labels_traefik_tls_certResolver: default # noqa var-naming
# Controls whether labels will be added that expose mautrix-instagram's metrics
matrix_mautrix_signal_container_labels_metrics_enabled: "{{ matrix_mautrix_signal_metrics_enabled and matrix_mautrix_signal_metrics_proxying_enabled }}"
matrix_mautrix_signal_container_labels_metrics_traefik_rule: "Host(`{{ matrix_mautrix_signal_metrics_proxying_hostname }}`) && PathPrefix(`{{ matrix_mautrix_signal_metrics_proxying_path_prefix }}`)"
matrix_mautrix_signal_container_labels_metrics_traefik_priority: 0
matrix_mautrix_signal_container_labels_metrics_traefik_entrypoints: "{{ matrix_mautrix_signal_container_labels_traefik_entrypoints }}"
matrix_mautrix_signal_container_labels_metrics_traefik_tls: "{{ matrix_mautrix_signal_container_labels_metrics_traefik_entrypoints != 'web' }}"
matrix_mautrix_signal_container_labels_metrics_traefik_tls_certResolver: "{{ matrix_mautrix_signal_container_labels_traefik_tls_certResolver }}" # noqa var-naming
matrix_mautrix_signal_container_labels_metrics_middleware_basic_auth_enabled: false
# See: https://doc.traefik.io/traefik/middlewares/http/basicauth/#users
matrix_mautrix_signal_container_labels_metrics_middleware_basic_auth_users: ''
# matrix_mautrix_signal_container_labels_additional_labels contains a multiline string with additional labels to add to the container label file.
# See `../templates/labels.j2` for details.
#
# Example:
# matrix_mautrix_signal_container_labels_additional_labels: |
# my.label=1
# another.label="here"
matrix_mautrix_signal_container_labels_additional_labels: ''
# A list of extra arguments to pass to the container # A list of extra arguments to pass to the container
matrix_mautrix_signal_container_extra_arguments: [] matrix_mautrix_signal_container_extra_arguments: []
# List of systemd services that matrix-mautrix-signal.service depends on. # List of systemd services that matrix-mautrix-signal.service depends on.
matrix_mautrix_signal_systemd_required_services_list: ['docker.service'] matrix_mautrix_signal_systemd_required_services_list: "{{ matrix_mautrix_signal_systemd_required_services_list_default + matrix_mautrix_signal_systemd_required_services_list_auto + matrix_mautrix_signal_systemd_required_services_list_custom }}"
matrix_mautrix_signal_systemd_required_services_list_default: ['docker.service']
matrix_mautrix_signal_systemd_required_services_list_auto: []
matrix_mautrix_signal_systemd_required_services_list_custom: []
# List of systemd services that matrix-mautrix-signal.service wants # List of systemd services that matrix-mautrix-signal.service wants
matrix_mautrix_signal_systemd_wanted_services_list: [] matrix_mautrix_signal_systemd_wanted_services_list: []
@ -67,9 +105,10 @@ matrix_mautrix_signal_federate_rooms: true
# If metrics need to be consumed by another (external) Prometheus server, consider exposing them via `matrix_mautrix_signal_metrics_proxying_enabled`. # If metrics need to be consumed by another (external) Prometheus server, consider exposing them via `matrix_mautrix_signal_metrics_proxying_enabled`.
matrix_mautrix_signal_metrics_enabled: false matrix_mautrix_signal_metrics_enabled: false
# Controls whether metrics should be proxied (exposed) on a public URL. # Controls whether metrics should be exposed on a public URL.
matrix_mautrix_signal_metrics_proxying_enabled: false matrix_mautrix_signal_metrics_proxying_enabled: false
# TODO - add more variables for controlling the hostname, path prefix, etc. matrix_mautrix_signal_metrics_proxying_hostname: ''
matrix_mautrix_signal_metrics_proxying_path_prefix: ''
# Database-related configuration fields. # Database-related configuration fields.
# #

View File

@ -1,35 +0,0 @@
---
- name: Fail if matrix-nginx-proxy role already executed
ansible.builtin.fail:
msg: >-
Trying to append mautrix-signal-metrics's reverse-proxying configuration to matrix-nginx-proxy,
but it's pointless since the matrix-nginx-proxy role had already executed.
To fix this, please change the order of roles in your playbook,
so that the matrix-nginx-proxy role would run after the matrix-bridge-mautrix-signal role.
when: matrix_nginx_proxy_role_executed | default(False) | bool
- when: matrix_mautrix_signal_metrics_proxying_enabled | bool
block:
- name: Generate mautrix-signal metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-signal)
ansible.builtin.set_fact:
matrix_mautrix_signal_nginx_metrics_configuration_block: |
location /metrics/mautrix-signal {
{% if matrix_nginx_proxy_enabled | default(False) %}
{# Use the embedded DNS resolver in Docker containers to discover the service #}
resolver 127.0.0.11 valid=5s;
set $backend "matrix-mautrix-signal:8001";
proxy_pass http://$backend/metrics;
{% else %}
return 404 "matrix-nginx-proxy is disabled and no host port was bound to the container, so metrics are unavailable";
{% endif %}
}
- name: Register mautrix-signal metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-signal)
ansible.builtin.set_fact:
matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: |
{{
matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks | default([])
+
[matrix_mautrix_signal_nginx_metrics_configuration_block]
}}

View File

@ -8,15 +8,6 @@
block: block:
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/remove_legacy.yml" - ansible.builtin.include_tasks: "{{ role_path }}/tasks/remove_legacy.yml"
- tags:
- setup-all
- setup-nginx-proxy
- install-all
- install-nginx-proxy
block:
- when: matrix_mautrix_signal_enabled | bool and matrix_mautrix_signal_metrics_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/inject_into_nginx_proxy.yml"
- tags: - tags:
- setup-all - setup-all
- setup-mautrix-signal - setup-mautrix-signal

View File

@ -126,6 +126,21 @@
owner: "{{ matrix_user_username }}" owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
- name: Ensure mautrix-signal support files installed
ansible.builtin.template:
src: "{{ role_path }}/templates/{{ item }}.j2"
dest: "{{ matrix_mautrix_signal_base_path }}/{{ item }}"
mode: 0640
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
with_items:
- labels
- name: Ensure matrix-mautrix-signal container network is created
community.general.docker_network:
name: "{{ matrix_mautrix_signal_container_network }}"
driver: bridge
- name: Ensure matrix-mautrix-signal.service installed - name: Ensure matrix-mautrix-signal.service installed
ansible.builtin.template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-mautrix-signal.service.j2" src: "{{ role_path }}/templates/systemd/matrix-mautrix-signal.service.j2"

View File

@ -10,6 +10,9 @@
- {'name': 'matrix_mautrix_signal_homeserver_address', when: true} - {'name': 'matrix_mautrix_signal_homeserver_address', when: true}
- {'name': 'matrix_mautrix_signal_homeserver_token', when: true} - {'name': 'matrix_mautrix_signal_homeserver_token', when: true}
- {'name': 'matrix_mautrix_signal_database_hostname', when: "{{ matrix_mautrix_signal_database_engine == 'postgres' }}"} - {'name': 'matrix_mautrix_signal_database_hostname', when: "{{ matrix_mautrix_signal_database_engine == 'postgres' }}"}
- {'name': 'matrix_mautrix_signal_container_network', when: true}
- {'name': 'matrix_mautrix_signal_metrics_proxying_hostname', when: "{{ matrix_mautrix_signal_metrics_proxying_enabled }}"}
- {'name': 'matrix_mautrix_signal_metrics_proxying_path_prefix', when: "{{ matrix_mautrix_signal_metrics_proxying_enabled }}"}
- name: (Deprecation) Catch and report renamed settings - name: (Deprecation) Catch and report renamed settings
ansible.builtin.fail: ansible.builtin.fail:

View File

@ -80,9 +80,9 @@ appservice:
# Prometheus config. # Prometheus config.
metrics: metrics:
# Enable prometheus metrics? # Enable prometheus metrics?
enabled: false enabled: {{ matrix_mautrix_signal_metrics_enabled | to_json }}
# IP and port where the metrics listener should be. The path is always /metrics # IP and port where the metrics listener should be. The path is always /metrics
listen: 127.0.0.1:8000 listen: 0.0.0.0:8000
# Bridge config # Bridge config
bridge: bridge:

View File

@ -0,0 +1,30 @@
{% if matrix_mautrix_signal_container_labels_traefik_enabled %}
traefik.enable=true
{% if matrix_mautrix_signal_container_labels_traefik_docker_network %}
traefik.docker.network={{ matrix_mautrix_signal_container_labels_traefik_docker_network }}
{% endif %}
{# Metrics #}
{% if matrix_mautrix_signal_container_labels_metrics_enabled %}
traefik.http.routers.matrix-mautrix-signal-metrics.rule={{ matrix_mautrix_signal_container_labels_metrics_traefik_rule }}
{% if matrix_mautrix_signal_container_labels_metrics_traefik_priority | int > 0 %}
traefik.http.routers.matrix-mautrix-signal-metrics.priority={{ matrix_mautrix_signal_container_labels_metrics_traefik_priority }}
{% endif %}
traefik.http.routers.matrix-mautrix-signal-metrics.service=matrix-mautrix-signal-metrics
traefik.http.routers.matrix-mautrix-signal-metrics.entrypoints={{ matrix_mautrix_signal_container_labels_metrics_traefik_entrypoints }}
traefik.http.routers.matrix-mautrix-signal-metrics.tls={{ matrix_mautrix_signal_container_labels_metrics_traefik_tls | to_json }}
{% if matrix_mautrix_signal_container_labels_metrics_traefik_tls %}
traefik.http.routers.matrix-mautrix-signal-metrics.tls.certResolver={{ matrix_mautrix_signal_container_labels_metrics_traefik_tls_certResolver }}
{% endif %}
{% if matrix_mautrix_signal_container_labels_metrics_middleware_basic_auth_enabled %}
traefik.http.routers.matrix-mautrix-signal-metrics.middlewares=matrix-mautrix-signal-metrics-basic-auth
traefik.http.middlewares.matrix-mautrix-signal-metrics-basic-auth.basicauth.users={{ matrix_mautrix_signal_container_labels_metrics_middleware_basic_auth_users }}
{% endif %}
traefik.http.services.matrix-mautrix-signal-metrics.loadbalancer.server.port=8000
{% endif %}
{% endif %}
{{ matrix_mautrix_signal_container_labels_additional_labels }}

View File

@ -19,13 +19,16 @@ ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_s
# Intentional delay, so that the homeserver (we likely depend on) can manage to start. # Intentional delay, so that the homeserver (we likely depend on) can manage to start.
ExecStartPre={{ matrix_host_command_sleep }} 5 ExecStartPre={{ matrix_host_command_sleep }} 5
ExecStart={{ devture_systemd_docker_base_host_command_docker }} run --rm --name matrix-mautrix-signal \ ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
--rm \
--name=matrix-mautrix-signal \
--log-driver=none \ --log-driver=none \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
--cap-drop=ALL \ --cap-drop=ALL \
--network={{ matrix_docker_network }} \ --network={{ matrix_mautrix_signal_container_network }} \
--mount type=bind,src={{ matrix_mautrix_signal_config_path }},dst=/config,ro \ --mount type=bind,src={{ matrix_mautrix_signal_config_path }},dst=/config,ro \
--mount type=bind,src={{ matrix_mautrix_signal_data_path }},dst=/data \ --mount type=bind,src={{ matrix_mautrix_signal_data_path }},dst=/data \
--label-file={{ matrix_mautrix_signal_base_path }}/labels \
--workdir=/data \ --workdir=/data \
{% for arg in matrix_mautrix_signal_container_extra_arguments %} {% for arg in matrix_mautrix_signal_container_extra_arguments %}
{{ arg }} \ {{ arg }} \
@ -33,6 +36,12 @@ ExecStart={{ devture_systemd_docker_base_host_command_docker }} run --rm --name
{{ matrix_mautrix_signal_docker_image }} \ {{ matrix_mautrix_signal_docker_image }} \
/usr/bin/mautrix-signal -c /config/config.yaml -r /config/registration.yaml --no-update /usr/bin/mautrix-signal -c /config/config.yaml -r /config/registration.yaml --no-update
{% for network in matrix_mautrix_signal_container_additional_networks %}
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-mautrix-signal
{% endfor %}
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-mautrix-signal
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-mautrix-signal 2>/dev/null || true' ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-mautrix-signal 2>/dev/null || true'
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-mautrix-signal 2>/dev/null || true' ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-mautrix-signal 2>/dev/null || true'
Restart=always Restart=always