| @@ -6,9 +6,9 @@ SPDX-License-Identifier: AGPL-3.0-or-later | |||
| --> | |||
| # Setting up RustPush (iMessage) bridging (optional) | |||
| ## \*\*\* THIS BRIDGE IS IN EARLY DEVELOPMENT \*\*\* | |||
| Be warned, here be ~~dragons~~ bugs. Your use, testing, and feedback of this bridge is appreciated. It may not be desirable to deploy this to a large number of users due to possible stability issues | |||
| <hr> | |||
| > **Note:** This bridge is in early development and may have stability issues. It may not be desirable to deploy this to a large number of users. Your testing and feedback is appreciated. | |||
| <sup>Refer the common guide for configuring mautrix bridges: [Setting up a Generic Mautrix Bridge](configuring-playbook-bridge-mautrix-bridges.md)</sup> | |||
| The playbook can install and configure [rustpush bridge to iMessage](https://github.com/jasonlaguidice/imessage) for you using Apple's push notification service. | |||
| @@ -74,20 +74,10 @@ ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start | |||
| ## Usage | |||
| To use the bridge, you need to start a chat with `@imessagebot:example.com` (where `example.com` is your base domain, not the `matrix.` domain). | |||
| To use the bridge, you need to start a chat with `@rustpushbot:example.com` (where `example.com` is your base domain, not the `matrix.` domain). | |||
| After logging in, the bridge will start receiving iMessages and creating portal rooms. | |||
| ## Interference With Mautrix-iMessage & WSproxy | |||
| By default, this bridge uses the same bot user name (`@imessagebot:example.com`) and same localpart for puppet users (`imessage_{{.}}`) as the mautrix-imessage bridge. If you use this bridge on your homeserver have a few options: | |||
| 1. Change the bot and appservice name templates: | |||
| Set `matrix_rustpush_bridge_appservice_bot_username` and to a non-default value `matrix_rustpush_bridge_appservice_username_template` | |||
| 2. After deactivating mautrix-imessage, delete the bot user and all its portal rooms from the database, then re-start the server (more difficult) | |||
| ## 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-rustpush-bridge`. | |||
| @@ -15,14 +15,15 @@ matrix_rustpush_bridge_container_image_self_build_repo_version: "{{ 'master' if | |||
| # Adjust to pin to releases | |||
| matrix_rustpush_bridge_version: v0.0.1 | |||
| matrix_rustpush_bridge_docker_image: "{{ matrix_rustpush_bridge_docker_image_registry_prefix }}jasonlaguidice/imessage:{{ matrix_rustpush_bridge_version }}" | |||
| matrix_rustpush_bridge_docker_image_registry_prefix: "ghcr.io/" | |||
| matrix_rustpush_bridge_docker_image_force_pull: "{{ matrix_rustpush_bridge_docker_image.endswith(':latest') }}" | |||
| 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_docker_src_files_path: "{{ matrix_rustpush_bridge_base_path }}/docker-src" | |||
| matrix_rustpush_bridge_container_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. | |||
| @@ -148,13 +149,13 @@ matrix_rustpush_bridge_double_puppet_secrets: "{{ matrix_rustpush_bridge_double_ | |||
| 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_username: rustpushbot | |||
| matrix_rustpush_bridge_appservice_bot_displayname: RustPush bridge bot | |||
| matrix_rustpush_bridge_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 %}imessage_{{.}}{% endraw %}" | |||
| matrix_rustpush_bridge_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. | |||
| @@ -216,7 +217,7 @@ matrix_rustpush_bridge_registration_yaml: | | |||
| namespaces: | |||
| users: | |||
| - exclusive: true | |||
| regex: '^@imessage_.+:{{ matrix_rustpush_bridge_homeserver_domain | regex_escape }}$' | |||
| regex: '^@rustpush_.+:{{ 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 }} | |||
| @@ -16,14 +16,14 @@ | |||
| - {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 }}"} | |||
| - {path: "{{ matrix_rustpush_bridge_container_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 }}" | |||
| dest: "{{ matrix_rustpush_bridge_container_src_files_path }}" | |||
| force: "yes" | |||
| become: true | |||
| become_user: "{{ matrix_user_name }}" | |||
| @@ -33,34 +33,34 @@ | |||
| - name: Ensure RustPush Dockerfile is installed | |||
| ansible.builtin.template: | |||
| src: "{{ role_path }}/templates/Dockerfile.j2" | |||
| dest: "{{ matrix_rustpush_bridge_docker_src_files_path }}/Dockerfile" | |||
| dest: "{{ matrix_rustpush_bridge_container_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 | |||
| 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' }}" | |||
| community.docker.docker_image_build: | |||
| name: "{{ matrix_rustpush_bridge_container_image }}" | |||
| dockerfile: Dockerfile | |||
| path: "{{ matrix_rustpush_bridge_container_src_files_path }}" | |||
| pull: true | |||
| rebuild: "{{ 'always' if matrix_rustpush_bridge_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" | |||
| - 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 }}" | |||
| community.docker.docker_image_pull: | |||
| name: "{{ matrix_rustpush_bridge_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" | |||
| 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 | |||
| ignore_errors: "{{ ansible_check_mode }}" | |||
| - name: Ensure rustpush-bridge config.yaml installed | |||
| @@ -32,7 +32,7 @@ ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \ | |||
| {% for arg in matrix_rustpush_bridge_container_extra_arguments %} | |||
| {{ arg }} \ | |||
| {% endfor %} | |||
| {{ matrix_rustpush_bridge_docker_image }} \ | |||
| {{ matrix_rustpush_bridge_container_image }} \ | |||
| -c /config/config.yaml -r /config/registration.yaml | |||
| {% for network in matrix_rustpush_bridge_container_additional_networks %} | |||