From 2a69ca35be70fddca3d069d9512fa6e842659a1d Mon Sep 17 00:00:00 2001
From: Slavi Pantaleev <slavi@devture.com>
Date: Wed, 12 Mar 2025 07:42:40 +0200
Subject: [PATCH] Clean up Element Call group vars vs defaults/main.yml mixup
 and make some minor LiveKit updates

---
 docs/configuring-playbook-element-call.md     | 19 +++++-----
 docs/configuring-playbook-livekit-server.md   |  2 +-
 group_vars/matrix_servers                     | 17 ++-------
 .../matrix-element-call/defaults/main.yml     | 35 +++++++++++++------
 .../tasks/validate_config.yml                 |  1 -
 .../systemd/matrix-element-call.service.j2    |  2 +-
 .../matrix-livekit-server/defaults/main.yml   |  2 +-
 7 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/docs/configuring-playbook-element-call.md b/docs/configuring-playbook-element-call.md
index cb7d0dfef..9a30ae350 100644
--- a/docs/configuring-playbook-element-call.md
+++ b/docs/configuring-playbook-element-call.md
@@ -1,21 +1,21 @@
 <!--
 SPDX-FileCopyrightText: 2024 wjbeckett
-SPDX-FileCopyrightText: 2024 Slavi Pantaleev
+SPDX-FileCopyrightText: 2024 - 2025 Slavi Pantaleev
 
 SPDX-License-Identifier: AGPL-3.0-or-later
 -->
 
 # Setting up Element Call (optional)
 
-The playbook can install and configure [Element Call](https://github.com/vector-im/element-call) for you.
+The playbook can install and configure [Element Call](https://github.com/element-hq/element-call) for you.
 
-Element Call is a WebRTC-based video and voice calling platform that integrates with Matrix clients such as Element Web. It provides secure, decentralized communication with support for video calls, audio calls, and screen sharing.
+Element Call is a native Matrix video conferencing application developed by [Element](https://element.io), designed for secure, scalable, privacy-respecting, and decentralized video and voice calls over the Matrix protocol. Built on MatrixRTC ([MSC4143](https://github.com/matrix-org/matrix-spec-proposals/pull/4143)), it utilizes [MSC4195](https://github.com/hughns/matrix-spec-proposals/blob/hughns/matrixrtc-livekit/proposals/4195-matrixrtc-livekit.md) with [LiveKit](configuring-playbook-livekit-server.md) as its backend.
 
-See the project's [documentation](https://github.com/vector-im/element-call) to learn more.
+See the project's [documentation](https://github.com/element-hq/element-call) to learn more.
 
 ## Decide on a domain and path
 
-By default, Element Call is configured to be served on the Matrix domain (`call.DOMAIN`, controlled by the `matrix_element_call_hostname` variable).
+By default, Element Call is configured to be served on the `call.element.DOMAIN` domain, controlled by the `matrix_element_call_hostname` variable.
 
 This makes it easy to set it up, **without** having to adjust your DNS records manually.
 
@@ -26,21 +26,20 @@ If you'd like to run Element Call on another hostname or path, use the `matrix_e
 If you've changed the default hostname, **you may need to adjust your DNS** records accordingly to point to the correct server.
 
 Ensure that the following DNS names have a public IP/FQDN:
-- `call.example.com`
-- `sfu.example.com`
+- `call.element.example.com`
+- `livekit.example.com`
 - `sfu-jwt.example.com`
 
 ## Adjusting the playbook configuration
 
-NOTE: Enabling Element Call will automatically enable the [LiveKit JWT Service](configuring-playbook-livekit-jwt-service.md) and Livekit Server services.
-
-
 Add the following configuration to your `inventory/host_vars/matrix.DOMAIN/vars.yml` file:
 
 ```yaml
 matrix_element_call_enabled: true
 ```
 
+💡 Enabling Element Call will automatically enable the [LiveKit JWT Service](configuring-playbook-livekit-jwt-service.md) and [Livekit Server](configuring-playbook-livekit-server.md) services.
+
 ## Installing
 
 After configuring the playbook and potentially [adjusting your DNS records](#adjusting-dns-records), run the [installation](installing.md) command: `just install-all` or `just setup-all`
diff --git a/docs/configuring-playbook-livekit-server.md b/docs/configuring-playbook-livekit-server.md
index 34c6c1826..fc19ffa9d 100644
--- a/docs/configuring-playbook-livekit-server.md
+++ b/docs/configuring-playbook-livekit-server.md
@@ -26,7 +26,7 @@ If you'd like to run Livekit on another hostname or path, use the `livekit_serve
 If you've changed the default hostname, **you may need to adjust your DNS** records accordingly to point to the correct server.
 
 Ensure that the following DNS names have a public IP/FQDN:
-- `sfu.example.com`
+- `livekit.example.com`
 
 ## Adjusting the playbook configuration
 
diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers
index d858a7865..86e327256 100755
--- a/group_vars/matrix_servers
+++ b/group_vars/matrix_servers
@@ -6261,21 +6261,10 @@ matrix_element_call_enabled: false
 
 matrix_element_call_scheme: "{{ 'https' if matrix_playbook_ssl_enabled else 'http' }}"
 
-matrix_element_call_version: "latest"  # Default version; can be overridden in host_vars
-
-matrix_element_call_hostname: "call.{{ matrix_domain }}"  # Default hostname; should be overridden in host_vars if different
-matrix_element_call_path_prefix: "/"  # Path prefix for Element Call
-matrix_element_call_base_path: "{{ matrix_base_data_path }}/element-call"  # Base path for storing Element Call-related files
-matrix_element_call_container_image: "ghcr.io/element-hq/element-call:{{ matrix_element_call_version }}"
-matrix_element_call_container_image_name_prefix: ghcr.io/
-matrix_element_call_container_image_registry_prefix: ghcr.io/
-matrix_element_call_container_image_force_pull: true
-
-# Docker network configuration for Element Call
 matrix_element_call_container_network: "{{ matrix_addons_container_network }}"
-matrix_element_call_container_additional_networks: "{{ [matrix_playbook_reverse_proxyable_services_additional_network] if (matrix_element_call_container_labels_traefik_enabled and matrix_playbook_reverse_proxyable_services_additional_network) else [] }}"
 
-# Traefik Configuration for Element Call
+matrix_element_call_container_additional_networks_auto: "{{ [matrix_playbook_reverse_proxyable_services_additional_network] if (matrix_element_call_container_labels_traefik_enabled and matrix_playbook_reverse_proxyable_services_additional_network) else [] }}"
+
 matrix_element_call_container_labels_traefik_enabled: "{{ matrix_playbook_reverse_proxy_type in ['playbook-managed-traefik', 'other-traefik-container'] }}"
 matrix_element_call_container_labels_traefik_docker_network: "{{ matrix_playbook_reverse_proxyable_services_additional_network }}"
 matrix_element_call_container_labels_traefik_entrypoints: "{{ traefik_entrypoint_primary }}"
@@ -6302,7 +6291,7 @@ livekit_server_gid: "{{ matrix_user_gid }}"
 
 livekit_server_base_path: "{{ matrix_base_data_path }}/livekit-server"
 
-livekit_server_hostname: "sfu.{{ matrix_domain }}"
+livekit_server_hostname: "livekit.{{ matrix_domain }}"
 
 livekit_server_container_image_self_build: "{{ matrix_architecture not in ['arm64', 'amd64'] }}"
 
diff --git a/roles/custom/matrix-element-call/defaults/main.yml b/roles/custom/matrix-element-call/defaults/main.yml
index 329001a79..55ded89ea 100644
--- a/roles/custom/matrix-element-call/defaults/main.yml
+++ b/roles/custom/matrix-element-call/defaults/main.yml
@@ -1,26 +1,39 @@
 # SPDX-FileCopyrightText: 2022 MDAD project contributors
 # SPDX-FileCopyrightText: 2024 wjbeckett
-# SPDX-FileCopyrightText: 2024 Slavi Pantaleev
+# SPDX-FileCopyrightText: 2024 - 2025 Slavi Pantaleev
 #
 # SPDX-License-Identifier: AGPL-3.0-or-later
 
 ---
-# Enable or disable matrix-element-call deployment
+
+# Element Call is a native Matrix video conferencing application developed by Element.
+# Project source code URL: https://github.com/element-hq/element-call
+
 matrix_element_call_enabled: false
 
-matrix_element_call_scheme: https
-matrix_element_call_hostname: "call.{{ matrix_domain }}"
+matrix_element_call_version: v0.7.2
+
+matrix_element_call_scheme: https
+
+matrix_element_call_hostname: "call.element.{{ matrix_domain }}"
+matrix_element_call_path_prefix: /
 
-# Base path configuration
 matrix_element_call_base_path: "{{ matrix_base_data_path }}/element-call"
 
-# Docker network configuration
-matrix_element_call_container_network: ''
-matrix_element_call_container_http_host_bind_port: ''
-matrix_element_call_container_additional_networks: []  # No additional networks by default
+matrix_element_call_container_image: "{{ matrix_element_call_container_image_registry_prefix }}element-hq/element-call:{{ matrix_element_call_container_image_tag }}"
+matrix_element_call_container_image_registry_prefix: "{{ matrix_element_call_container_image_registry_prefix_upstream }}"
+matrix_element_call_container_image_registry_prefix_upstream: "{{ matrix_element_call_container_image_registry_prefix_upstream_default }}"
+matrix_element_call_container_image_registry_prefix_upstream_default: ghcr.io/
+matrix_element_call_container_image_tag: "{{ matrix_element_call_version }}"
+matrix_element_call_container_image_force_pull: "{{ matrix_element_call_container_image.endswith(':latest') }}"
 
-# Docker images
-matrix_element_call_image: "ghcr.io/element-hq/element-call:latest"
+matrix_element_call_container_network: matrix-element-call
+
+matrix_element_call_container_http_host_bind_port: ''
+
+matrix_element_call_container_additional_networks: "{{ matrix_element_call_container_additional_networks_auto + matrix_element_call_container_additional_networks_custom }}"
+matrix_element_call_container_additional_networks_auto: []
+matrix_element_call_container_additional_networks_custom: []
 
 # Ports
 matrix_element_call_port: "8093"
diff --git a/roles/custom/matrix-element-call/tasks/validate_config.yml b/roles/custom/matrix-element-call/tasks/validate_config.yml
index 65aaecfd1..b27f941fc 100644
--- a/roles/custom/matrix-element-call/tasks/validate_config.yml
+++ b/roles/custom/matrix-element-call/tasks/validate_config.yml
@@ -14,4 +14,3 @@
   with_items:
     - {'name': 'matrix_element_call_base_path', when: true}
     - {'name': 'matrix_element_call_container_network', when: true}
-    - {'name': 'matrix_element_call_image', when: true}
diff --git a/roles/custom/matrix-element-call/templates/systemd/matrix-element-call.service.j2 b/roles/custom/matrix-element-call/templates/systemd/matrix-element-call.service.j2
index 1703cc698..0a781887d 100644
--- a/roles/custom/matrix-element-call/templates/systemd/matrix-element-call.service.j2
+++ b/roles/custom/matrix-element-call/templates/systemd/matrix-element-call.service.j2
@@ -28,7 +28,7 @@ ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
     {% for arg in matrix_element_call_container_extra_arguments %}
     {{ arg }} \
     {% endfor %}
-    {{ matrix_element_call_image }}
+    {{ matrix_element_call_container_image }}
 
 {% for network in matrix_element_call_container_additional_networks %}
 ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-element-call
diff --git a/roles/custom/matrix-livekit-server/defaults/main.yml b/roles/custom/matrix-livekit-server/defaults/main.yml
index 5dee43646..bd6e2c2b8 100644
--- a/roles/custom/matrix-livekit-server/defaults/main.yml
+++ b/roles/custom/matrix-livekit-server/defaults/main.yml
@@ -19,7 +19,7 @@ livekit_server_base_path: "/{{ livekit_server_identifier }}"
 livekit_server_config_path: "{{ livekit_server_base_path }}/config"
 
 # renovate: datasource=docker depName=docker.io/livekit/livekit-server
-livekit_server_version: v1.8.0
+livekit_server_version: v1.8.4
 
 livekit_server_scheme: https
 livekit_server_hostname: ""