Просмотр исходного кода

Rename matrix_rustpush_bridge_* variables to matrix_bridge_rustpush_*

Part of adopting a uniform naming policy for bridge variables,
where the variable prefix matches the role directory name.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pull/5434/head
Slavi Pantaleev 11 часов назад
Родитель
Сommit
267d578393
10 измененных файлов: 275 добавлений и 275 удалений
  1. +6
    -6
      docs/configuring-playbook-bridge-rustpush.md
  2. +36
    -36
      group_vars/matrix_servers
  3. +122
    -122
      roles/custom/matrix-bridge-rustpush/defaults/main.yml
  4. +3
    -3
      roles/custom/matrix-bridge-rustpush/tasks/main.yml
  5. +37
    -37
      roles/custom/matrix-bridge-rustpush/tasks/setup_install.yml
  6. +2
    -2
      roles/custom/matrix-bridge-rustpush/tasks/setup_uninstall.yml
  7. +7
    -7
      roles/custom/matrix-bridge-rustpush/tasks/validate_config.yml
  8. +38
    -38
      roles/custom/matrix-bridge-rustpush/templates/config.yaml.j2
  9. +14
    -14
      roles/custom/matrix-bridge-rustpush/templates/labels.j2
  10. +10
    -10
      roles/custom/matrix-bridge-rustpush/templates/systemd/matrix-rustpush-bridge.service.j2

+ 6
- 6
docs/configuring-playbook-bridge-rustpush.md Просмотреть файл

@@ -40,7 +40,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_rustpush_bridge_enabled: true
matrix_bridge_rustpush_enabled: true
```

### Disable Backfill (optional)
@@ -48,7 +48,7 @@ matrix_rustpush_bridge_enabled: true
Backfill can be disabled globally if desired via config. By default, the bridge will backfill from iCloud (CloudKit) and APNS if available. Backfill from `chat.db` is only possible when the bridge is running on MacOS.

```yaml
matrix_rustpush_bridge_backfill_enabled: false
matrix_bridge_rustpush_backfill_enabled: false
```

### Extending the Configuration
@@ -88,13 +88,13 @@ The default logging level for this component is `warn`. If you want to increase

```yaml
# Valid values: fatal, error, warn, info, debug, trace
matrix_rustpush_bridge_logging_level: 'debug'
matrix_bridge_rustpush_logging_level: 'debug'

# Enable debug logging for RustPush
matrix_rustpush_bridge_rust_log: "warn,rustpushgo=info,openabsinthe=debug"
matrix_bridge_rustpush_rust_log: "warn,rustpushgo=info,openabsinthe=debug"
```
## Notable Configuration Options
- `matrix_rustpush_bridge_statuskit_notifications` will display StatusKit information for conversation participants. In some clients, this update will cause the DM to be pushed to the top of the conversation list continuously, so this option is disabled by default.
- `matrix_rustpush_bridge_statuskit_notification_style` can be set to either `topic` or `notice`
- `matrix_bridge_rustpush_statuskit_notifications` will display StatusKit information for conversation participants. In some clients, this update will cause the DM to be pushed to the top of the conversation list continuously, so this option is disabled by default.
- `matrix_bridge_rustpush_statuskit_notification_style` can be set to either `topic` or `notice`
- `topic` sets the status as a room topic. In supported clients (like Cinny and Sable), this will display `🔕 Focus` as a second line when the person has focus mode enabled.
- `notice` sends an `m.notice` event to the room which will display text in the room but should not generate a notification

+ 36
- 36
group_vars/matrix_servers Просмотреть файл

@@ -112,7 +112,7 @@ matrix_homeserver_container_extra_arguments_auto: |
+
(['--mount type=bind,src=' + matrix_bridge_mautrix_bluesky_config_path + '/registration.yaml,dst=/matrix-mautrix-bluesky-registration.yaml,ro'] if matrix_bridge_mautrix_bluesky_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_bridge_rustpush_config_path + '/registration.yaml,dst=/matrix-rustpush-bridge-registration.yaml,ro'] if matrix_bridge_rustpush_enabled else [])
+
(['--mount type=bind,src=' + matrix_bridge_mautrix_discord_config_path + '/registration.yaml,dst=/matrix-mautrix-discord-registration.yaml,ro'] if matrix_bridge_mautrix_discord_enabled else [])
+
@@ -171,7 +171,7 @@ matrix_homeserver_app_service_config_files_auto: |
+
(['/matrix-mautrix-bluesky-registration.yaml'] if matrix_bridge_mautrix_bluesky_enabled else [])
+
(['/matrix-rustpush-bridge-registration.yaml'] if matrix_rustpush_bridge_enabled else [])
(['/matrix-rustpush-bridge-registration.yaml'] if matrix_bridge_rustpush_enabled else [])
+
(['/matrix-mautrix-discord-registration.yaml'] if matrix_bridge_mautrix_discord_enabled else [])
+
@@ -422,9 +422,9 @@ devture_systemd_service_manager_services_list_auto: |
([{
'name': 'matrix-rustpush-bridge.service',
'priority': 2000,
'restart_necessary': (matrix_rustpush_bridge_restart_necessary | bool),
'restart_necessary': (matrix_bridge_rustpush_restart_necessary | bool),
'groups': ['matrix', 'bridges', 'matrix-rustpush-bridge'],
}] if matrix_rustpush_bridge_enabled else [])
}] if matrix_bridge_rustpush_enabled else [])
+
([{
'name': 'matrix-mautrix-discord.service',
@@ -1429,62 +1429,62 @@ matrix_bridge_mautrix_bluesky_database_password: "{{ (matrix_homeserver_generic_
######################################################################

# We don't enable bridges by default.
matrix_rustpush_bridge_enabled: false
matrix_bridge_rustpush_enabled: false

matrix_rustpush_bridge_systemd_required_services_list_auto: |
matrix_bridge_rustpush_systemd_required_services_list_auto: |
{{
matrix_addons_homeserver_systemd_services_list
+
([postgres_identifier ~ '.service'] if (postgres_enabled and matrix_rustpush_bridge_database_hostname == postgres_connection_hostname) else [])
([postgres_identifier ~ '.service'] if (postgres_enabled and matrix_bridge_rustpush_database_hostname == postgres_connection_hostname) else [])
}}

matrix_rustpush_bridge_container_network: "{{ matrix_addons_container_network }}"
matrix_bridge_rustpush_container_network: "{{ matrix_addons_container_network }}"

matrix_rustpush_bridge_container_additional_networks_auto: |-
matrix_bridge_rustpush_container_additional_networks_auto: |-
{{
(
([] if matrix_addons_homeserver_container_network == '' else [matrix_addons_homeserver_container_network])
+
([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 [])
([postgres_container_network] if (postgres_enabled and matrix_bridge_rustpush_database_hostname == postgres_connection_hostname and matrix_bridge_rustpush_container_network != postgres_container_network) 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 [])
([matrix_playbook_reverse_proxyable_services_additional_network] if matrix_playbook_reverse_proxyable_services_additional_network and matrix_bridge_rustpush_container_labels_traefik_enabled else [])
) | unique
}}

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_bridge_rustpush_container_labels_traefik_enabled: "{{ matrix_playbook_reverse_proxy_type in ['playbook-managed-traefik', 'other-traefik-container'] }}"
matrix_bridge_rustpush_container_labels_traefik_docker_network: "{{ matrix_playbook_reverse_proxyable_services_additional_network }}"
matrix_bridge_rustpush_container_labels_traefik_entrypoints: "{{ traefik_entrypoint_primary }}"
matrix_bridge_rustpush_container_labels_traefik_tls_certResolver: "{{ traefik_certResolver_primary }}"

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_bridge_rustpush_container_labels_metrics_middleware_basic_auth_enabled: "{{ matrix_metrics_exposure_http_basic_auth_enabled }}"
matrix_bridge_rustpush_container_labels_metrics_middleware_basic_auth_users: "{{ matrix_metrics_exposure_http_basic_auth_users }}"

matrix_rustpush_bridge_appservice_token: "{{ (matrix_homeserver_generic_secret_key + ':imsg.as.token') | hash('sha512') | to_uuid }}"
matrix_bridge_rustpush_appservice_token: "{{ (matrix_homeserver_generic_secret_key + ':imsg.as.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_bridge_rustpush_homeserver_address: "{{ matrix_addons_homeserver_client_api_url }}"
matrix_bridge_rustpush_homeserver_token: "{{ (matrix_homeserver_generic_secret_key + ':imsg.hs.token') | hash('sha512') | to_uuid }}"

matrix_rustpush_bridge_homeserver_async_media: "{{ matrix_homeserver_implementation in ['synapse'] }}"
matrix_bridge_rustpush_homeserver_async_media: "{{ matrix_homeserver_implementation in ['synapse'] }}"

matrix_rustpush_bridge_provisioning_shared_secret: "{{ (matrix_homeserver_generic_secret_key + ':mau.imsg.prov') | hash('sha512') | to_uuid }}"
matrix_bridge_rustpush_provisioning_shared_secret: "{{ (matrix_homeserver_generic_secret_key + ':mau.imsg.prov') | hash('sha512') | to_uuid }}"

matrix_rustpush_bridge_double_puppet_secrets_auto: |-
matrix_bridge_rustpush_double_puppet_secrets_auto: |-
{{
({
matrix_rustpush_bridge_homeserver_domain: ("as_token:" + matrix_appservice_double_puppet_registration_as_token)
matrix_bridge_rustpush_homeserver_domain: ("as_token:" + matrix_appservice_double_puppet_registration_as_token)
})
if matrix_appservice_double_puppet_enabled
else {}
}}

matrix_rustpush_bridge_metrics_enabled: "{{ prometheus_enabled or matrix_metrics_exposure_enabled }}"
matrix_bridge_rustpush_metrics_enabled: "{{ prometheus_enabled or matrix_metrics_exposure_enabled }}"

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_bridge_rustpush_metrics_proxying_enabled: "{{ matrix_bridge_rustpush_metrics_enabled and matrix_metrics_exposure_enabled }}"
matrix_bridge_rustpush_metrics_proxying_hostname: "{{ matrix_metrics_exposure_hostname }}"
matrix_bridge_rustpush_metrics_proxying_path_prefix: "{{ matrix_metrics_exposure_path_prefix }}/rustpush-bridge"

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_rustpush_database_hostname: "{{ postgres_connection_hostname if postgres_enabled else '' }}"
matrix_bridge_rustpush_database_password: "{{ (matrix_homeserver_generic_secret_key + ':mau.imsg.db') | hash('sha512') | to_uuid if postgres_enabled else '' }}"

######################################################################
#
@@ -4177,10 +4177,10 @@ postgres_managed_databases_auto: |
}] if (matrix_bridge_mautrix_bluesky_enabled and matrix_bridge_mautrix_bluesky_database_engine == 'postgres' and matrix_bridge_mautrix_bluesky_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_bridge_rustpush_database_name,
'username': matrix_bridge_rustpush_database_username,
'password': matrix_bridge_rustpush_database_password,
}] if (matrix_bridge_rustpush_enabled and matrix_bridge_rustpush_database_engine == 'postgres' and matrix_bridge_rustpush_database_hostname == postgres_connection_hostname) else [])
+
([{
'name': matrix_bridge_mautrix_googlechat_database_name,
@@ -5126,9 +5126,9 @@ matrix_ketesa_config_asManagedUsers_auto: |
] if matrix_bridge_mautrix_bluesky_enabled else [])
+
([
'^@'+(matrix_rustpush_bridge_appservice_bot_username | default('') | regex_escape)+':'+(matrix_domain | regex_escape)+'$',
'^@'+(matrix_bridge_rustpush_appservice_bot_username | default('') | regex_escape)+':'+(matrix_domain | regex_escape)+'$',
'^@rustpush_[a-zA-Z0-9_.+-]+:'+(matrix_domain | regex_escape)+'$',
] if matrix_rustpush_bridge_enabled else [])
] if matrix_bridge_rustpush_enabled else [])
+
([
'^@'+(matrix_bridge_mautrix_discord_appservice_bot_username | default('') | regex_escape)+':'+(matrix_domain | regex_escape)+'$',


+ 122
- 122
roles/custom/matrix-bridge-rustpush/defaults/main.yml Просмотреть файл

@@ -7,98 +7,98 @@
# matrix-bridge-rustpush is a Matrix <-> iMessage bridge using RustPush
# Project source code URL: https://github.com/jasonlaguidice/imessage

matrix_rustpush_bridge_enabled: false
matrix_bridge_rustpush_enabled: false

matrix_rustpush_bridge_container_image_self_build: false
matrix_rustpush_bridge_container_image_self_build_repo: "https://github.com/jasonlaguidice/imessage.git"
matrix_rustpush_bridge_container_image_self_build_repo_version: "{{ 'master' if matrix_rustpush_bridge_version == 'latest' else matrix_rustpush_bridge_version }}"
matrix_bridge_rustpush_container_image_self_build: false
matrix_bridge_rustpush_container_image_self_build_repo: "https://github.com/jasonlaguidice/imessage.git"
matrix_bridge_rustpush_container_image_self_build_repo_version: "{{ 'master' if matrix_bridge_rustpush_version == 'latest' else matrix_bridge_rustpush_version }}"

# renovate: datasource=docker depName=ghcr.io/jasonlaguidice/imessage
matrix_rustpush_bridge_version: v0.0.3
matrix_rustpush_bridge_container_image: "{{ matrix_rustpush_bridge_container_image_registry_prefix }}jasonlaguidice/imessage:{{ matrix_rustpush_bridge_version }}"
matrix_rustpush_bridge_container_image_registry_prefix: "{{ 'localhost/' if matrix_rustpush_bridge_container_image_self_build else matrix_rustpush_bridge_container_image_registry_prefix_upstream }}"
matrix_rustpush_bridge_container_image_registry_prefix_upstream: "{{ matrix_rustpush_bridge_container_image_registry_prefix_upstream_default }}"
matrix_rustpush_bridge_container_image_registry_prefix_upstream_default: "ghcr.io/"
matrix_rustpush_bridge_base_path: "{{ matrix_base_data_path }}/matrix-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_container_src_files_path: "{{ matrix_rustpush_bridge_base_path }}/docker-src"
matrix_rustpush_bridge_homeserver_address: ""
matrix_bridge_rustpush_version: v0.0.3
matrix_bridge_rustpush_container_image: "{{ matrix_bridge_rustpush_container_image_registry_prefix }}jasonlaguidice/imessage:{{ matrix_bridge_rustpush_version }}"
matrix_bridge_rustpush_container_image_registry_prefix: "{{ 'localhost/' if matrix_bridge_rustpush_container_image_self_build else matrix_bridge_rustpush_container_image_registry_prefix_upstream }}"
matrix_bridge_rustpush_container_image_registry_prefix_upstream: "{{ matrix_bridge_rustpush_container_image_registry_prefix_upstream_default }}"
matrix_bridge_rustpush_container_image_registry_prefix_upstream_default: "ghcr.io/"
matrix_bridge_rustpush_base_path: "{{ matrix_base_data_path }}/matrix-rustpush-bridge"
matrix_bridge_rustpush_config_path: "{{ matrix_bridge_rustpush_base_path }}/config"
matrix_bridge_rustpush_data_path: "{{ matrix_bridge_rustpush_base_path }}/data"
matrix_bridge_rustpush_container_src_files_path: "{{ matrix_bridge_rustpush_base_path }}/docker-src"
matrix_bridge_rustpush_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_bridge_rustpush_homeserver_async_media: false
matrix_bridge_rustpush_homeserver_domain: '{{ matrix_domain }}'
matrix_bridge_rustpush_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 }}"
matrix_bridge_rustpush_msc4190_enabled: "{{ matrix_bridges_msc4190_enabled }}"
matrix_bridge_rustpush_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: ''
matrix_bridge_rustpush_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}} (iMessage){% endraw %}"
matrix_rustpush_bridge_cloudkit_backfill: true
matrix_rustpush_bridge_video_transcoding: true
matrix_rustpush_bridge_heic_conversion: true
matrix_rustpush_bridge_disable_facetime: false
matrix_rustpush_bridge_statuskit_notifications: false
matrix_rustpush_bridge_statuskit_share_on_startup: true
# Only takes effect when `matrix_rustpush_bridge_statuskit_notifications` is true.
matrix_bridge_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}} (iMessage){% endraw %}"
matrix_bridge_rustpush_cloudkit_backfill: true
matrix_bridge_rustpush_video_transcoding: true
matrix_bridge_rustpush_heic_conversion: true
matrix_bridge_rustpush_disable_facetime: false
matrix_bridge_rustpush_statuskit_notifications: false
matrix_bridge_rustpush_statuskit_share_on_startup: true
# Only takes effect when `matrix_bridge_rustpush_statuskit_notifications` is true.
# - topic: sets the contact's DM room topic to their Focus/DND state (e.g. "🔕 Do Not Disturb"), clearing it when available.
# - notice: posts a silent m.notice instead (legacy behavior).
# Group chats always use `notice`, regardless of this setting.
matrix_rustpush_bridge_statuskit_notification_style: topic
matrix_bridge_rustpush_statuskit_notification_style: topic

matrix_rustpush_bridge_bridge_command_prefix: "!im"
matrix_bridge_rustpush_bridge_command_prefix: "!im"

matrix_rustpush_bridge_bridge_permissions: |
matrix_bridge_rustpush_bridge_permissions: |
{{
{matrix_rustpush_bridge_homeserver_domain: 'user'}
{matrix_bridge_rustpush_homeserver_domain: 'user'}
| combine({matrix_admin: 'admin'} if matrix_admin else {})
}}

matrix_rustpush_bridge_container_network: ""
matrix_bridge_rustpush_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_bridge_rustpush_container_additional_networks: "{{ matrix_bridge_rustpush_container_additional_networks_auto + matrix_bridge_rustpush_container_additional_networks_custom }}"
matrix_bridge_rustpush_container_additional_networks_auto: []
matrix_bridge_rustpush_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.
# matrix_bridge_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_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
# To inject your own other container labels, see `matrix_bridge_rustpush_container_labels_additional_labels`.
matrix_bridge_rustpush_container_labels_traefik_enabled: true
matrix_bridge_rustpush_container_labels_traefik_docker_network: "{{ matrix_bridge_rustpush_container_network }}"
matrix_bridge_rustpush_container_labels_traefik_entrypoints: web-secure
matrix_bridge_rustpush_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
matrix_bridge_rustpush_container_labels_metrics_enabled: "{{ matrix_bridge_rustpush_metrics_enabled and matrix_bridge_rustpush_metrics_proxying_enabled }}"
matrix_bridge_rustpush_container_labels_metrics_traefik_rule: "Host(`{{ matrix_bridge_rustpush_metrics_proxying_hostname }}`) && PathPrefix(`{{ matrix_bridge_rustpush_metrics_proxying_path_prefix }}`)"
matrix_bridge_rustpush_container_labels_metrics_traefik_priority: 0
matrix_bridge_rustpush_container_labels_metrics_traefik_entrypoints: "{{ matrix_bridge_rustpush_container_labels_traefik_entrypoints }}"
matrix_bridge_rustpush_container_labels_metrics_traefik_tls: "{{ matrix_bridge_rustpush_container_labels_metrics_traefik_entrypoints != 'web' }}"
matrix_bridge_rustpush_container_labels_metrics_traefik_tls_certResolver: "{{ matrix_bridge_rustpush_container_labels_traefik_tls_certResolver }}" # noqa var-naming
matrix_bridge_rustpush_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_bridge_rustpush_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.
# matrix_bridge_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_rustpush_bridge_container_labels_additional_labels: |
# matrix_bridge_rustpush_container_labels_additional_labels: |
# my.label=1
# another.label="here"
matrix_rustpush_bridge_container_labels_additional_labels: ''
matrix_bridge_rustpush_container_labels_additional_labels: ''

# A list of extra arguments to pass to the container
matrix_rustpush_bridge_container_extra_arguments: []
matrix_bridge_rustpush_container_extra_arguments: []

# Override the Rust log filter passed to the bridge container via RUST_LOG.
# Leave empty to use the bridge's built-in default
@@ -111,138 +111,138 @@ matrix_rustpush_bridge_container_extra_arguments: []
#
# The open_absinthe crate logs NAC hardware-key diagnostics at INFO and emulator
# state at DEBUG. These are suppressed by default to reduce log noise.
matrix_rustpush_bridge_rust_log: ""
matrix_bridge_rustpush_rust_log: ""

# 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: []
matrix_bridge_rustpush_systemd_required_services_list: "{{ matrix_bridge_rustpush_systemd_required_services_list_default + matrix_bridge_rustpush_systemd_required_services_list_auto + matrix_bridge_rustpush_systemd_required_services_list_custom }}"
matrix_bridge_rustpush_systemd_required_services_list_default: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}"
matrix_bridge_rustpush_systemd_required_services_list_auto: []
matrix_bridge_rustpush_systemd_required_services_list_custom: []

# List of systemd services that matrix-rustpush-bridge.service wants
matrix_rustpush_bridge_systemd_wanted_services_list: []
matrix_bridge_rustpush_systemd_wanted_services_list: []

matrix_rustpush_bridge_appservice_token: ''
matrix_rustpush_bridge_homeserver_token: ''
matrix_bridge_rustpush_appservice_token: ''
matrix_bridge_rustpush_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: false
matrix_bridge_rustpush_matrix_federate_rooms: false

# Database-related configuration fields.
#
# To use Postgres:
# - adjust your database credentials via the `matrix_rustpush_bridge_postgres_*` variables
matrix_rustpush_bridge_database_engine: 'postgres'
# - adjust your database credentials via the `matrix_bridge_rustpush_postgres_*` variables
matrix_bridge_rustpush_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_bridge_rustpush_database_username: 'matrix_rustpush_bridge'
matrix_bridge_rustpush_database_password: 'some-password'
matrix_bridge_rustpush_database_hostname: ''
matrix_bridge_rustpush_database_port: 5432
matrix_bridge_rustpush_database_name: 'matrix_rustpush_bridge'
matrix_bridge_rustpush_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_bridge_rustpush_database_connection_string: 'postgres://{{ matrix_bridge_rustpush_database_username }}:{{ matrix_bridge_rustpush_database_password }}@{{ matrix_bridge_rustpush_database_hostname }}:{{ matrix_bridge_rustpush_database_port }}/{{ matrix_bridge_rustpush_database_name }}?sslmode={{ matrix_bridge_rustpush_database_sslmode }}'

matrix_rustpush_bridge_database_uri: "{{
matrix_bridge_rustpush_database_uri: "{{
{
'postgres': matrix_rustpush_bridge_database_connection_string,
}[matrix_rustpush_bridge_database_engine]
'postgres': matrix_bridge_rustpush_database_connection_string,
}[matrix_bridge_rustpush_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_bridge_rustpush_double_puppet_secrets: "{{ matrix_bridge_rustpush_double_puppet_secrets_auto | combine(matrix_bridge_rustpush_double_puppet_secrets_custom) }}"
matrix_bridge_rustpush_double_puppet_secrets_auto: {}
matrix_bridge_rustpush_double_puppet_secrets_custom: {}

matrix_rustpush_bridge_appservice_bot_username: rustpushbot
matrix_rustpush_bridge_appservice_bot_displayname: RustPush bridge bot
matrix_rustpush_bridge_appservice_bot_avatar: ''
matrix_bridge_rustpush_appservice_bot_username: rustpushbot
matrix_bridge_rustpush_appservice_bot_displayname: RustPush bridge bot
matrix_bridge_rustpush_appservice_bot_avatar: ''

# Localpart template for MXIDs of remote (iMessage) users.
# The `{{.}}` placeholder expands to the iMessage handle (phone/email).
matrix_rustpush_bridge_appservice_username_template: "{% raw %}rustpush_{{.}}{% endraw %}"
matrix_bridge_rustpush_appservice_username_template: "{% raw %}rustpush_{{.}}{% endraw %}"

# 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
matrix_bridge_rustpush_backfill_enabled: false
# Maximum number of messages to backfill in empty rooms
matrix_rustpush_bridge_backfill_max_initial_messages: 50
matrix_bridge_rustpush_backfill_max_initial_messages: 50

# Maximum number of missed messages to backfill after bridge restarts
matrix_rustpush_bridge_backfill_max_catchup_messages: 500
matrix_bridge_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_rustpush_bridge_initial_sync_days: 365
matrix_bridge_rustpush_initial_sync_days: 365

# 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
matrix_bridge_rustpush_provisioning_shared_secret: disable

# Minimum severity of journal log messages.
# Valid values: fatal, error, warn, info, debug, trace
matrix_rustpush_bridge_logging_level: 'warn'
matrix_bridge_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_rustpush_bridge_metrics_proxying_enabled`.
matrix_rustpush_bridge_metrics_enabled: false
# If metrics need to be consumed by another (external) Prometheus server, consider exposing them via `matrix_bridge_rustpush_metrics_proxying_enabled`.
matrix_bridge_rustpush_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: ''
matrix_bridge_rustpush_metrics_proxying_enabled: false
matrix_bridge_rustpush_metrics_proxying_hostname: ''
matrix_bridge_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_rustpush_bridge_configuration_extension_yaml`)
# For a more advanced customization, you can extend the default (see `matrix_bridge_rustpush_configuration_extension_yaml`)
# or completely replace this variable with your own template.
matrix_rustpush_bridge_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}"
matrix_bridge_rustpush_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}"

matrix_rustpush_bridge_configuration_extension_yaml: |
matrix_bridge_rustpush_configuration_extension_yaml: |
# Your custom YAML configuration goes here.
# This configuration extends the default starting configuration (`matrix_rustpush_bridge_configuration_yaml`).
# This configuration extends the default starting configuration (`matrix_bridge_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_rustpush_bridge_configuration_yaml`.
# completely redefining `matrix_bridge_rustpush_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 {} }}"
matrix_bridge_rustpush_configuration_extension: "{{ matrix_bridge_rustpush_configuration_extension_yaml | from_yaml if matrix_bridge_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_rustpush_bridge_configuration_yaml`.
matrix_rustpush_bridge_configuration: "{{ matrix_rustpush_bridge_configuration_yaml | from_yaml | combine(matrix_rustpush_bridge_configuration_extension, recursive=True) }}"
# You most likely don't need to touch this variable. Instead, see `matrix_bridge_rustpush_configuration_yaml`.
matrix_bridge_rustpush_configuration: "{{ matrix_bridge_rustpush_configuration_yaml | from_yaml | combine(matrix_bridge_rustpush_configuration_extension, recursive=True) }}"

matrix_rustpush_bridge_registration_yaml: |
matrix_bridge_rustpush_registration_yaml: |
id: rustpush-bridge
as_token: "{{ matrix_rustpush_bridge_appservice_token }}"
hs_token: "{{ matrix_rustpush_bridge_homeserver_token }}"
as_token: "{{ matrix_bridge_rustpush_appservice_token }}"
hs_token: "{{ matrix_bridge_rustpush_homeserver_token }}"
namespaces:
users:
- exclusive: true
regex: '^@rustpush_.+:{{ matrix_rustpush_bridge_homeserver_domain | regex_escape }}$'
regex: '^@rustpush_.+:{{ matrix_bridge_rustpush_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 }}
regex: '^@{{ matrix_bridge_rustpush_appservice_bot_username | regex_escape }}:{{ matrix_bridge_rustpush_homeserver_domain | regex_escape }}$'
url: {{ matrix_bridge_rustpush_appservice_address }}
sender_localpart: _bot_{{ matrix_bridge_rustpush_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 }}
io.element.msc4190: {{ matrix_bridge_rustpush_msc4190_enabled | to_json }}

matrix_rustpush_bridge_registration: "{{ matrix_rustpush_bridge_registration_yaml | from_yaml }}"
matrix_bridge_rustpush_registration: "{{ matrix_bridge_rustpush_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
matrix_bridge_rustpush_bridge_encryption_allow: "{{ matrix_bridges_encryption_enabled }}"
matrix_bridge_rustpush_bridge_encryption_default: "{{ matrix_bridges_encryption_default }}"
matrix_bridge_rustpush_bridge_encryption_require: false
matrix_bridge_rustpush_bridge_encryption_appservice: false
matrix_bridge_rustpush_bridge_encryption_key_sharing_allow: "{{ matrix_bridge_rustpush_bridge_encryption_allow }}"
matrix_bridge_rustpush_bridge_encryption_pickle_key: mautrix.bridge.e2ee
# matrix_bridge_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).
#
@@ -250,4 +250,4 @@ matrix_rustpush_bridge_bridge_encryption_pickle_key: mautrix.bridge.e2ee
# 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
matrix_bridge_rustpush_restart_necessary: false

+ 3
- 3
roles/custom/matrix-bridge-rustpush/tasks/main.yml Просмотреть файл

@@ -11,15 +11,15 @@
- install-all
- install-rustpush-bridge
block:
- when: matrix_rustpush_bridge_enabled | bool
- when: matrix_bridge_rustpush_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml"

- when: matrix_rustpush_bridge_enabled | bool
- when: matrix_bridge_rustpush_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_install.yml"

- tags:
- setup-all
- setup-rustpush-bridge
block:
- when: not matrix_rustpush_bridge_enabled | bool
- when: not matrix_bridge_rustpush_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"

+ 37
- 37
roles/custom/matrix-bridge-rustpush/tasks/setup_install.yml Просмотреть файл

@@ -13,80 +13,80 @@
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_container_src_files_path }}", when: "{{ matrix_rustpush_bridge_container_image_self_build }}"}
- {path: "{{ matrix_bridge_rustpush_base_path }}", when: true}
- {path: "{{ matrix_bridge_rustpush_config_path }}", when: true}
- {path: "{{ matrix_bridge_rustpush_data_path }}", when: true}
- {path: "{{ matrix_bridge_rustpush_container_src_files_path }}", when: "{{ matrix_bridge_rustpush_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_container_src_files_path }}"
repo: "{{ matrix_bridge_rustpush_container_image_self_build_repo }}"
version: "{{ matrix_bridge_rustpush_container_image_self_build_repo_version }}"
dest: "{{ matrix_bridge_rustpush_container_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"
register: matrix_bridge_rustpush_git_pull_results
when: "matrix_bridge_rustpush_enabled | bool and matrix_bridge_rustpush_container_image_self_build"

- name: Ensure RustPush Docker image is built
community.docker.docker_image_build:
name: "{{ matrix_rustpush_bridge_container_image }}"
name: "{{ matrix_bridge_rustpush_container_image }}"
dockerfile: Dockerfile
path: "{{ matrix_rustpush_bridge_container_src_files_path }}"
path: "{{ matrix_bridge_rustpush_container_src_files_path }}"
pull: true
rebuild: "{{ 'always' if matrix_rustpush_bridge_git_pull_results.changed | bool else 'never' }}"
rebuild: "{{ 'always' if matrix_bridge_rustpush_git_pull_results.changed | bool else 'never' }}"
build_args:
BUILD_VERSION: "{{ matrix_rustpush_bridge_container_image_self_build_repo_version }}"
BUILD_COMMIT: "{{ matrix_rustpush_bridge_git_pull_results.after[:8] if matrix_rustpush_bridge_git_pull_results is defined and matrix_rustpush_bridge_git_pull_results.after is defined else 'unknown' }}"
register: matrix_rustpush_bridge_container_image_build_result
when: "matrix_rustpush_bridge_enabled | bool and matrix_rustpush_bridge_container_image_self_build | bool"
BUILD_VERSION: "{{ matrix_bridge_rustpush_container_image_self_build_repo_version }}"
BUILD_COMMIT: "{{ matrix_bridge_rustpush_git_pull_results.after[:8] if matrix_bridge_rustpush_git_pull_results is defined and matrix_bridge_rustpush_git_pull_results.after is defined else 'unknown' }}"
register: matrix_bridge_rustpush_container_image_build_result
when: "matrix_bridge_rustpush_enabled | bool and matrix_bridge_rustpush_container_image_self_build | bool"

- name: Ensure RustPush container image is pulled
community.docker.docker_image_pull:
name: "{{ matrix_rustpush_bridge_container_image }}"
name: "{{ matrix_bridge_rustpush_container_image }}"
pull: always
register: matrix_rustpush_bridge_container_image_pull_result
when: "matrix_rustpush_bridge_enabled | bool and not matrix_rustpush_bridge_container_image_self_build | bool"
register: matrix_bridge_rustpush_container_image_pull_result
when: "matrix_bridge_rustpush_enabled | bool and not matrix_bridge_rustpush_container_image_self_build | bool"
retries: "{{ devture_playbook_help_container_retries_count }}"
delay: "{{ devture_playbook_help_container_retries_delay }}"
until: matrix_rustpush_bridge_container_image_pull_result is not failed
until: matrix_bridge_rustpush_container_image_pull_result is not failed
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"
content: "{{ matrix_bridge_rustpush_configuration | to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_bridge_rustpush_config_path }}/config.yaml"
mode: "0644"
owner: "{{ matrix_user_name }}"
group: "{{ matrix_group_name }}"
register: matrix_rustpush_bridge_config_result
register: matrix_bridge_rustpush_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"
content: "{{ matrix_bridge_rustpush_registration | to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_bridge_rustpush_config_path }}/registration.yaml"
mode: "0644"
owner: "{{ matrix_user_name }}"
group: "{{ matrix_group_name }}"
register: matrix_rustpush_bridge_registration_result
register: matrix_bridge_rustpush_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 }}"
dest: "{{ matrix_bridge_rustpush_base_path }}/{{ item }}"
mode: "0640"
owner: "{{ matrix_user_name }}"
group: "{{ matrix_group_name }}"
with_items:
- labels
register: matrix_rustpush_bridge_support_files_result
register: matrix_bridge_rustpush_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 }}"
name: "{{ matrix_bridge_rustpush_container_network }}"
driver: bridge
driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}"

@@ -95,16 +95,16 @@
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
register: matrix_bridge_rustpush_systemd_service_result

- name: Determine whether matrix-rustpush-bridge needs a restart
ansible.builtin.set_fact:
matrix_rustpush_bridge_restart_necessary: >-
matrix_bridge_rustpush_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)
matrix_bridge_rustpush_config_result.changed | default(false)
or matrix_bridge_rustpush_registration_result.changed | default(false)
or matrix_bridge_rustpush_support_files_result.changed | default(false)
or matrix_bridge_rustpush_systemd_service_result.changed | default(false)
or matrix_bridge_rustpush_container_image_pull_result.changed | default(false)
or matrix_bridge_rustpush_container_image_build_result.changed | default(false)
}}

+ 2
- 2
roles/custom/matrix-bridge-rustpush/tasks/setup_uninstall.yml Просмотреть файл

@@ -8,9 +8,9 @@
- name: Check existence of matrix-rustpush-bridge service
ansible.builtin.stat:
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-rustpush-bridge.service"
register: matrix_rustpush_bridge_service_stat
register: matrix_bridge_rustpush_service_stat

- when: matrix_rustpush_bridge_service_stat.stat.exists | bool
- when: matrix_bridge_rustpush_service_stat.stat.exists | bool
block:
- name: Ensure matrix-rustpush-bridge is stopped
ansible.builtin.service:


+ 7
- 7
roles/custom/matrix-bridge-rustpush/tasks/validate_config.yml Просмотреть файл

@@ -11,10 +11,10 @@
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 }}"}
- {'name': 'matrix_bridge_rustpush_appservice_token', when: true}
- {'name': 'matrix_bridge_rustpush_homeserver_address', when: true}
- {'name': 'matrix_bridge_rustpush_homeserver_token', when: true}
- {'name': 'matrix_bridge_rustpush_database_hostname', when: "{{ matrix_bridge_rustpush_database_engine == 'postgres' }}"}
- {'name': 'matrix_bridge_rustpush_container_network', when: true}
- {'name': 'matrix_bridge_rustpush_metrics_proxying_hostname', when: "{{ matrix_bridge_rustpush_metrics_proxying_enabled }}"}
- {'name': 'matrix_bridge_rustpush_metrics_proxying_path_prefix', when: "{{ matrix_bridge_rustpush_metrics_proxying_enabled }}"}

+ 38
- 38
roles/custom/matrix-bridge-rustpush/templates/config.yaml.j2 Просмотреть файл

@@ -5,38 +5,38 @@ network:
# Available variables:
# .FirstName, .LastName, .Nickname
# .Phone, .Email, .ID
displayname_template: {{ matrix_rustpush_bridge_network_displayname_template | to_json }}
displayname_template: {{ matrix_bridge_rustpush_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_rustpush_bridge_initial_sync_days | to_json }}
initial_sync_days: {{ matrix_bridge_rustpush_initial_sync_days | to_json }}

# Set to false to disable CloudKit backfill globally
cloudkit_backfill: {{ matrix_rustpush_bridge_cloudkit_backfill | to_json }}
cloudkit_backfill: {{ matrix_bridge_rustpush_cloudkit_backfill | to_json }}
backfill_source: cloudkit

# Enable or disable video transcoding
video_transcoding: {{ matrix_rustpush_bridge_video_transcoding | to_json }}
video_transcoding: {{ matrix_bridge_rustpush_video_transcoding | to_json }}

# Enable or disable HEIC conversion
heic_conversion: {{ matrix_rustpush_bridge_heic_conversion | to_json }}
heic_conversion: {{ matrix_bridge_rustpush_heic_conversion | to_json }}
heic_jpeg_quality: 95

# Set to true to disable Facetime support globally
disable_facetime: {{ matrix_rustpush_bridge_disable_facetime | to_json }}
disable_facetime: {{ matrix_bridge_rustpush_disable_facetime | to_json }}

# Set to false to disable Statuskit support globally
statuskit_notifications: {{ matrix_rustpush_bridge_statuskit_notifications | to_json }}
statuskit_share_on_startup: {{ matrix_rustpush_bridge_statuskit_share_on_startup | to_json }}
statuskit_notifications: {{ matrix_bridge_rustpush_statuskit_notifications | to_json }}
statuskit_share_on_startup: {{ matrix_bridge_rustpush_statuskit_share_on_startup | to_json }}
# How to surface a contact's Focus/DND status. Only takes effect when statuskit_notifications is true.
# - topic: set the DM room topic to the contact's Focus/DND state, clearing it when available.
# - notice: post a silent m.notice instead (legacy behavior). Group chats always use notice.
statuskit_notification_style: {{ matrix_rustpush_bridge_statuskit_notification_style | to_json }}
statuskit_notification_style: {{ matrix_bridge_rustpush_statuskit_notification_style | to_json }}

# Config options that affect the central bridge module.
bridge:
# The prefix for commands. Only required in non-management rooms.
command_prefix: {{ matrix_rustpush_bridge_bridge_command_prefix | to_json }}
command_prefix: {{ matrix_bridge_rustpush_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.
@@ -88,12 +88,12 @@ bridge:
displayname_format: "{% raw %}{{ .DisambiguatedName }}{% endraw %}"

# Permissions for using the bridge.
permissions: {{ matrix_rustpush_bridge_bridge_permissions | to_json }}
permissions: {{ matrix_bridge_rustpush_bridge_permissions | to_json }}

# Config for the bridge's database.
database:
type: postgres
uri: {{ matrix_rustpush_bridge_database_uri | to_json }}
uri: {{ matrix_bridge_rustpush_database_uri | to_json }}
max_open_conns: 5
max_idle_conns: 1
max_conn_idle_time: null
@@ -101,37 +101,37 @@ database:

# Homeserver details.
homeserver:
address: {{ matrix_rustpush_bridge_homeserver_address | to_json }}
domain: {{ matrix_rustpush_bridge_homeserver_domain | to_json }}
address: {{ matrix_bridge_rustpush_homeserver_address | to_json }}
domain: {{ matrix_bridge_rustpush_homeserver_domain | to_json }}
software: standard
status_endpoint:
message_send_checkpoint_endpoint:
async_media: {{ matrix_rustpush_bridge_homeserver_async_media | to_json }}
async_media: {{ matrix_bridge_rustpush_homeserver_async_media | to_json }}
websocket: false
ping_interval_seconds: 0

# Application service host/registration related details.
appservice:
address: {{ matrix_rustpush_bridge_appservice_address | to_json }}
public_address: {{ matrix_rustpush_bridge_appservice_public_address | to_json }}
address: {{ matrix_bridge_rustpush_appservice_address | to_json }}
public_address: {{ matrix_bridge_rustpush_appservice_public_address | to_json }}

hostname: 0.0.0.0
port: 8081

id: rustpush-bridge
bot:
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 }}
username: {{ matrix_bridge_rustpush_appservice_bot_username | to_json }}
displayname: {{ matrix_bridge_rustpush_appservice_bot_displayname | to_json(ensure_ascii=False) }}
avatar: {{ matrix_bridge_rustpush_appservice_bot_avatar | to_json }}

ephemeral_events: true
async_transactions: false

as_token: {{ matrix_rustpush_bridge_appservice_token | to_json }}
hs_token: {{ matrix_rustpush_bridge_homeserver_token | to_json }}
as_token: {{ matrix_bridge_rustpush_appservice_token | to_json }}
hs_token: {{ matrix_bridge_rustpush_homeserver_token | to_json }}

# Localpart template of MXIDs for remote users.
username_template: {{ matrix_rustpush_bridge_appservice_username_template | to_json }}
username_template: {{ matrix_bridge_rustpush_appservice_username_template | to_json }}

# Config options that affect the Matrix connector of the bridge.
matrix:
@@ -139,7 +139,7 @@ matrix:
delivery_receipts: false
message_error_notices: true
sync_direct_chat_list: true
federate_rooms: {{ matrix_rustpush_bridge_matrix_federate_rooms | to_json }}
federate_rooms: {{ matrix_bridge_rustpush_matrix_federate_rooms | to_json }}
upload_file_threshold: 5242880

# Segment-compatible analytics endpoint for tracking some events.
@@ -151,15 +151,15 @@ analytics:
# Settings for provisioning API
provisioning:
prefix: /_matrix/provision
shared_secret: {{ matrix_rustpush_bridge_provisioning_shared_secret | to_json }}
shared_secret: {{ matrix_bridge_rustpush_provisioning_shared_secret | to_json }}
allow_matrix_auth: true
debug_endpoints: false

# Settings for backfilling messages.
backfill:
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 }}
enabled: {{ matrix_bridge_rustpush_backfill_enabled | to_json }}
max_initial_messages: {{ matrix_bridge_rustpush_backfill_max_initial_messages | to_json }}
max_catchup_messages: {{ matrix_bridge_rustpush_backfill_max_catchup_messages | to_json }}
unread_hours_threshold: 720
threads:
max_initial_messages: 50
@@ -174,18 +174,18 @@ backfill:
double_puppet:
servers: {}
allow_discovery: false
secrets: {{ matrix_rustpush_bridge_double_puppet_secrets | to_json }}
secrets: {{ matrix_bridge_rustpush_double_puppet_secrets | to_json }}

# End-to-bridge encryption support options.
encryption:
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 }}
allow: {{ matrix_bridge_rustpush_bridge_encryption_allow | to_json }}
default: {{ matrix_bridge_rustpush_bridge_encryption_default | to_json }}
require: {{ matrix_bridge_rustpush_bridge_encryption_require | to_json }}
appservice: {{ matrix_bridge_rustpush_bridge_encryption_appservice | to_json }}
msc4190: {{ matrix_bridge_rustpush_msc4190_enabled | to_json }}
self_sign: {{ matrix_bridge_rustpush_self_sign_enabled | to_json }}
allow_key_sharing: {{ matrix_bridge_rustpush_bridge_encryption_key_sharing_allow | to_json }}
pickle_key: {{ matrix_bridge_rustpush_bridge_encryption_pickle_key | to_json }}
delete_keys:
delete_outbound_on_ack: false
dont_store_outbound: false
@@ -207,7 +207,7 @@ encryption:

# Logging config.
logging:
min_level: {{ matrix_rustpush_bridge_logging_level | to_json }}
min_level: {{ matrix_bridge_rustpush_logging_level | to_json }}
writers:
- type: stdout
format: pretty-colored

+ 14
- 14
roles/custom/matrix-bridge-rustpush/templates/labels.j2 Просмотреть файл

@@ -5,39 +5,39 @@ SPDX-FileCopyrightText: 2026 Jason LaGuidice
SPDX-License-Identifier: AGPL-3.0-or-later
#}

{% if matrix_rustpush_bridge_container_labels_traefik_enabled %}
{% if matrix_bridge_rustpush_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 }}
{% if matrix_bridge_rustpush_container_labels_traefik_docker_network %}
traefik.docker.network={{ matrix_bridge_rustpush_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 %}
{% if matrix_bridge_rustpush_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 }}
{% if matrix_bridge_rustpush_container_labels_metrics_middleware_basic_auth_enabled %}
traefik.http.middlewares.matrix-rustpush-bridge-metrics-basic-auth.basicauth.users={{ matrix_bridge_rustpush_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 }}
traefik.http.routers.matrix-rustpush-bridge-metrics.rule={{ matrix_bridge_rustpush_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 }}
{% if matrix_bridge_rustpush_container_labels_metrics_traefik_priority | int > 0 %}
traefik.http.routers.matrix-rustpush-bridge-metrics.priority={{ matrix_bridge_rustpush_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.entrypoints={{ matrix_bridge_rustpush_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 }}
traefik.http.routers.matrix-rustpush-bridge-metrics.tls={{ matrix_bridge_rustpush_container_labels_metrics_traefik_tls | to_json }}
{% if matrix_bridge_rustpush_container_labels_metrics_traefik_tls %}
traefik.http.routers.matrix-rustpush-bridge-metrics.tls.certResolver={{ matrix_bridge_rustpush_container_labels_metrics_traefik_tls_certResolver }}
{% endif %}

############################################################
@@ -50,4 +50,4 @@ traefik.http.routers.matrix-rustpush-bridge-metrics.tls.certResolver={{ matrix_r

{% endif %}

{{ matrix_rustpush_bridge_container_labels_additional_labels }}
{{ matrix_bridge_rustpush_container_labels_additional_labels }}

+ 10
- 10
roles/custom/matrix-bridge-rustpush/templates/systemd/matrix-rustpush-bridge.service.j2 Просмотреть файл

@@ -1,11 +1,11 @@
#jinja2: lstrip_blocks: True
[Unit]
Description=Matrix RustPush bridge
{% for service in matrix_rustpush_bridge_systemd_required_services_list %}
{% for service in matrix_bridge_rustpush_systemd_required_services_list %}
Requires={{ service }}
After={{ service }}
{% endfor %}
{% for service in matrix_rustpush_bridge_systemd_wanted_services_list %}
{% for service in matrix_bridge_rustpush_systemd_wanted_services_list %}
Wants={{ service }}
{% endfor %}
DefaultDependencies=no
@@ -22,20 +22,20 @@ ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
--log-driver=none \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
--cap-drop=ALL \
--network={{ matrix_rustpush_bridge_container_network }} \
--network={{ matrix_bridge_rustpush_container_network }} \
--env HOME=/data \
{% if matrix_rustpush_bridge_rust_log %} --env RUST_LOG={{ matrix_rustpush_bridge_rust_log }} \
{% endif %} --mount type=bind,src={{ matrix_rustpush_bridge_config_path }},dst=/config \
--mount type=bind,src={{ matrix_rustpush_bridge_data_path }},dst=/data \
--label-file={{ matrix_rustpush_bridge_base_path }}/labels \
{% if matrix_bridge_rustpush_rust_log %} --env RUST_LOG={{ matrix_bridge_rustpush_rust_log }} \
{% endif %} --mount type=bind,src={{ matrix_bridge_rustpush_config_path }},dst=/config \
--mount type=bind,src={{ matrix_bridge_rustpush_data_path }},dst=/data \
--label-file={{ matrix_bridge_rustpush_base_path }}/labels \
--entrypoint /usr/local/bin/matrix-rustpush \
{% for arg in matrix_rustpush_bridge_container_extra_arguments %}
{% for arg in matrix_bridge_rustpush_container_extra_arguments %}
{{ arg }} \
{% endfor %}
{{ matrix_rustpush_bridge_container_image }} \
{{ matrix_bridge_rustpush_container_image }} \
-c /config/config.yaml -r /config/registration.yaml

{% for network in matrix_rustpush_bridge_container_additional_networks %}
{% for network in matrix_bridge_rustpush_container_additional_networks %}
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-rustpush-bridge
{% endfor %}



Загрузка…
Отмена
Сохранить