diff --git a/docs/configuring-playbook-bridge-imessage-rustpush.md b/docs/configuring-playbook-bridge-rustpush.md similarity index 94% rename from docs/configuring-playbook-bridge-imessage-rustpush.md rename to docs/configuring-playbook-bridge-rustpush.md index 3db2e5250..b92c98df0 100644 --- a/docs/configuring-playbook-bridge-imessage-rustpush.md +++ b/docs/configuring-playbook-bridge-rustpush.md @@ -4,7 +4,7 @@ SPDX-FileCopyrightText: 2025 MDAD project contributors SPDX-License-Identifier: AGPL-3.0-or-later --> -# Setting up iMessage RustPush bridging (optional) +# Setting up RustPush bridging (optional) Refer the common guide for configuring mautrix bridges: [Setting up a Generic Mautrix Bridge](configuring-playbook-bridge-mautrix-bridges.md) @@ -33,7 +33,7 @@ See [this section](configuring-playbook-bridge-mautrix-bridges.md#set-up-double- To enable the bridge, add the following configuration to your `inventory/host_vars/matrix.example.com/vars.yml` file: ```yaml -matrix_imessage_rustpush_enabled: true +matrix_rustpush_bridge_enabled: true ``` ### Backfill (optional) @@ -41,8 +41,8 @@ matrix_imessage_rustpush_enabled: true Backfill is disabled by default because Linux Docker cannot access the macOS `chat.db` file. If you are running on macOS with Full Disk Access, you can enable it: ```yaml -matrix_imessage_rustpush_backfill_enabled: true -matrix_imessage_rustpush_initial_sync_days: 365 +matrix_rustpush_bridge_backfill_enabled: true +matrix_rustpush_bridge_initial_sync_days: 365 ``` ### Extending the configuration @@ -81,7 +81,7 @@ After logging in, the bridge will start receiving iMessages and creating portal ## Troubleshooting -As with all other services, you can find the logs in [systemd-journald](https://www.freedesktop.org/software/systemd/man/systemd-journald.service.html) by logging in to the server with SSH and running `journalctl -fu matrix-imessage-rustpush`. +As with all other services, you can find the logs in [systemd-journald](https://www.freedesktop.org/software/systemd/man/systemd-journald.service.html) by logging in to the server with SSH and running `journalctl -fu matrix-rustpush-bridge`. ### Increase logging verbosity @@ -89,5 +89,5 @@ The default logging level for this component is `warn`. If you want to increase ```yaml # Valid values: fatal, error, warn, info, debug, trace -matrix_imessage_rustpush_logging_level: 'debug' +matrix_rustpush_bridge_logging_level: 'debug' ``` diff --git a/docs/configuring-playbook-bridge-imessage-rustpush.md.license b/docs/configuring-playbook-bridge-rustpush.md.license similarity index 100% rename from docs/configuring-playbook-bridge-imessage-rustpush.md.license rename to docs/configuring-playbook-bridge-rustpush.md.license diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 9269b15f4..7bdb2e1ac 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -114,7 +114,7 @@ matrix_homeserver_container_extra_arguments_auto: | + (['--mount type=bind,src=' + matrix_mautrix_bluesky_config_path + '/registration.yaml,dst=/matrix-mautrix-bluesky-registration.yaml,ro'] if matrix_mautrix_bluesky_enabled else []) + - (['--mount type=bind,src=' + matrix_imessage_rustpush_config_path + '/registration.yaml,dst=/matrix-imessage-rustpush-registration.yaml,ro'] if matrix_imessage_rustpush_enabled else []) + (['--mount type=bind,src=' + matrix_rustpush_bridge_config_path + '/registration.yaml,dst=/matrix-rustpush-bridge-registration.yaml,ro'] if matrix_rustpush_bridge_enabled else []) + (['--mount type=bind,src=' + matrix_mautrix_discord_config_path + '/registration.yaml,dst=/matrix-mautrix-discord-registration.yaml,ro'] if matrix_mautrix_discord_enabled else []) + @@ -173,7 +173,7 @@ matrix_homeserver_app_service_config_files_auto: | + (['/matrix-mautrix-bluesky-registration.yaml'] if matrix_mautrix_bluesky_enabled else []) + - (['/matrix-imessage-rustpush-registration.yaml'] if matrix_imessage_rustpush_enabled else []) + (['/matrix-rustpush-bridge-registration.yaml'] if matrix_rustpush_bridge_enabled else []) + (['/matrix-mautrix-discord-registration.yaml'] if matrix_mautrix_discord_enabled else []) + @@ -441,11 +441,11 @@ devture_systemd_service_manager_services_list_auto: | }] if matrix_mautrix_bluesky_enabled else []) + ([{ - 'name': 'matrix-imessage-rustpush.service', + 'name': 'matrix-rustpush-bridge.service', 'priority': 2000, - 'restart_necessary': (matrix_imessage_rustpush_restart_necessary | bool), - 'groups': ['matrix', 'bridges', 'imessage-rustpush'], - }] if matrix_imessage_rustpush_enabled else []) + 'restart_necessary': (matrix_rustpush_bridge_restart_necessary | bool), + 'groups': ['matrix', 'bridges', 'matrix-rustpush-bridge'], + }] if matrix_rustpush_bridge_enabled else []) + ([{ 'name': 'matrix-mautrix-discord.service', @@ -1483,71 +1483,71 @@ matrix_mautrix_bluesky_database_password: "{{ (matrix_homeserver_generic_secret_ ###################################################################### # -# matrix-bridge-imessage-rustpush +# matrix-bridge-rustpush # ###################################################################### # We don't enable bridges by default. -matrix_imessage_rustpush_enabled: false +matrix_rustpush_bridge_enabled: false -matrix_imessage_rustpush_systemd_required_services_list_auto: | +matrix_rustpush_bridge_systemd_required_services_list_auto: | {{ matrix_addons_homeserver_systemd_services_list + - ([postgres_identifier ~ '.service'] if (postgres_enabled and matrix_imessage_rustpush_database_hostname == postgres_connection_hostname) else []) + ([postgres_identifier ~ '.service'] if (postgres_enabled and matrix_rustpush_bridge_database_hostname == postgres_connection_hostname) else []) }} -matrix_imessage_rustpush_container_network: "{{ matrix_addons_container_network }}" +matrix_rustpush_bridge_container_network: "{{ matrix_addons_container_network }}" -matrix_imessage_rustpush_container_additional_networks_auto: |- +matrix_rustpush_bridge_container_additional_networks_auto: |- {{ ( ([] if matrix_addons_homeserver_container_network == '' else [matrix_addons_homeserver_container_network]) + - ([postgres_container_network] if (postgres_enabled and matrix_imessage_rustpush_database_hostname == postgres_connection_hostname and matrix_imessage_rustpush_container_network != postgres_container_network) else []) + ([postgres_container_network] if (postgres_enabled and matrix_rustpush_bridge_database_hostname == postgres_connection_hostname and matrix_rustpush_bridge_container_network != postgres_container_network) else []) + - ([matrix_playbook_reverse_proxyable_services_additional_network] if matrix_playbook_reverse_proxyable_services_additional_network and matrix_imessage_rustpush_container_labels_traefik_enabled else []) + ([matrix_playbook_reverse_proxyable_services_additional_network] if matrix_playbook_reverse_proxyable_services_additional_network and matrix_rustpush_bridge_container_labels_traefik_enabled else []) ) | unique }} -matrix_imessage_rustpush_container_labels_traefik_enabled: "{{ matrix_playbook_reverse_proxy_type in ['playbook-managed-traefik', 'other-traefik-container'] }}" -matrix_imessage_rustpush_container_labels_traefik_docker_network: "{{ matrix_playbook_reverse_proxyable_services_additional_network }}" -matrix_imessage_rustpush_container_labels_traefik_entrypoints: "{{ traefik_entrypoint_primary }}" -matrix_imessage_rustpush_container_labels_traefik_tls_certResolver: "{{ traefik_certResolver_primary }}" +matrix_rustpush_bridge_container_labels_traefik_enabled: "{{ matrix_playbook_reverse_proxy_type in ['playbook-managed-traefik', 'other-traefik-container'] }}" +matrix_rustpush_bridge_container_labels_traefik_docker_network: "{{ matrix_playbook_reverse_proxyable_services_additional_network }}" +matrix_rustpush_bridge_container_labels_traefik_entrypoints: "{{ traefik_entrypoint_primary }}" +matrix_rustpush_bridge_container_labels_traefik_tls_certResolver: "{{ traefik_certResolver_primary }}" -matrix_imessage_rustpush_container_labels_metrics_middleware_basic_auth_enabled: "{{ matrix_metrics_exposure_http_basic_auth_enabled }}" -matrix_imessage_rustpush_container_labels_metrics_middleware_basic_auth_users: "{{ matrix_metrics_exposure_http_basic_auth_users }}" +matrix_rustpush_bridge_container_labels_metrics_middleware_basic_auth_enabled: "{{ matrix_metrics_exposure_http_basic_auth_enabled }}" +matrix_rustpush_bridge_container_labels_metrics_middleware_basic_auth_users: "{{ matrix_metrics_exposure_http_basic_auth_users }}" -matrix_imessage_rustpush_appservice_token: "{{ (matrix_homeserver_generic_secret_key + ':imsg.as.token') | hash('sha512') | to_uuid }}" +matrix_rustpush_bridge_appservice_token: "{{ (matrix_homeserver_generic_secret_key + ':imsg.as.token') | hash('sha512') | to_uuid }}" -matrix_imessage_rustpush_homeserver_address: "{{ matrix_addons_homeserver_client_api_url }}" -matrix_imessage_rustpush_homeserver_token: "{{ (matrix_homeserver_generic_secret_key + ':imsg.hs.token') | hash('sha512') | to_uuid }}" +matrix_rustpush_bridge_homeserver_address: "{{ matrix_addons_homeserver_client_api_url }}" +matrix_rustpush_bridge_homeserver_token: "{{ (matrix_homeserver_generic_secret_key + ':imsg.hs.token') | hash('sha512') | to_uuid }}" -matrix_imessage_rustpush_homeserver_async_media: "{{ matrix_homeserver_implementation in ['synapse'] }}" +matrix_rustpush_bridge_homeserver_async_media: "{{ matrix_homeserver_implementation in ['synapse'] }}" -matrix_imessage_rustpush_provisioning_shared_secret: "{{ (matrix_homeserver_generic_secret_key + ':mau.imsg.prov') | hash('sha512') | to_uuid }}" +matrix_rustpush_bridge_provisioning_shared_secret: "{{ (matrix_homeserver_generic_secret_key + ':mau.imsg.prov') | hash('sha512') | to_uuid }}" -matrix_imessage_rustpush_double_puppet_secrets_auto: |- +matrix_rustpush_bridge_double_puppet_secrets_auto: |- {{ ({ - matrix_imessage_rustpush_homeserver_domain: ("as_token:" + matrix_appservice_double_puppet_registration_as_token) + matrix_rustpush_bridge_homeserver_domain: ("as_token:" + matrix_appservice_double_puppet_registration_as_token) }) if matrix_appservice_double_puppet_enabled else {} }} -matrix_imessage_rustpush_metrics_enabled: "{{ prometheus_enabled or matrix_metrics_exposure_enabled }}" +matrix_rustpush_bridge_metrics_enabled: "{{ prometheus_enabled or matrix_metrics_exposure_enabled }}" -matrix_imessage_rustpush_metrics_proxying_enabled: "{{ matrix_imessage_rustpush_metrics_enabled and matrix_metrics_exposure_enabled }}" -matrix_imessage_rustpush_metrics_proxying_hostname: "{{ matrix_metrics_exposure_hostname }}" -matrix_imessage_rustpush_metrics_proxying_path_prefix: "{{ matrix_metrics_exposure_path_prefix }}/imessage-rustpush" +matrix_rustpush_bridge_metrics_proxying_enabled: "{{ matrix_rustpush_bridge_metrics_enabled and matrix_metrics_exposure_enabled }}" +matrix_rustpush_bridge_metrics_proxying_hostname: "{{ matrix_metrics_exposure_hostname }}" +matrix_rustpush_bridge_metrics_proxying_path_prefix: "{{ matrix_metrics_exposure_path_prefix }}/rustpush-bridge" -matrix_imessage_rustpush_database_hostname: "{{ postgres_connection_hostname if postgres_enabled else '' }}" -matrix_imessage_rustpush_database_password: "{{ (matrix_homeserver_generic_secret_key + ':mau.imsg.db') | hash('sha512') | to_uuid if postgres_enabled else '' }}" +matrix_rustpush_bridge_database_hostname: "{{ postgres_connection_hostname if postgres_enabled else '' }}" +matrix_rustpush_bridge_database_password: "{{ (matrix_homeserver_generic_secret_key + ':mau.imsg.db') | hash('sha512') | to_uuid if postgres_enabled else '' }}" ###################################################################### # -# /matrix-bridge-imessage-rustpush +# /matrix-bridge-rustpush # ###################################################################### @@ -4135,10 +4135,10 @@ postgres_managed_databases_auto: | }] if (matrix_mautrix_bluesky_enabled and matrix_mautrix_bluesky_database_engine == 'postgres' and matrix_mautrix_bluesky_database_hostname == postgres_connection_hostname) else []) + ([{ - 'name': matrix_imessage_rustpush_database_name, - 'username': matrix_imessage_rustpush_database_username, - 'password': matrix_imessage_rustpush_database_password, - }] if (matrix_imessage_rustpush_enabled and matrix_imessage_rustpush_database_engine == 'postgres' and matrix_imessage_rustpush_database_hostname == postgres_connection_hostname) else []) + 'name': matrix_rustpush_bridge_database_name, + 'username': matrix_rustpush_bridge_database_username, + 'password': matrix_rustpush_bridge_database_password, + }] if (matrix_rustpush_bridge_enabled and matrix_rustpush_bridge_database_engine == 'postgres' and matrix_rustpush_bridge_database_hostname == postgres_connection_hostname) else []) + ([{ 'name': matrix_mautrix_googlechat_database_name, @@ -5081,9 +5081,9 @@ matrix_ketesa_config_asManagedUsers_auto: | ] if matrix_mautrix_bluesky_enabled else []) + ([ - '^@'+(matrix_imessage_rustpush_appservice_bot_username | default('') | regex_escape)+':'+(matrix_domain | regex_escape)+'$', + '^@'+(matrix_rustpush_bridge_appservice_bot_username | default('') | regex_escape)+':'+(matrix_domain | regex_escape)+'$', '^@imessage_[a-zA-Z0-9_.+-]+:'+(matrix_domain | regex_escape)+'$', - ] if matrix_imessage_rustpush_enabled else []) + ] if matrix_rustpush_bridge_enabled else []) + ([ '^@'+(matrix_mautrix_discord_appservice_bot_username | default('') | regex_escape)+':'+(matrix_domain | regex_escape)+'$', diff --git a/roles/custom/matrix-bridge-imessage-rustpush/defaults/main.yml b/roles/custom/matrix-bridge-imessage-rustpush/defaults/main.yml deleted file mode 100644 index c0ae1cb31..000000000 --- a/roles/custom/matrix-bridge-imessage-rustpush/defaults/main.yml +++ /dev/null @@ -1,222 +0,0 @@ -# SPDX-FileCopyrightText: 2025 MDAD project contributors -# -# SPDX-License-Identifier: AGPL-3.0-or-later - ---- -# matrix-bridge-imessage-rustpush is a Matrix <-> iMessage bridge using RustPush -# Project source code URL: https://github.com/lrhodin/imessage - -matrix_imessage_rustpush_enabled: true - -# No upstream Docker image exists; self-build is always required. -matrix_imessage_rustpush_container_image_self_build: true -matrix_imessage_rustpush_container_image_self_build_repo: "https://github.com/lrhodin/imessage.git" -matrix_imessage_rustpush_container_image_self_build_repo_version: "{{ 'main' if matrix_imessage_rustpush_version == 'latest' else matrix_imessage_rustpush_version }}" - -matrix_imessage_rustpush_version: latest -matrix_imessage_rustpush_docker_image: "{{ matrix_imessage_rustpush_docker_image_registry_prefix }}lrhodin/imessage:{{ matrix_imessage_rustpush_version }}" -matrix_imessage_rustpush_docker_image_registry_prefix: "localhost/" -matrix_imessage_rustpush_docker_image_force_pull: "{{ matrix_imessage_rustpush_docker_image.endswith(':latest') }}" - -matrix_imessage_rustpush_base_path: "{{ matrix_base_data_path }}/imessage-rustpush" -matrix_imessage_rustpush_config_path: "{{ matrix_imessage_rustpush_base_path }}/config" -matrix_imessage_rustpush_data_path: "{{ matrix_imessage_rustpush_base_path }}/data" -matrix_imessage_rustpush_docker_src_files_path: "{{ matrix_imessage_rustpush_base_path }}/docker-src" - -matrix_imessage_rustpush_homeserver_address: "" -# Whether asynchronous uploads via MSC2246 should be enabled for media. -matrix_imessage_rustpush_homeserver_async_media: false -matrix_imessage_rustpush_homeserver_domain: '{{ matrix_domain }}' -matrix_imessage_rustpush_appservice_address: 'http://matrix-imessage-rustpush:8081' - -matrix_imessage_rustpush_msc4190_enabled: "{{ matrix_bridges_msc4190_enabled }}" -matrix_imessage_rustpush_self_sign_enabled: "{{ matrix_bridges_self_sign_enabled }}" - -# A public address that external services can use to reach this appservice. -matrix_imessage_rustpush_appservice_public_address: '' - -# Displayname template for iMessage contacts. -# Available variables: {{.FirstName}}, {{.LastName}}, {{.Nickname}}, -# {{.Phone}}, {{.Email}}, {{.ID}} -matrix_imessage_rustpush_network_displayname_template: "{% raw %}{{if .FirstName}}{{.FirstName}}{{if .LastName}} {{.LastName}}{{end}}{{else if .Nickname}}{{.Nickname}}{{else if .Phone}}{{.Phone}}{{else if .Email}}{{.Email}}{{else}}{{.ID}}{{end}}{% endraw %}" - -matrix_imessage_rustpush_bridge_command_prefix: "!imessage" - -matrix_imessage_rustpush_bridge_permissions: | - {{ - {matrix_imessage_rustpush_homeserver_domain: 'user'} - | combine({matrix_admin: 'admin'} if matrix_admin else {}) - }} - -matrix_imessage_rustpush_container_network: "" - -matrix_imessage_rustpush_container_additional_networks: "{{ matrix_imessage_rustpush_container_additional_networks_auto + matrix_imessage_rustpush_container_additional_networks_custom }}" -matrix_imessage_rustpush_container_additional_networks_auto: [] -matrix_imessage_rustpush_container_additional_networks_custom: [] - -# matrix_imessage_rustpush_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_imessage_rustpush_container_labels_additional_labels`. -matrix_imessage_rustpush_container_labels_traefik_enabled: true -matrix_imessage_rustpush_container_labels_traefik_docker_network: "{{ matrix_imessage_rustpush_container_network }}" -matrix_imessage_rustpush_container_labels_traefik_entrypoints: web-secure -matrix_imessage_rustpush_container_labels_traefik_tls_certResolver: default # noqa var-naming - -# Controls whether labels will be added that expose metrics -matrix_imessage_rustpush_container_labels_metrics_enabled: "{{ matrix_imessage_rustpush_metrics_enabled and matrix_imessage_rustpush_metrics_proxying_enabled }}" -matrix_imessage_rustpush_container_labels_metrics_traefik_rule: "Host(`{{ matrix_imessage_rustpush_metrics_proxying_hostname }}`) && PathPrefix(`{{ matrix_imessage_rustpush_metrics_proxying_path_prefix }}`)" -matrix_imessage_rustpush_container_labels_metrics_traefik_priority: 0 -matrix_imessage_rustpush_container_labels_metrics_traefik_entrypoints: "{{ matrix_imessage_rustpush_container_labels_traefik_entrypoints }}" -matrix_imessage_rustpush_container_labels_metrics_traefik_tls: "{{ matrix_imessage_rustpush_container_labels_metrics_traefik_entrypoints != 'web' }}" -matrix_imessage_rustpush_container_labels_metrics_traefik_tls_certResolver: "{{ matrix_imessage_rustpush_container_labels_traefik_tls_certResolver }}" # noqa var-naming -matrix_imessage_rustpush_container_labels_metrics_middleware_basic_auth_enabled: false -# See: https://doc.traefik.io/traefik/middlewares/http/basicauth/#users -matrix_imessage_rustpush_container_labels_metrics_middleware_basic_auth_users: '' - -# matrix_imessage_rustpush_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_imessage_rustpush_container_labels_additional_labels: | -# my.label=1 -# another.label="here" -matrix_imessage_rustpush_container_labels_additional_labels: '' - -# A list of extra arguments to pass to the container -matrix_imessage_rustpush_container_extra_arguments: [] - -# List of systemd services that matrix-imessage-rustpush.service depends on. -matrix_imessage_rustpush_systemd_required_services_list: "{{ matrix_imessage_rustpush_systemd_required_services_list_default + matrix_imessage_rustpush_systemd_required_services_list_auto + matrix_imessage_rustpush_systemd_required_services_list_custom }}" -matrix_imessage_rustpush_systemd_required_services_list_default: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}" -matrix_imessage_rustpush_systemd_required_services_list_auto: [] -matrix_imessage_rustpush_systemd_required_services_list_custom: [] - -# List of systemd services that matrix-imessage-rustpush.service wants -matrix_imessage_rustpush_systemd_wanted_services_list: [] - -matrix_imessage_rustpush_appservice_token: '' -matrix_imessage_rustpush_homeserver_token: '' - -# Whether or not created rooms should have federation enabled. -# If false, created portal rooms will never be federated. -matrix_imessage_rustpush_matrix_federate_rooms: true - -# Database-related configuration fields. -# -# To use Postgres: -# - adjust your database credentials via the `matrix_imessage_rustpush_postgres_*` variables -matrix_imessage_rustpush_database_engine: 'postgres' - -matrix_imessage_rustpush_database_username: 'matrix_imessage_rustpush' -matrix_imessage_rustpush_database_password: 'some-password' -matrix_imessage_rustpush_database_hostname: '' -matrix_imessage_rustpush_database_port: 5432 -matrix_imessage_rustpush_database_name: 'matrix_imessage_rustpush' -matrix_imessage_rustpush_database_sslmode: disable - -matrix_imessage_rustpush_database_connection_string: 'postgres://{{ matrix_imessage_rustpush_database_username }}:{{ matrix_imessage_rustpush_database_password }}@{{ matrix_imessage_rustpush_database_hostname }}:{{ matrix_imessage_rustpush_database_port }}/{{ matrix_imessage_rustpush_database_name }}?sslmode={{ matrix_imessage_rustpush_database_sslmode }}' - -matrix_imessage_rustpush_database_uri: "{{ - { - 'postgres': matrix_imessage_rustpush_database_connection_string, - }[matrix_imessage_rustpush_database_engine] -}}" - -matrix_imessage_rustpush_double_puppet_secrets: "{{ matrix_imessage_rustpush_double_puppet_secrets_auto | combine(matrix_imessage_rustpush_double_puppet_secrets_custom) }}" -matrix_imessage_rustpush_double_puppet_secrets_auto: {} -matrix_imessage_rustpush_double_puppet_secrets_custom: {} - -matrix_imessage_rustpush_appservice_bot_username: imessagebot -matrix_imessage_rustpush_appservice_bot_displayname: iMessage bridge bot -matrix_imessage_rustpush_appservice_bot_avatar: '' - -# Backfill is disabled by default because Linux Docker cannot access chat.db. -# On macOS with Full Disk Access, this can be set to true. -matrix_imessage_rustpush_backfill_enabled: false -# Maximum number of messages to backfill in empty rooms -matrix_imessage_rustpush_backfill_max_initial_messages: 50 - -# Maximum number of missed messages to backfill after bridge restarts -matrix_imessage_rustpush_backfill_max_catchup_messages: 500 - -# How many days back to look for chats during initial sync. -# Default in upstream is 365 (1 year). Set to 0 to disable. -matrix_imessage_rustpush_initial_sync_days: 0 - -# Shared secret for authentication of provisioning API requests. -# If set to "disable", the provisioning API will be disabled. -matrix_imessage_rustpush_provisioning_shared_secret: disable - -# Minimum severity of journal log messages. -# Valid values: fatal, error, warn, info, debug, trace -matrix_imessage_rustpush_logging_level: 'warn' - -# Whether or not metrics endpoint should be enabled. -# Enabling them is usually enough for a local (in-container) Prometheus to consume them. -# If metrics need to be consumed by another (external) Prometheus server, consider exposing them via `matrix_imessage_rustpush_metrics_proxying_enabled`. -matrix_imessage_rustpush_metrics_enabled: false - -# Controls whether metrics should be exposed on a public URL. -matrix_imessage_rustpush_metrics_proxying_enabled: false -matrix_imessage_rustpush_metrics_proxying_hostname: '' -matrix_imessage_rustpush_metrics_proxying_path_prefix: '' - -# Default configuration template which covers the generic use case. -# You can customize it by controlling the various variables inside it. -# -# For a more advanced customization, you can extend the default (see `matrix_imessage_rustpush_configuration_extension_yaml`) -# or completely replace this variable with your own template. -matrix_imessage_rustpush_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}" - -matrix_imessage_rustpush_configuration_extension_yaml: | - # Your custom YAML configuration goes here. - # This configuration extends the default starting configuration (`matrix_imessage_rustpush_configuration_yaml`). - # - # You can override individual variables from the default configuration, or introduce new ones. - # - # If you need something more special, you can take full control by - # completely redefining `matrix_imessage_rustpush_configuration_yaml`. - -matrix_imessage_rustpush_configuration_extension: "{{ matrix_imessage_rustpush_configuration_extension_yaml | from_yaml if matrix_imessage_rustpush_configuration_extension_yaml | from_yaml is mapping else {} }}" - -# Holds the final configuration (a combination of the default and its extension). -# You most likely don't need to touch this variable. Instead, see `matrix_imessage_rustpush_configuration_yaml`. -matrix_imessage_rustpush_configuration: "{{ matrix_imessage_rustpush_configuration_yaml | from_yaml | combine(matrix_imessage_rustpush_configuration_extension, recursive=True) }}" - -matrix_imessage_rustpush_registration_yaml: | - id: imessage-rustpush - as_token: "{{ matrix_imessage_rustpush_appservice_token }}" - hs_token: "{{ matrix_imessage_rustpush_homeserver_token }}" - namespaces: - users: - - exclusive: true - regex: '^@imessage_.+:{{ matrix_imessage_rustpush_homeserver_domain | regex_escape }}$' - - exclusive: true - regex: '^@{{ matrix_imessage_rustpush_appservice_bot_username | regex_escape }}:{{ matrix_imessage_rustpush_homeserver_domain | regex_escape }}$' - url: {{ matrix_imessage_rustpush_appservice_address }} - sender_localpart: _bot_{{ matrix_imessage_rustpush_appservice_bot_username }} - rate_limited: false - de.sorunome.msc2409.push_ephemeral: true - receive_ephemeral: true - io.element.msc4190: {{ matrix_imessage_rustpush_msc4190_enabled | to_json }} - -matrix_imessage_rustpush_registration: "{{ matrix_imessage_rustpush_registration_yaml | from_yaml }}" - -# Enable End-to-bridge encryption -matrix_imessage_rustpush_bridge_encryption_allow: "{{ matrix_bridges_encryption_enabled }}" -matrix_imessage_rustpush_bridge_encryption_default: "{{ matrix_bridges_encryption_default }}" -matrix_imessage_rustpush_bridge_encryption_require: false -matrix_imessage_rustpush_bridge_encryption_appservice: false -matrix_imessage_rustpush_bridge_encryption_key_sharing_allow: "{{ matrix_imessage_rustpush_bridge_encryption_allow }}" -matrix_imessage_rustpush_bridge_encryption_pickle_key: mautrix.bridge.e2ee - -# matrix_imessage_rustpush_restart_necessary controls whether the service -# will be restarted (when true) or merely started (when false) by the -# systemd service manager role (when conditional restart is enabled). -# -# This value is automatically computed during installation based on whether -# any configuration files, the systemd service file, or the container image changed. -# The default of `false` means "no restart needed" — appropriate when the role's -# installation tasks haven't run (e.g., due to --tags skipping them). -matrix_imessage_rustpush_restart_necessary: false diff --git a/roles/custom/matrix-bridge-imessage-rustpush/tasks/setup_install.yml b/roles/custom/matrix-bridge-imessage-rustpush/tasks/setup_install.yml deleted file mode 100644 index 0fe6e7285..000000000 --- a/roles/custom/matrix-bridge-imessage-rustpush/tasks/setup_install.yml +++ /dev/null @@ -1,115 +0,0 @@ -# SPDX-FileCopyrightText: 2025 MDAD project contributors -# -# SPDX-License-Identifier: AGPL-3.0-or-later - ---- - -- name: Ensure iMessage RustPush paths exist - ansible.builtin.file: - path: "{{ item.path }}" - state: directory - mode: 0750 - owner: "{{ matrix_user_name }}" - group: "{{ matrix_group_name }}" - with_items: - - {path: "{{ matrix_imessage_rustpush_base_path }}", when: true} - - {path: "{{ matrix_imessage_rustpush_config_path }}", when: true} - - {path: "{{ matrix_imessage_rustpush_data_path }}", when: true} - - {path: "{{ matrix_imessage_rustpush_docker_src_files_path }}", when: "{{ matrix_imessage_rustpush_container_image_self_build }}"} - when: item.when | bool - -- name: Ensure iMessage RustPush repository is present on self-build - ansible.builtin.git: - repo: "{{ matrix_imessage_rustpush_container_image_self_build_repo }}" - version: "{{ matrix_imessage_rustpush_container_image_self_build_repo_version }}" - dest: "{{ matrix_imessage_rustpush_docker_src_files_path }}" - force: "yes" - become: true - become_user: "{{ matrix_user_name }}" - register: matrix_imessage_rustpush_git_pull_results - when: "matrix_imessage_rustpush_enabled | bool and matrix_imessage_rustpush_container_image_self_build" - -- name: Ensure iMessage RustPush Dockerfile is installed - ansible.builtin.template: - src: "{{ role_path }}/templates/Dockerfile.j2" - dest: "{{ matrix_imessage_rustpush_docker_src_files_path }}/Dockerfile" - mode: 0640 - owner: "{{ matrix_user_name }}" - group: "{{ matrix_group_name }}" - when: "matrix_imessage_rustpush_enabled | bool and matrix_imessage_rustpush_container_image_self_build | bool" - -- name: Ensure iMessage RustPush Docker image is built - community.docker.docker_image: - name: "{{ matrix_imessage_rustpush_docker_image }}" - source: build - force_source: "{{ matrix_imessage_rustpush_git_pull_results.changed if matrix_imessage_rustpush_git_pull_results is defined else true }}" - build: - dockerfile: Dockerfile - path: "{{ matrix_imessage_rustpush_docker_src_files_path }}" - pull: true - register: matrix_imessage_rustpush_container_image_build_result - when: "matrix_imessage_rustpush_enabled | bool and matrix_imessage_rustpush_container_image_self_build | bool" - -- name: Ensure iMessage RustPush container image is pulled - community.docker.docker_image: - name: "{{ matrix_imessage_rustpush_docker_image }}" - source: pull - force_source: "{{ matrix_imessage_rustpush_container_image_force_pull if matrix_imessage_rustpush_container_image_force_pull is defined else true }}" - register: matrix_imessage_rustpush_container_image_pull_result - when: "matrix_imessage_rustpush_enabled | bool and not matrix_imessage_rustpush_container_image_self_build | bool" - ignore_errors: "{{ ansible_check_mode }}" - -- name: Ensure imessage-rustpush config.yaml installed - ansible.builtin.copy: - content: "{{ matrix_imessage_rustpush_configuration | to_nice_yaml(indent=2, width=999999) }}" - dest: "{{ matrix_imessage_rustpush_config_path }}/config.yaml" - mode: 0644 - owner: "{{ matrix_user_name }}" - group: "{{ matrix_group_name }}" - register: matrix_imessage_rustpush_config_result - -- name: Ensure imessage-rustpush registration.yaml installed - ansible.builtin.copy: - content: "{{ matrix_imessage_rustpush_registration | to_nice_yaml(indent=2, width=999999) }}" - dest: "{{ matrix_imessage_rustpush_config_path }}/registration.yaml" - mode: 0644 - owner: "{{ matrix_user_name }}" - group: "{{ matrix_group_name }}" - register: matrix_imessage_rustpush_registration_result - -- name: Ensure imessage-rustpush support files installed - ansible.builtin.template: - src: "{{ role_path }}/templates/{{ item }}.j2" - dest: "{{ matrix_imessage_rustpush_base_path }}/{{ item }}" - mode: 0640 - owner: "{{ matrix_user_name }}" - group: "{{ matrix_group_name }}" - with_items: - - labels - register: matrix_imessage_rustpush_support_files_result - -- name: Ensure matrix-imessage-rustpush container network is created - community.general.docker_network: - enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}" - name: "{{ matrix_imessage_rustpush_container_network }}" - driver: bridge - driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}" - -- name: Ensure matrix-imessage-rustpush.service installed - ansible.builtin.template: - src: "{{ role_path }}/templates/systemd/matrix-imessage-rustpush.service.j2" - dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-imessage-rustpush.service" - mode: 0644 - register: matrix_imessage_rustpush_systemd_service_result - -- name: Determine whether matrix-imessage-rustpush needs a restart - ansible.builtin.set_fact: - matrix_imessage_rustpush_restart_necessary: >- - {{ - matrix_imessage_rustpush_config_result.changed | default(false) - or matrix_imessage_rustpush_registration_result.changed | default(false) - or matrix_imessage_rustpush_support_files_result.changed | default(false) - or matrix_imessage_rustpush_systemd_service_result.changed | default(false) - or matrix_imessage_rustpush_container_image_pull_result.changed | default(false) - or matrix_imessage_rustpush_container_image_build_result.changed | default(false) - }} diff --git a/roles/custom/matrix-bridge-imessage-rustpush/tasks/validate_config.yml b/roles/custom/matrix-bridge-imessage-rustpush/tasks/validate_config.yml deleted file mode 100644 index d2c846c14..000000000 --- a/roles/custom/matrix-bridge-imessage-rustpush/tasks/validate_config.yml +++ /dev/null @@ -1,19 +0,0 @@ -# SPDX-FileCopyrightText: 2025 MDAD project contributors -# -# SPDX-License-Identifier: AGPL-3.0-or-later - ---- - -- name: Fail if required iMessage RustPush settings not defined - ansible.builtin.fail: - msg: >- - You need to define a required configuration setting (`{{ item.name }}`). - when: "item.when | bool and lookup('vars', item.name, default='') | string | length == 0" - with_items: - - {'name': 'matrix_imessage_rustpush_appservice_token', when: true} - - {'name': 'matrix_imessage_rustpush_homeserver_address', when: true} - - {'name': 'matrix_imessage_rustpush_homeserver_token', when: true} - - {'name': 'matrix_imessage_rustpush_database_hostname', when: "{{ matrix_imessage_rustpush_database_engine == 'postgres' }}"} - - {'name': 'matrix_imessage_rustpush_container_network', when: true} - - {'name': 'matrix_imessage_rustpush_metrics_proxying_hostname', when: "{{ matrix_imessage_rustpush_metrics_proxying_enabled }}"} - - {'name': 'matrix_imessage_rustpush_metrics_proxying_path_prefix', when: "{{ matrix_imessage_rustpush_metrics_proxying_enabled }}"} diff --git a/roles/custom/matrix-bridge-imessage-rustpush/templates/labels.j2 b/roles/custom/matrix-bridge-imessage-rustpush/templates/labels.j2 deleted file mode 100644 index 4021967dd..000000000 --- a/roles/custom/matrix-bridge-imessage-rustpush/templates/labels.j2 +++ /dev/null @@ -1,52 +0,0 @@ -{# -SPDX-FileCopyrightText: 2025 MDAD project contributors - -SPDX-License-Identifier: AGPL-3.0-or-later -#} - -{% if matrix_imessage_rustpush_container_labels_traefik_enabled %} -traefik.enable=true - -{% if matrix_imessage_rustpush_container_labels_traefik_docker_network %} -traefik.docker.network={{ matrix_imessage_rustpush_container_labels_traefik_docker_network }} -{% endif %} - -traefik.http.services.matrix-imessage-rustpush-metrics.loadbalancer.server.port=8000 - -{% if matrix_imessage_rustpush_container_labels_metrics_enabled %} -############################################################ -# # -# Metrics # -# # -############################################################ - -{% if matrix_imessage_rustpush_container_labels_metrics_middleware_basic_auth_enabled %} -traefik.http.middlewares.matrix-imessage-rustpush-metrics-basic-auth.basicauth.users={{ matrix_imessage_rustpush_container_labels_metrics_middleware_basic_auth_users }} -traefik.http.routers.matrix-imessage-rustpush-metrics.middlewares=matrix-imessage-rustpush-metrics-basic-auth -{% endif %} - -traefik.http.routers.matrix-imessage-rustpush-metrics.rule={{ matrix_imessage_rustpush_container_labels_metrics_traefik_rule }} - -{% if matrix_imessage_rustpush_container_labels_metrics_traefik_priority | int > 0 %} -traefik.http.routers.matrix-imessage-rustpush-metrics.priority={{ matrix_imessage_rustpush_container_labels_metrics_traefik_priority }} -{% endif %} - -traefik.http.routers.matrix-imessage-rustpush-metrics.service=matrix-imessage-rustpush-metrics -traefik.http.routers.matrix-imessage-rustpush-metrics.entrypoints={{ matrix_imessage_rustpush_container_labels_metrics_traefik_entrypoints }} - -traefik.http.routers.matrix-imessage-rustpush-metrics.tls={{ matrix_imessage_rustpush_container_labels_metrics_traefik_tls | to_json }} -{% if matrix_imessage_rustpush_container_labels_metrics_traefik_tls %} -traefik.http.routers.matrix-imessage-rustpush-metrics.tls.certResolver={{ matrix_imessage_rustpush_container_labels_metrics_traefik_tls_certResolver }} -{% endif %} - -############################################################ -# # -# /Metrics # -# # -############################################################ -{% endif %} - - -{% endif %} - -{{ matrix_imessage_rustpush_container_labels_additional_labels }} diff --git a/roles/custom/matrix-bridge-rustpush/defaults/main.yml b/roles/custom/matrix-bridge-rustpush/defaults/main.yml new file mode 100644 index 000000000..ebc292793 --- /dev/null +++ b/roles/custom/matrix-bridge-rustpush/defaults/main.yml @@ -0,0 +1,222 @@ +# SPDX-FileCopyrightText: 2025 MDAD project contributors +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +--- +# matrix-bridge-rustpush is a Matrix <-> iMessage bridge using RustPush +# Project source code URL: https://github.com/lrhodin/imessage + +matrix_rustpush_bridge_enabled: true + +# No upstream Docker image exists; self-build is always required. +matrix_rustpush_bridge_container_image_self_build: true +matrix_rustpush_bridge_container_image_self_build_repo: "https://github.com/lrhodin/imessage.git" +matrix_rustpush_bridge_container_image_self_build_repo_version: "{{ 'main' if matrix_rustpush_bridge_version == 'latest' else matrix_rustpush_bridge_version }}" + +matrix_rustpush_bridge_version: latest +matrix_rustpush_bridge_docker_image: "{{ matrix_rustpush_bridge_docker_image_registry_prefix }}lrhodin/imessage:{{ matrix_rustpush_bridge_version }}" +matrix_rustpush_bridge_docker_image_registry_prefix: "localhost/" +matrix_rustpush_bridge_docker_image_force_pull: "{{ matrix_rustpush_bridge_docker_image.endswith(':latest') }}" + +matrix_rustpush_bridge_base_path: "{{ matrix_base_data_path }}/rustpush-bridge" +matrix_rustpush_bridge_config_path: "{{ matrix_rustpush_bridge_base_path }}/config" +matrix_rustpush_bridge_data_path: "{{ matrix_rustpush_bridge_base_path }}/data" +matrix_rustpush_bridge_docker_src_files_path: "{{ matrix_rustpush_bridge_base_path }}/docker-src" + +matrix_rustpush_bridge_homeserver_address: "" +# Whether asynchronous uploads via MSC2246 should be enabled for media. +matrix_rustpush_bridge_homeserver_async_media: false +matrix_rustpush_bridge_homeserver_domain: '{{ matrix_domain }}' +matrix_rustpush_bridge_appservice_address: 'http://matrix-rustpush-bridge:8081' + +matrix_rustpush_bridge_msc4190_enabled: "{{ matrix_bridges_msc4190_enabled }}" +matrix_rustpush_bridge_self_sign_enabled: "{{ matrix_bridges_self_sign_enabled }}" + +# A public address that external services can use to reach this appservice. +matrix_rustpush_bridge_appservice_public_address: '' + +# Displayname template for iMessage contacts. +# Available variables: {{.FirstName}}, {{.LastName}}, {{.Nickname}}, +# {{.Phone}}, {{.Email}}, {{.ID}} +matrix_rustpush_bridge_network_displayname_template: "{% raw %}{{if .FirstName}}{{.FirstName}}{{if .LastName}} {{.LastName}}{{end}}{{else if .Nickname}}{{.Nickname}}{{else if .Phone}}{{.Phone}}{{else if .Email}}{{.Email}}{{else}}{{.ID}}{{end}}{% endraw %}" + +matrix_rustpush_bridge_bridge_command_prefix: "!imessage" + +matrix_rustpush_bridge_bridge_permissions: | + {{ + {matrix_rustpush_bridge_homeserver_domain: 'user'} + | combine({matrix_admin: 'admin'} if matrix_admin else {}) + }} + +matrix_rustpush_bridge_container_network: "" + +matrix_rustpush_bridge_container_additional_networks: "{{ matrix_rustpush_bridge_container_additional_networks_auto + matrix_rustpush_bridge_container_additional_networks_custom }}" +matrix_rustpush_bridge_container_additional_networks_auto: [] +matrix_rustpush_bridge_container_additional_networks_custom: [] + +# matrix_rustpush_bridge_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_rustpush_bridge_container_labels_additional_labels`. +matrix_rustpush_bridge_container_labels_traefik_enabled: true +matrix_rustpush_bridge_container_labels_traefik_docker_network: "{{ matrix_rustpush_bridge_container_network }}" +matrix_rustpush_bridge_container_labels_traefik_entrypoints: web-secure +matrix_rustpush_bridge_container_labels_traefik_tls_certResolver: default # noqa var-naming + +# Controls whether labels will be added that expose metrics +matrix_rustpush_bridge_container_labels_metrics_enabled: "{{ matrix_rustpush_bridge_metrics_enabled and matrix_rustpush_bridge_metrics_proxying_enabled }}" +matrix_rustpush_bridge_container_labels_metrics_traefik_rule: "Host(`{{ matrix_rustpush_bridge_metrics_proxying_hostname }}`) && PathPrefix(`{{ matrix_rustpush_bridge_metrics_proxying_path_prefix }}`)" +matrix_rustpush_bridge_container_labels_metrics_traefik_priority: 0 +matrix_rustpush_bridge_container_labels_metrics_traefik_entrypoints: "{{ matrix_rustpush_bridge_container_labels_traefik_entrypoints }}" +matrix_rustpush_bridge_container_labels_metrics_traefik_tls: "{{ matrix_rustpush_bridge_container_labels_metrics_traefik_entrypoints != 'web' }}" +matrix_rustpush_bridge_container_labels_metrics_traefik_tls_certResolver: "{{ matrix_rustpush_bridge_container_labels_traefik_tls_certResolver }}" # noqa var-naming +matrix_rustpush_bridge_container_labels_metrics_middleware_basic_auth_enabled: false +# See: https://doc.traefik.io/traefik/middlewares/http/basicauth/#users +matrix_rustpush_bridge_container_labels_metrics_middleware_basic_auth_users: '' + +# matrix_rustpush_bridge_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_rustpush_bridge_container_labels_additional_labels: | +# my.label=1 +# another.label="here" +matrix_rustpush_bridge_container_labels_additional_labels: '' + +# A list of extra arguments to pass to the container +matrix_rustpush_bridge_container_extra_arguments: [] + +# List of systemd services that matrix-rustpush-bridge.service depends on. +matrix_rustpush_bridge_systemd_required_services_list: "{{ matrix_rustpush_bridge_systemd_required_services_list_default + matrix_rustpush_bridge_systemd_required_services_list_auto + matrix_rustpush_bridge_systemd_required_services_list_custom }}" +matrix_rustpush_bridge_systemd_required_services_list_default: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}" +matrix_rustpush_bridge_systemd_required_services_list_auto: [] +matrix_rustpush_bridge_systemd_required_services_list_custom: [] + +# List of systemd services that matrix-rustpush-bridge.service wants +matrix_rustpush_bridge_systemd_wanted_services_list: [] + +matrix_rustpush_bridge_appservice_token: '' +matrix_rustpush_bridge_homeserver_token: '' + +# Whether or not created rooms should have federation enabled. +# If false, created portal rooms will never be federated. +matrix_rustpush_bridge_matrix_federate_rooms: true + +# Database-related configuration fields. +# +# To use Postgres: +# - adjust your database credentials via the `matrix_rustpush_bridge_postgres_*` variables +matrix_rustpush_bridge_database_engine: 'postgres' + +matrix_rustpush_bridge_database_username: 'matrix_rustpush_bridge' +matrix_rustpush_bridge_database_password: 'some-password' +matrix_rustpush_bridge_database_hostname: '' +matrix_rustpush_bridge_database_port: 5432 +matrix_rustpush_bridge_database_name: 'matrix_rustpush_bridge' +matrix_rustpush_bridge_database_sslmode: disable + +matrix_rustpush_bridge_database_connection_string: 'postgres://{{ matrix_rustpush_bridge_database_username }}:{{ matrix_rustpush_bridge_database_password }}@{{ matrix_rustpush_bridge_database_hostname }}:{{ matrix_rustpush_bridge_database_port }}/{{ matrix_rustpush_bridge_database_name }}?sslmode={{ matrix_rustpush_bridge_database_sslmode }}' + +matrix_rustpush_bridge_database_uri: "{{ + { + 'postgres': matrix_rustpush_bridge_database_connection_string, + }[matrix_rustpush_bridge_database_engine] +}}" + +matrix_rustpush_bridge_double_puppet_secrets: "{{ matrix_rustpush_bridge_double_puppet_secrets_auto | combine(matrix_rustpush_bridge_double_puppet_secrets_custom) }}" +matrix_rustpush_bridge_double_puppet_secrets_auto: {} +matrix_rustpush_bridge_double_puppet_secrets_custom: {} + +matrix_rustpush_bridge_appservice_bot_username: imessagebot +matrix_rustpush_bridge_appservice_bot_displayname: iMessage bridge bot +matrix_rustpush_bridge_appservice_bot_avatar: '' + +# Backfill is disabled by default because Linux Docker cannot access chat.db. +# On macOS with Full Disk Access, this can be set to true. +matrix_rustpush_bridge_backfill_enabled: false +# Maximum number of messages to backfill in empty rooms +matrix_rustpush_bridge_backfill_max_initial_messages: 50 + +# Maximum number of missed messages to backfill after bridge restarts +matrix_rustpush_bridge_backfill_max_catchup_messages: 500 + +# How many days back to look for chats during initial sync. +# Default in upstream is 365 (1 year). Set to 0 to disable. +matrix_rustpush_bridge_initial_sync_days: 0 + +# Shared secret for authentication of provisioning API requests. +# If set to "disable", the provisioning API will be disabled. +matrix_rustpush_bridge_provisioning_shared_secret: disable + +# Minimum severity of journal log messages. +# Valid values: fatal, error, warn, info, debug, trace +matrix_rustpush_bridge_logging_level: 'warn' + +# Whether or not metrics endpoint should be enabled. +# Enabling them is usually enough for a local (in-container) Prometheus to consume them. +# If metrics need to be consumed by another (external) Prometheus server, consider exposing them via `matrix_rustpush_bridge_metrics_proxying_enabled`. +matrix_rustpush_bridge_metrics_enabled: false + +# Controls whether metrics should be exposed on a public URL. +matrix_rustpush_bridge_metrics_proxying_enabled: false +matrix_rustpush_bridge_metrics_proxying_hostname: '' +matrix_rustpush_bridge_metrics_proxying_path_prefix: '' + +# Default configuration template which covers the generic use case. +# You can customize it by controlling the various variables inside it. +# +# For a more advanced customization, you can extend the default (see `matrix_rustpush_bridge_configuration_extension_yaml`) +# or completely replace this variable with your own template. +matrix_rustpush_bridge_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}" + +matrix_rustpush_bridge_configuration_extension_yaml: | + # Your custom YAML configuration goes here. + # This configuration extends the default starting configuration (`matrix_rustpush_bridge_configuration_yaml`). + # + # You can override individual variables from the default configuration, or introduce new ones. + # + # If you need something more special, you can take full control by + # completely redefining `matrix_rustpush_bridge_configuration_yaml`. + +matrix_rustpush_bridge_configuration_extension: "{{ matrix_rustpush_bridge_configuration_extension_yaml | from_yaml if matrix_rustpush_bridge_configuration_extension_yaml | from_yaml is mapping else {} }}" + +# Holds the final configuration (a combination of the default and its extension). +# You most likely don't need to touch this variable. Instead, see `matrix_rustpush_bridge_configuration_yaml`. +matrix_rustpush_bridge_configuration: "{{ matrix_rustpush_bridge_configuration_yaml | from_yaml | combine(matrix_rustpush_bridge_configuration_extension, recursive=True) }}" + +matrix_rustpush_bridge_registration_yaml: | + id: rustpush-bridge + as_token: "{{ matrix_rustpush_bridge_appservice_token }}" + hs_token: "{{ matrix_rustpush_bridge_homeserver_token }}" + namespaces: + users: + - exclusive: true + regex: '^@imessage_.+:{{ matrix_rustpush_bridge_homeserver_domain | regex_escape }}$' + - exclusive: true + regex: '^@{{ matrix_rustpush_bridge_appservice_bot_username | regex_escape }}:{{ matrix_rustpush_bridge_homeserver_domain | regex_escape }}$' + url: {{ matrix_rustpush_bridge_appservice_address }} + sender_localpart: _bot_{{ matrix_rustpush_bridge_appservice_bot_username }} + rate_limited: false + de.sorunome.msc2409.push_ephemeral: true + receive_ephemeral: true + io.element.msc4190: {{ matrix_rustpush_bridge_msc4190_enabled | to_json }} + +matrix_rustpush_bridge_registration: "{{ matrix_rustpush_bridge_registration_yaml | from_yaml }}" + +# Enable End-to-bridge encryption +matrix_rustpush_bridge_bridge_encryption_allow: "{{ matrix_bridges_encryption_enabled }}" +matrix_rustpush_bridge_bridge_encryption_default: "{{ matrix_bridges_encryption_default }}" +matrix_rustpush_bridge_bridge_encryption_require: false +matrix_rustpush_bridge_bridge_encryption_appservice: false +matrix_rustpush_bridge_bridge_encryption_key_sharing_allow: "{{ matrix_rustpush_bridge_bridge_encryption_allow }}" +matrix_rustpush_bridge_bridge_encryption_pickle_key: mautrix.bridge.e2ee + +# matrix_rustpush_bridge_restart_necessary controls whether the service +# will be restarted (when true) or merely started (when false) by the +# systemd service manager role (when conditional restart is enabled). +# +# This value is automatically computed during installation based on whether +# any configuration files, the systemd service file, or the container image changed. +# The default of `false` means "no restart needed" — appropriate when the role's +# installation tasks haven't run (e.g., due to --tags skipping them). +matrix_rustpush_bridge_restart_necessary: false diff --git a/roles/custom/matrix-bridge-imessage-rustpush/tasks/main.yml b/roles/custom/matrix-bridge-rustpush/tasks/main.yml similarity index 63% rename from roles/custom/matrix-bridge-imessage-rustpush/tasks/main.yml rename to roles/custom/matrix-bridge-rustpush/tasks/main.yml index a6cd72ef0..5afa35fa5 100644 --- a/roles/custom/matrix-bridge-imessage-rustpush/tasks/main.yml +++ b/roles/custom/matrix-bridge-rustpush/tasks/main.yml @@ -6,19 +6,19 @@ - tags: - setup-all - - setup-imessage-rustpush + - setup-rustpush-bridge - install-all - - install-imessage-rustpush + - install-rustpush-bridge block: - - when: matrix_imessage_rustpush_enabled | bool + - when: matrix_rustpush_bridge_enabled | bool ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml" - - when: matrix_imessage_rustpush_enabled | bool + - when: matrix_rustpush_bridge_enabled | bool ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_install.yml" - tags: - setup-all - - setup-imessage-rustpush + - setup-rustpush-bridge block: - - when: not matrix_imessage_rustpush_enabled | bool + - when: not matrix_rustpush_bridge_enabled | bool ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" diff --git a/roles/custom/matrix-bridge-rustpush/tasks/setup_install.yml b/roles/custom/matrix-bridge-rustpush/tasks/setup_install.yml new file mode 100644 index 000000000..ebd9d28e0 --- /dev/null +++ b/roles/custom/matrix-bridge-rustpush/tasks/setup_install.yml @@ -0,0 +1,115 @@ +# SPDX-FileCopyrightText: 2025 MDAD project contributors +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +--- + +- name: Ensure RustPush paths exist + ansible.builtin.file: + path: "{{ item.path }}" + state: directory + mode: 0750 + owner: "{{ matrix_user_name }}" + group: "{{ matrix_group_name }}" + with_items: + - {path: "{{ matrix_rustpush_bridge_base_path }}", when: true} + - {path: "{{ matrix_rustpush_bridge_config_path }}", when: true} + - {path: "{{ matrix_rustpush_bridge_data_path }}", when: true} + - {path: "{{ matrix_rustpush_bridge_docker_src_files_path }}", when: "{{ matrix_rustpush_bridge_container_image_self_build }}"} + when: item.when | bool + +- name: Ensure RustPush repository is present on self-build + ansible.builtin.git: + repo: "{{ matrix_rustpush_bridge_container_image_self_build_repo }}" + version: "{{ matrix_rustpush_bridge_container_image_self_build_repo_version }}" + dest: "{{ matrix_rustpush_bridge_docker_src_files_path }}" + force: "yes" + become: true + become_user: "{{ matrix_user_name }}" + register: matrix_rustpush_bridge_git_pull_results + when: "matrix_rustpush_bridge_enabled | bool and matrix_rustpush_bridge_container_image_self_build" + +- name: Ensure RustPush Dockerfile is installed + ansible.builtin.template: + src: "{{ role_path }}/templates/Dockerfile.j2" + dest: "{{ matrix_rustpush_bridge_docker_src_files_path }}/Dockerfile" + mode: 0640 + owner: "{{ matrix_user_name }}" + group: "{{ matrix_group_name }}" + when: "matrix_rustpush_bridge_enabled | bool and matrix_rustpush_bridge_container_image_self_build | bool" + +- name: Ensure RustPush Docker image is built + community.docker.docker_image: + name: "{{ matrix_rustpush_bridge_docker_image }}" + source: build + force_source: "{{ matrix_rustpush_bridge_git_pull_results.changed if matrix_rustpush_bridge_git_pull_results is defined else true }}" + build: + dockerfile: Dockerfile + path: "{{ matrix_rustpush_bridge_docker_src_files_path }}" + pull: true + register: matrix_rustpush_bridge_container_image_build_result + when: "matrix_rustpush_bridge_enabled | bool and matrix_rustpush_bridge_container_image_self_build | bool" + +- name: Ensure RustPush container image is pulled + community.docker.docker_image: + name: "{{ matrix_rustpush_bridge_docker_image }}" + source: pull + force_source: "{{ matrix_rustpush_bridge_container_image_force_pull if matrix_rustpush_bridge_container_image_force_pull is defined else true }}" + register: matrix_rustpush_bridge_container_image_pull_result + when: "matrix_rustpush_bridge_enabled | bool and not matrix_rustpush_bridge_container_image_self_build | bool" + ignore_errors: "{{ ansible_check_mode }}" + +- name: Ensure rustpush-bridge config.yaml installed + ansible.builtin.copy: + content: "{{ matrix_rustpush_bridge_configuration | to_nice_yaml(indent=2, width=999999) }}" + dest: "{{ matrix_rustpush_bridge_config_path }}/config.yaml" + mode: 0644 + owner: "{{ matrix_user_name }}" + group: "{{ matrix_group_name }}" + register: matrix_rustpush_bridge_config_result + +- name: Ensure rustpush-bridge registration.yaml installed + ansible.builtin.copy: + content: "{{ matrix_rustpush_bridge_registration | to_nice_yaml(indent=2, width=999999) }}" + dest: "{{ matrix_rustpush_bridge_config_path }}/registration.yaml" + mode: 0644 + owner: "{{ matrix_user_name }}" + group: "{{ matrix_group_name }}" + register: matrix_rustpush_bridge_registration_result + +- name: Ensure rustpush-bridge support files installed + ansible.builtin.template: + src: "{{ role_path }}/templates/{{ item }}.j2" + dest: "{{ matrix_rustpush_bridge_base_path }}/{{ item }}" + mode: 0640 + owner: "{{ matrix_user_name }}" + group: "{{ matrix_group_name }}" + with_items: + - labels + register: matrix_rustpush_bridge_support_files_result + +- name: Ensure matrix-rustpush-bridge container network is created + community.general.docker_network: + enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}" + name: "{{ matrix_rustpush_bridge_container_network }}" + driver: bridge + driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}" + +- name: Ensure matrix-rustpush-bridge.service installed + ansible.builtin.template: + src: "{{ role_path }}/templates/systemd/matrix-rustpush-bridge.service.j2" + dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-rustpush-bridge.service" + mode: 0644 + register: matrix_rustpush_bridge_systemd_service_result + +- name: Determine whether matrix-rustpush-bridge needs a restart + ansible.builtin.set_fact: + matrix_rustpush_bridge_restart_necessary: >- + {{ + matrix_rustpush_bridge_config_result.changed | default(false) + or matrix_rustpush_bridge_registration_result.changed | default(false) + or matrix_rustpush_bridge_support_files_result.changed | default(false) + or matrix_rustpush_bridge_systemd_service_result.changed | default(false) + or matrix_rustpush_bridge_container_image_pull_result.changed | default(false) + or matrix_rustpush_bridge_container_image_build_result.changed | default(false) + }} diff --git a/roles/custom/matrix-bridge-imessage-rustpush/tasks/setup_uninstall.yml b/roles/custom/matrix-bridge-rustpush/tasks/setup_uninstall.yml similarity index 50% rename from roles/custom/matrix-bridge-imessage-rustpush/tasks/setup_uninstall.yml rename to roles/custom/matrix-bridge-rustpush/tasks/setup_uninstall.yml index 7ac351bbf..26a5d04e6 100644 --- a/roles/custom/matrix-bridge-imessage-rustpush/tasks/setup_uninstall.yml +++ b/roles/custom/matrix-bridge-rustpush/tasks/setup_uninstall.yml @@ -4,20 +4,20 @@ --- -- name: Check existence of matrix-imessage-rustpush service +- name: Check existence of matrix-rustpush-bridge service ansible.builtin.stat: - path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-imessage-rustpush.service" - register: matrix_imessage_rustpush_service_stat + path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-rustpush-bridge.service" + register: matrix_rustpush_bridge_service_stat -- when: matrix_imessage_rustpush_service_stat.stat.exists | bool +- when: matrix_rustpush_bridge_service_stat.stat.exists | bool block: - - name: Ensure matrix-imessage-rustpush is stopped + - name: Ensure matrix-rustpush-bridge is stopped ansible.builtin.service: - name: matrix-imessage-rustpush + name: matrix-rustpush-bridge state: stopped daemon_reload: true - - name: Ensure matrix-imessage-rustpush.service doesn't exist + - name: Ensure matrix-rustpush-bridge.service doesn't exist ansible.builtin.file: - path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-imessage-rustpush.service" + path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-rustpush-bridge.service" state: absent diff --git a/roles/custom/matrix-bridge-rustpush/tasks/validate_config.yml b/roles/custom/matrix-bridge-rustpush/tasks/validate_config.yml new file mode 100644 index 000000000..99011123f --- /dev/null +++ b/roles/custom/matrix-bridge-rustpush/tasks/validate_config.yml @@ -0,0 +1,19 @@ +# SPDX-FileCopyrightText: 2025 MDAD project contributors +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +--- + +- name: Fail if required RustPush settings not defined + ansible.builtin.fail: + msg: >- + You need to define a required configuration setting (`{{ item.name }}`). + when: "item.when | bool and lookup('vars', item.name, default='') | string | length == 0" + with_items: + - {'name': 'matrix_rustpush_bridge_appservice_token', when: true} + - {'name': 'matrix_rustpush_bridge_homeserver_address', when: true} + - {'name': 'matrix_rustpush_bridge_homeserver_token', when: true} + - {'name': 'matrix_rustpush_bridge_database_hostname', when: "{{ matrix_rustpush_bridge_database_engine == 'postgres' }}"} + - {'name': 'matrix_rustpush_bridge_container_network', when: true} + - {'name': 'matrix_rustpush_bridge_metrics_proxying_hostname', when: "{{ matrix_rustpush_bridge_metrics_proxying_enabled }}"} + - {'name': 'matrix_rustpush_bridge_metrics_proxying_path_prefix', when: "{{ matrix_rustpush_bridge_metrics_proxying_enabled }}"} diff --git a/roles/custom/matrix-bridge-imessage-rustpush/templates/Dockerfile.j2 b/roles/custom/matrix-bridge-rustpush/templates/Dockerfile.j2 similarity index 100% rename from roles/custom/matrix-bridge-imessage-rustpush/templates/Dockerfile.j2 rename to roles/custom/matrix-bridge-rustpush/templates/Dockerfile.j2 diff --git a/roles/custom/matrix-bridge-imessage-rustpush/templates/Dockerfile.j2.license b/roles/custom/matrix-bridge-rustpush/templates/Dockerfile.j2.license similarity index 100% rename from roles/custom/matrix-bridge-imessage-rustpush/templates/Dockerfile.j2.license rename to roles/custom/matrix-bridge-rustpush/templates/Dockerfile.j2.license diff --git a/roles/custom/matrix-bridge-imessage-rustpush/templates/config.yaml.j2 b/roles/custom/matrix-bridge-rustpush/templates/config.yaml.j2 similarity index 69% rename from roles/custom/matrix-bridge-imessage-rustpush/templates/config.yaml.j2 rename to roles/custom/matrix-bridge-rustpush/templates/config.yaml.j2 index ed99483f6..cddebe99b 100644 --- a/roles/custom/matrix-bridge-imessage-rustpush/templates/config.yaml.j2 +++ b/roles/custom/matrix-bridge-rustpush/templates/config.yaml.j2 @@ -4,16 +4,16 @@ network: # Displayname template for iMessage contacts. # Available variables: {{.FirstName}}, {{.LastName}}, {{.Nickname}}, # {{.Phone}}, {{.Email}}, {{.ID}} - displayname_template: {{ matrix_imessage_rustpush_network_displayname_template | to_json }} + displayname_template: {{ matrix_rustpush_bridge_network_displayname_template | to_json }} # How many days back to look for chats during initial sync. # Default is 365 (1 year). Set to 0 to use the default. - initial_sync_days: {{ matrix_imessage_rustpush_initial_sync_days | to_json }} + initial_sync_days: {{ matrix_rustpush_bridge_initial_sync_days | to_json }} # Config options that affect the central bridge module. bridge: # The prefix for commands. Only required in non-management rooms. - command_prefix: {{ matrix_imessage_rustpush_bridge_command_prefix | to_json }} + command_prefix: {{ matrix_rustpush_bridge_bridge_command_prefix | to_json }} # Should the bridge create a space for each login containing the rooms that account is in? personal_filtering_spaces: true # Whether the bridge should set names and avatars explicitly for DM portals. @@ -65,12 +65,12 @@ bridge: displayname_format: "{% raw %}{{ .DisambiguatedName }}{% endraw %}" # Permissions for using the bridge. - permissions: {{ matrix_imessage_rustpush_bridge_permissions | to_json }} + permissions: {{ matrix_rustpush_bridge_bridge_permissions | to_json }} # Config for the bridge's database. database: type: postgres - uri: {{ matrix_imessage_rustpush_database_uri | to_json }} + uri: {{ matrix_rustpush_bridge_database_uri | to_json }} max_open_conns: 5 max_idle_conns: 1 max_conn_idle_time: null @@ -78,34 +78,34 @@ database: # Homeserver details. homeserver: - address: {{ matrix_imessage_rustpush_homeserver_address | to_json }} - domain: {{ matrix_imessage_rustpush_homeserver_domain | to_json }} + address: {{ matrix_rustpush_bridge_homeserver_address | to_json }} + domain: {{ matrix_rustpush_bridge_homeserver_domain | to_json }} software: standard status_endpoint: message_send_checkpoint_endpoint: - async_media: {{ matrix_imessage_rustpush_homeserver_async_media | to_json }} + async_media: {{ matrix_rustpush_bridge_homeserver_async_media | to_json }} websocket: false ping_interval_seconds: 0 # Application service host/registration related details. appservice: - address: {{ matrix_imessage_rustpush_appservice_address | to_json }} - public_address: {{ matrix_imessage_rustpush_appservice_public_address | to_json }} + address: {{ matrix_rustpush_bridge_appservice_address | to_json }} + public_address: {{ matrix_rustpush_bridge_appservice_public_address | to_json }} hostname: 0.0.0.0 port: 8081 - id: imessage-rustpush + id: rustpush-bridge bot: - username: {{ matrix_imessage_rustpush_appservice_bot_username | to_json }} - displayname: {{ matrix_imessage_rustpush_appservice_bot_displayname | to_json(ensure_ascii=False) }} - avatar: {{ matrix_imessage_rustpush_appservice_bot_avatar | to_json }} + username: {{ matrix_rustpush_bridge_appservice_bot_username | to_json }} + displayname: {{ matrix_rustpush_bridge_appservice_bot_displayname | to_json(ensure_ascii=False) }} + avatar: {{ matrix_rustpush_bridge_appservice_bot_avatar | to_json }} ephemeral_events: true async_transactions: false - as_token: {{ matrix_imessage_rustpush_appservice_token | to_json }} - hs_token: {{ matrix_imessage_rustpush_homeserver_token | to_json }} + as_token: {{ matrix_rustpush_bridge_appservice_token | to_json }} + hs_token: {{ matrix_rustpush_bridge_homeserver_token | to_json }} # Localpart template of MXIDs for remote users. username_template: "{% raw %}imessage_{{.}}{% endraw %}" @@ -116,7 +116,7 @@ matrix: delivery_receipts: false message_error_notices: true sync_direct_chat_list: true - federate_rooms: {{ matrix_imessage_rustpush_matrix_federate_rooms | to_json }} + federate_rooms: {{ matrix_rustpush_bridge_matrix_federate_rooms | to_json }} upload_file_threshold: 5242880 # Segment-compatible analytics endpoint for tracking some events. @@ -128,15 +128,15 @@ analytics: # Settings for provisioning API provisioning: prefix: /_matrix/provision - shared_secret: {{ matrix_imessage_rustpush_provisioning_shared_secret | to_json }} + shared_secret: {{ matrix_rustpush_bridge_provisioning_shared_secret | to_json }} allow_matrix_auth: true debug_endpoints: false # Settings for backfilling messages. backfill: - enabled: {{ matrix_imessage_rustpush_backfill_enabled | to_json }} - max_initial_messages: {{ matrix_imessage_rustpush_backfill_max_initial_messages | to_json }} - max_catchup_messages: {{ matrix_imessage_rustpush_backfill_max_catchup_messages | to_json }} + enabled: {{ matrix_rustpush_bridge_backfill_enabled | to_json }} + max_initial_messages: {{ matrix_rustpush_bridge_backfill_max_initial_messages | to_json }} + max_catchup_messages: {{ matrix_rustpush_bridge_backfill_max_catchup_messages | to_json }} unread_hours_threshold: 720 threads: max_initial_messages: 50 @@ -151,18 +151,18 @@ backfill: double_puppet: servers: {} allow_discovery: false - secrets: {{ matrix_imessage_rustpush_double_puppet_secrets | to_json }} + secrets: {{ matrix_rustpush_bridge_double_puppet_secrets | to_json }} # End-to-bridge encryption support options. encryption: - allow: {{ matrix_imessage_rustpush_bridge_encryption_allow | to_json }} - default: {{ matrix_imessage_rustpush_bridge_encryption_default | to_json }} - require: {{ matrix_imessage_rustpush_bridge_encryption_require | to_json }} - appservice: {{ matrix_imessage_rustpush_bridge_encryption_appservice | to_json }} - msc4190: {{ matrix_imessage_rustpush_msc4190_enabled | to_json }} - self_sign: {{ matrix_imessage_rustpush_self_sign_enabled | to_json }} - allow_key_sharing: {{ matrix_imessage_rustpush_bridge_encryption_key_sharing_allow | to_json }} - pickle_key: {{ matrix_imessage_rustpush_bridge_encryption_pickle_key | to_json }} + allow: {{ matrix_rustpush_bridge_bridge_encryption_allow | to_json }} + default: {{ matrix_rustpush_bridge_bridge_encryption_default | to_json }} + require: {{ matrix_rustpush_bridge_bridge_encryption_require | to_json }} + appservice: {{ matrix_rustpush_bridge_bridge_encryption_appservice | to_json }} + msc4190: {{ matrix_rustpush_bridge_msc4190_enabled | to_json }} + self_sign: {{ matrix_rustpush_bridge_self_sign_enabled | to_json }} + allow_key_sharing: {{ matrix_rustpush_bridge_bridge_encryption_key_sharing_allow | to_json }} + pickle_key: {{ matrix_rustpush_bridge_bridge_encryption_pickle_key | to_json }} delete_keys: delete_outbound_on_ack: false dont_store_outbound: false @@ -184,7 +184,7 @@ encryption: # Logging config. logging: - min_level: {{ matrix_imessage_rustpush_logging_level | to_json }} + min_level: {{ matrix_rustpush_bridge_logging_level | to_json }} writers: - type: stdout format: pretty-colored diff --git a/roles/custom/matrix-bridge-imessage-rustpush/templates/config.yaml.j2.license b/roles/custom/matrix-bridge-rustpush/templates/config.yaml.j2.license similarity index 100% rename from roles/custom/matrix-bridge-imessage-rustpush/templates/config.yaml.j2.license rename to roles/custom/matrix-bridge-rustpush/templates/config.yaml.j2.license diff --git a/roles/custom/matrix-bridge-rustpush/templates/labels.j2 b/roles/custom/matrix-bridge-rustpush/templates/labels.j2 new file mode 100644 index 000000000..0b42e56be --- /dev/null +++ b/roles/custom/matrix-bridge-rustpush/templates/labels.j2 @@ -0,0 +1,52 @@ +{# +SPDX-FileCopyrightText: 2025 MDAD project contributors + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if matrix_rustpush_bridge_container_labels_traefik_enabled %} +traefik.enable=true + +{% if matrix_rustpush_bridge_container_labels_traefik_docker_network %} +traefik.docker.network={{ matrix_rustpush_bridge_container_labels_traefik_docker_network }} +{% endif %} + +traefik.http.services.matrix-rustpush-bridge-metrics.loadbalancer.server.port=8000 + +{% if matrix_rustpush_bridge_container_labels_metrics_enabled %} +############################################################ +# # +# Metrics # +# # +############################################################ + +{% if matrix_rustpush_bridge_container_labels_metrics_middleware_basic_auth_enabled %} +traefik.http.middlewares.matrix-rustpush-bridge-metrics-basic-auth.basicauth.users={{ matrix_rustpush_bridge_container_labels_metrics_middleware_basic_auth_users }} +traefik.http.routers.matrix-rustpush-bridge-metrics.middlewares=matrix-rustpush-bridge-metrics-basic-auth +{% endif %} + +traefik.http.routers.matrix-rustpush-bridge-metrics.rule={{ matrix_rustpush_bridge_container_labels_metrics_traefik_rule }} + +{% if matrix_rustpush_bridge_container_labels_metrics_traefik_priority | int > 0 %} +traefik.http.routers.matrix-rustpush-bridge-metrics.priority={{ matrix_rustpush_bridge_container_labels_metrics_traefik_priority }} +{% endif %} + +traefik.http.routers.matrix-rustpush-bridge-metrics.service=matrix-rustpush-bridge-metrics +traefik.http.routers.matrix-rustpush-bridge-metrics.entrypoints={{ matrix_rustpush_bridge_container_labels_metrics_traefik_entrypoints }} + +traefik.http.routers.matrix-rustpush-bridge-metrics.tls={{ matrix_rustpush_bridge_container_labels_metrics_traefik_tls | to_json }} +{% if matrix_rustpush_bridge_container_labels_metrics_traefik_tls %} +traefik.http.routers.matrix-rustpush-bridge-metrics.tls.certResolver={{ matrix_rustpush_bridge_container_labels_metrics_traefik_tls_certResolver }} +{% endif %} + +############################################################ +# # +# /Metrics # +# # +############################################################ +{% endif %} + + +{% endif %} + +{{ matrix_rustpush_bridge_container_labels_additional_labels }} diff --git a/roles/custom/matrix-bridge-imessage-rustpush/templates/labels.j2.license b/roles/custom/matrix-bridge-rustpush/templates/labels.j2.license similarity index 100% rename from roles/custom/matrix-bridge-imessage-rustpush/templates/labels.j2.license rename to roles/custom/matrix-bridge-rustpush/templates/labels.j2.license diff --git a/roles/custom/matrix-bridge-imessage-rustpush/templates/systemd/matrix-imessage-rustpush.service.j2 b/roles/custom/matrix-bridge-rustpush/templates/systemd/matrix-rustpush-bridge.service.j2 similarity index 57% rename from roles/custom/matrix-bridge-imessage-rustpush/templates/systemd/matrix-imessage-rustpush.service.j2 rename to roles/custom/matrix-bridge-rustpush/templates/systemd/matrix-rustpush-bridge.service.j2 index 3c40267a2..3a38291ec 100644 --- a/roles/custom/matrix-bridge-imessage-rustpush/templates/systemd/matrix-imessage-rustpush.service.j2 +++ b/roles/custom/matrix-bridge-rustpush/templates/systemd/matrix-rustpush-bridge.service.j2 @@ -1,11 +1,11 @@ #jinja2: lstrip_blocks: True [Unit] -Description=Matrix iMessage RustPush bridge -{% for service in matrix_imessage_rustpush_systemd_required_services_list %} +Description=Matrix RustPush bridge +{% for service in matrix_rustpush_bridge_systemd_required_services_list %} Requires={{ service }} After={{ service }} {% endfor %} -{% for service in matrix_imessage_rustpush_systemd_wanted_services_list %} +{% for service in matrix_rustpush_bridge_systemd_wanted_services_list %} Wants={{ service }} {% endfor %} DefaultDependencies=no @@ -13,36 +13,36 @@ DefaultDependencies=no [Service] Type=simple Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}" -ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop -t {{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-imessage-rustpush 2>/dev/null || true' -ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-imessage-rustpush 2>/dev/null || true' +ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop -t {{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-rustpush-bridge 2>/dev/null || true' +ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-rustpush-bridge 2>/dev/null || true' ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \ --rm \ - --name=matrix-imessage-rustpush \ + --name=matrix-rustpush-bridge \ --log-driver=none \ --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ --cap-drop=ALL \ - --network={{ matrix_imessage_rustpush_container_network }} \ - --mount type=bind,src={{ matrix_imessage_rustpush_config_path }},dst=/config,ro \ - --mount type=bind,src={{ matrix_imessage_rustpush_data_path }},dst=/data \ - --label-file={{ matrix_imessage_rustpush_base_path }}/labels \ - {% for arg in matrix_imessage_rustpush_container_extra_arguments %} + --network={{ matrix_rustpush_bridge_container_network }} \ + --mount type=bind,src={{ matrix_rustpush_bridge_config_path }},dst=/config,ro \ + --mount type=bind,src={{ matrix_rustpush_bridge_data_path }},dst=/data \ + --label-file={{ matrix_rustpush_bridge_base_path }}/labels \ + {% for arg in matrix_rustpush_bridge_container_extra_arguments %} {{ arg }} \ {% endfor %} - {{ matrix_imessage_rustpush_docker_image }} \ + {{ matrix_rustpush_bridge_docker_image }} \ /usr/bin/mautrix-imessage-v2 -c /config/config.yaml -r /config/registration.yaml --no-update -{% for network in matrix_imessage_rustpush_container_additional_networks %} -ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-imessage-rustpush +{% for network in matrix_rustpush_bridge_container_additional_networks %} +ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-rustpush-bridge {% endfor %} -ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-imessage-rustpush +ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-rustpush-bridge -ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop -t {{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-imessage-rustpush 2>/dev/null || true' -ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-imessage-rustpush 2>/dev/null || true' +ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop -t {{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-rustpush-bridge 2>/dev/null || true' +ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-rustpush-bridge 2>/dev/null || true' Restart=always RestartSec=30 -SyslogIdentifier=matrix-imessage-rustpush +SyslogIdentifier=matrix-rustpush-bridge [Install] WantedBy=multi-user.target diff --git a/roles/custom/matrix-bridge-imessage-rustpush/templates/systemd/matrix-imessage-rustpush.service.j2.license b/roles/custom/matrix-bridge-rustpush/templates/systemd/matrix-rustpush-bridge.service.j2.license similarity index 100% rename from roles/custom/matrix-bridge-imessage-rustpush/templates/systemd/matrix-imessage-rustpush.service.j2.license rename to roles/custom/matrix-bridge-rustpush/templates/systemd/matrix-rustpush-bridge.service.j2.license diff --git a/setup.yml b/setup.yml index 4369a83fe..241cad51a 100644 --- a/setup.yml +++ b/setup.yml @@ -71,7 +71,7 @@ - custom/matrix-bridge-mautrix-discord - custom/matrix-bridge-mautrix-slack - custom/matrix-bridge-mautrix-bluesky - - custom/matrix-bridge-imessage-rustpush + - custom/matrix-bridge-rustpush - custom/matrix-bridge-mx-puppet-groupme - custom/matrix-bridge-mx-puppet-steam - custom/matrix-bridge-postmoogle