Add MatrixZulipBridge (#4695)

* Add links to MatrixZulipBridge

Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org>

* Add MatrixZulipBridge: copy matrix-bridge-heisenbridge

Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org>

* Rename matrix-heisenbridge.service.j2 to matrix-matrixzulipbridge.service.j2

- Add the license header to matrix-matrixzulipbridge.service.j2

Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org>

* Replace "Heisenbridge" to "MatrixZulipBridge" to "heisenbridge" to "matrixzulipbridge", respectively

Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org>

* Replace variables related to container image and version

Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org>

* Update comments and copyright headers

Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org>

* Update matrix-bridge-matrixzulipbridge/tasks/main.yml: add names to tasks

Reuse aa0591f8b0/tasks/main.yml

Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org>

* Remove configuration for identd

Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org>

* Add `matrix_matrixzulipbridge_container_http_port`

Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org>

* Run ansible-lint for files in tasks/

Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org>

* Update `matrix_matrixzulipbridge_registration_yaml`

Run `pip install matrixzulipbridge && python3 -m matrixzulipbridge --config config.yaml --generate` to generate config.yaml

Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org>

* Add MatrixZulipBridge to files in group_vars

Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org>

* Add configuring-playbook-bridge-matrixzulipbridge.md

Reuse b108c8a151/docs/configuring-playbook-bridge-heisenbridge.md

Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org>

* Fix `matrix_matrixzulipbridge_config_media_path`

Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org>

* Remove space characters

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* Replace "matrixzulipbridge" with "zulip", etc.

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* Remove irrelevant instruction

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* MatrixZulipBridge → Zulip bridge

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* Rename `@matrixzulipbridge` to `@zulipbot`

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* Replace `matrix_bridge_zulip` with `matrix_zulip_bridge` for now

Refer to https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/4695#discussion_r2485317210

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* Set `{{ matrix_admin if matrix_admin else '' }}` to `matrix_zulip_bridge_owner`

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* Apply the review

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* Reuse the section about adjusting the playbook configuration on configuring-playbook-bridge-postmoogle.md

Reuse 7862fd7cdd/docs/configuring-playbook-bridge-postmoogle.md

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

* Update configuring-playbook.md: sort list items

Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>

---------

Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org>
Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>
Co-authored-by: Suguru Hirahara <acioustick@noreply.codeberg.org>
Co-authored-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>
This commit is contained in:
Suguru Hirahara
2025-11-08 07:09:12 +00:00
committed by GitHub
parent 1861faf31d
commit ee976242e5
14 changed files with 520 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
# SPDX-FileCopyrightText: 2021 Toni Spets
# SPDX-FileCopyrightText: 2022 - 2024 Slavi Pantaleev
# SPDX-FileCopyrightText: 2022 Marko Weltzer
# SPDX-FileCopyrightText: 2025 Suguru Hirahara
#
# SPDX-License-Identifier: AGPL-3.0-or-later
---
- name: Perform the Zulip bridge installation tasks
when: matrix_zulip_bridge_enabled | bool
tags:
- setup-all
- setup-bridge-zulip
- install-all
- install-bridge-zulip
block:
- name: Validate the Zulip bridge configuration
ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml"
- name: Install the Zulip bridge
ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_install.yml"
- name: Perform the Zulip bridge uninstallation tasks
when: not matrix_zulip_bridge_enabled | bool
tags:
- setup-all
- setup-bridge-zulip
block:
- name: Uninstall the Zulip bridge
ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"

View File

@@ -0,0 +1,62 @@
# SPDX-FileCopyrightText: 2021 Toni Spets
# SPDX-FileCopyrightText: 2022 - 2024 Slavi Pantaleev
# SPDX-FileCopyrightText: 2022 Jim Myhrberg
# SPDX-FileCopyrightText: 2022 Marko Weltzer
# SPDX-FileCopyrightText: 2022 Nikita Chernyi
# SPDX-FileCopyrightText: 2022 Sebastian Gumprich
# SPDX-FileCopyrightText: 2024 David Mehren
#
# SPDX-License-Identifier: AGPL-3.0-or-later
---
- name: Ensure the Zulip bridge image is pulled
community.docker.docker_image:
name: "{{ matrix_zulip_bridge_docker_image }}"
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
force_source: "{{ matrix_zulip_bridge_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_zulip_bridge_docker_image_force_pull }}"
register: result
retries: "{{ devture_playbook_help_container_retries_count }}"
delay: "{{ devture_playbook_help_container_retries_delay }}"
until: result is not failed
- name: Ensure the Zulip bridge paths exist
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: "0750"
owner: "{{ matrix_user_name }}"
group: "{{ matrix_group_name }}"
with_items:
- "{{ matrix_zulip_bridge_base_path }}"
- name: Ensure the Zulip bridge registration.yaml installed if provided
ansible.builtin.copy:
content: "{{ matrix_zulip_bridge_registration | to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_zulip_bridge_base_path }}/registration.yaml"
mode: "0644"
owner: "{{ matrix_user_name }}"
group: "{{ matrix_group_name }}"
- name: Ensure the Zulip bridge support files installed
ansible.builtin.template:
src: "{{ role_path }}/templates/{{ item }}.j2"
dest: "{{ matrix_zulip_bridge_base_path }}/{{ item }}"
mode: "0640"
owner: "{{ matrix_user_name }}"
group: "{{ matrix_group_name }}"
with_items:
- labels
- name: Ensure the Zulip bridge container network is created
community.general.docker_network:
enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
name: "{{ matrix_zulip_bridge_container_network }}"
driver: bridge
driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}"
- name: Ensure matrix-zulip-bridge.service installed
ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-zulip-bridge.service.j2"
dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-zulip-bridge.service"
mode: "0644"

View File

@@ -0,0 +1,26 @@
# SPDX-FileCopyrightText: 2021 - 2022 Slavi Pantaleev
# SPDX-FileCopyrightText: 2021 Michael Sasser
# SPDX-FileCopyrightText: 2021 Toni Spets
# SPDX-FileCopyrightText: 2022 Marko Weltzer
#
# SPDX-License-Identifier: AGPL-3.0-or-later
---
- name: Check existence of matrix-bridge-zulip service
ansible.builtin.stat:
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-zulip-bridge.service"
register: matrix_zulip_bridge_service_stat
- when: matrix_zulip_bridge_service_stat.stat.exists | bool
block:
- name: Ensure matrix-bridge-zulip is stopped
ansible.builtin.service:
name: matrix-bridge-zulip
state: stopped
enabled: false
daemon_reload: true
- name: Ensure matrix-zulip-bridge.service doesn't exist
ansible.builtin.file:
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-zulip-bridge.service"
state: absent

View File

@@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: 2024 Slavi Pantaleev
# SPDX-FileCopyrightText: 2024 Suguru Hirahara
#
# SPDX-License-Identifier: AGPL-3.0-or-later
---
- name: Fail if required the Zulip bridge 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_zulip_bridge_container_network", when: true}
- {"name": "matrix_zulip_bridge_homeserver_url", when: true}