From 0a271b08fd3d7790eb8ec5de4fe9a729a0594c10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Swetz=C3=A9n?= Date: Thu, 17 Aug 2023 18:58:34 +0200 Subject: [PATCH] Fix comments for documentation, volumes and ports --- docs/configuring-playbook-bridge-mautrix-wsproxy.md | 10 +++++----- .../tasks/setup_install.yml | 9 +++++++++ .../templates/syncproxy-env.j2 | 3 +++ .../matrix-mautrix-wsproxy-syncproxy.service.j2 | 6 +++--- .../systemd/matrix-mautrix-wsproxy.service.j2 | 4 +++- 5 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 roles/custom/matrix-bridge-mautrix-wsproxy/templates/syncproxy-env.j2 diff --git a/docs/configuring-playbook-bridge-mautrix-wsproxy.md b/docs/configuring-playbook-bridge-mautrix-wsproxy.md index 3c3324d52..462f10275 100644 --- a/docs/configuring-playbook-bridge-mautrix-wsproxy.md +++ b/docs/configuring-playbook-bridge-mautrix-wsproxy.md @@ -8,11 +8,11 @@ Use the following playbook configuration: ```yaml matrix_mautrix_wsproxy_enabled: true -matrix_mautrix_androidsms_appservice_token: 'random string' -matrix_mautrix_androidsms_homeserver_token: 'random string' -matrix_mautrix_imessage_appservice_token: 'random string' -matrix_mautrix_imessage_homeserver_token: 'random string' -matrix_mautrix_wsproxy_syncproxy_shared_secret: 'random string' +matrix_mautrix_androidsms_appservice_token: 'secret token from bridge' +matrix_mautrix_androidsms_homeserver_token: 'secret token from bridge' +matrix_mautrix_imessage_appservice_token: 'secret token from bridge' +matrix_mautrix_imessage_homeserver_token: 'secret token from bridge' +matrix_mautrix_wsproxy_syncproxy_shared_secret: 'secret token from bridge' ``` Note that the tokens must match what is compiled into the `mautrix-imessage` bridge running on Mac and Android. diff --git a/roles/custom/matrix-bridge-mautrix-wsproxy/tasks/setup_install.yml b/roles/custom/matrix-bridge-mautrix-wsproxy/tasks/setup_install.yml index 53cd067a5..fbfe707e9 100644 --- a/roles/custom/matrix-bridge-mautrix-wsproxy/tasks/setup_install.yml +++ b/roles/custom/matrix-bridge-mautrix-wsproxy/tasks/setup_install.yml @@ -14,6 +14,15 @@ - ansible.builtin.set_fact: matrix_mautrix_wsproxy_syncproxy_requires_restart: false +- name: Ensure Mautrix wsproxy support files installed + ansible.builtin.template: + src: "{{ role_path }}/templates/{{ item }}.j2" + dest: "{{ matrix_mautrix_wsproxy_base_path }}/{{ item }}" + mode: 0640 + owner: "{{ matrix_user_username }}" + group: "{{ matrix_user_groupname }}" + with_items: + - syncproxy-env - name: Ensure Mautrix wsproxy image is pulled community.docker.docker_image: name: "{{ matrix_mautrix_wsproxy_docker_image }}" diff --git a/roles/custom/matrix-bridge-mautrix-wsproxy/templates/syncproxy-env.j2 b/roles/custom/matrix-bridge-mautrix-wsproxy/templates/syncproxy-env.j2 new file mode 100644 index 000000000..bc23e54bd --- /dev/null +++ b/roles/custom/matrix-bridge-mautrix-wsproxy/templates/syncproxy-env.j2 @@ -0,0 +1,3 @@ +DATABASE_URL={{ matrix_mautrix_signal_wsproxy_syncproxy_connection_string }} +HOMESERVER_URL={{ matrix_homeserver_container_url }} +SHARED_SECRET={{ matrix_mautrix_wsproxy_syncproxy_shared_secret }} \ No newline at end of file diff --git a/roles/custom/matrix-bridge-mautrix-wsproxy/templates/systemd/matrix-mautrix-wsproxy-syncproxy.service.j2 b/roles/custom/matrix-bridge-mautrix-wsproxy/templates/systemd/matrix-mautrix-wsproxy-syncproxy.service.j2 index 8ae276bc6..c1bdf3d8f 100644 --- a/roles/custom/matrix-bridge-mautrix-wsproxy/templates/systemd/matrix-mautrix-wsproxy-syncproxy.service.j2 +++ b/roles/custom/matrix-bridge-mautrix-wsproxy/templates/systemd/matrix-mautrix-wsproxy-syncproxy.service.j2 @@ -24,10 +24,10 @@ ExecStart={{ devture_systemd_docker_base_host_command_docker }} run --rm --name --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ --cap-drop=ALL \ --network={{ matrix_docker_network }} \ + {% if matrix_mautrix_wsproxy_syncproxy_bind_port %} -p {{ matrix_mautrix_wsproxy_syncproxy_port }}:29331 \ - -e DATABASE_URL={{ matrix_mautrix_signal_wsproxy_syncproxy_connection_string }} \ - -e HOMESERVER_URL={{ matrix_homeserver_container_url }} \ - -e SHARED_SECRET={{ matrix_mautrix_wsproxy_syncproxy_shared_secret }} \ + {% endif %} + --env-file={{ matrix_mautrix_wsproxy_base_path }}/syncproxy-env \ {% for arg in matrix_mautrix_wsproxy_syncproxy_container_extra_arguments %} {{ arg }} \ {% endfor %} diff --git a/roles/custom/matrix-bridge-mautrix-wsproxy/templates/systemd/matrix-mautrix-wsproxy.service.j2 b/roles/custom/matrix-bridge-mautrix-wsproxy/templates/systemd/matrix-mautrix-wsproxy.service.j2 index e945bb62f..e4b554c72 100644 --- a/roles/custom/matrix-bridge-mautrix-wsproxy/templates/systemd/matrix-mautrix-wsproxy.service.j2 +++ b/roles/custom/matrix-bridge-mautrix-wsproxy/templates/systemd/matrix-mautrix-wsproxy.service.j2 @@ -24,8 +24,10 @@ ExecStart={{ devture_systemd_docker_base_host_command_docker }} run --rm --name --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ --cap-drop=ALL \ --network={{ matrix_docker_network }} \ - -v {{ matrix_mautrix_wsproxy_config_path }}:/data:z \ + {% if matrix_mautrix_wsproxy_bind_port %} -p {{ matrix_mautrix_wsproxy_port }}:29331 \ + {% endif %} + --mount type=bind,src={{ matrix_mautrix_wsproxy_config_path }},dst=/data:z \ {% for arg in matrix_mautrix_wsproxy_container_extra_arguments %} {{ arg }} \ {% endfor %}