Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Element Call, LiveKit Server and JWT Service integrations for Element Call functionality #3562

Draft
wants to merge 153 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
6594cce
Feat: Added element call setup and configuration.
wjbeckett Sep 25, 2024
434157e
Merge branch 'spantaleev:master' into element-call-integration
wjbeckett Sep 25, 2024
d1ba784
added doc for setting up element call.
wjbeckett Sep 25, 2024
60f34cd
fixed matrix_redis for migration
wjbeckett Sep 25, 2024
fc6357a
Update main.yml
wjbeckett Sep 25, 2024
350d4d4
Fixed assertion block to remove jinja2 delimiters
wjbeckett Sep 25, 2024
90ea758
Fixed regex for checking the hostname.
wjbeckett Sep 25, 2024
c93d30b
Added matrix_server_name to the defaults
wjbeckett Sep 25, 2024
ce827e7
Changed matrix_base_domain to matrix_domain
wjbeckett Sep 25, 2024
8644a73
Removed additional label loop
wjbeckett Sep 25, 2024
8173550
Added debug task to test labels configuration
wjbeckett Sep 25, 2024
6364101
Adding another debug task for testing the labels file.
wjbeckett Sep 25, 2024
16ed788
Update main.yml
wjbeckett Sep 25, 2024
0eef094
Restructure install.yml to follow other roles more closely
wjbeckett Sep 25, 2024
02479e8
Updated with new structure.
wjbeckett Sep 25, 2024
5efc189
Updated to support new structure
wjbeckett Sep 25, 2024
68cc1f4
Simplified the validation step.
wjbeckett Sep 25, 2024
37fd2e7
Update env.j2 to support the new configuration
wjbeckett Sep 25, 2024
becdb08
Update config.json.j2
wjbeckett Sep 25, 2024
f306a47
Update livekit.yaml.j2
wjbeckett Sep 25, 2024
dfeca19
Update redis.conf.j2
wjbeckett Sep 25, 2024
954d46c
Update labels.j2
wjbeckett Sep 25, 2024
45c8a61
Migrating to systemd for container management
wjbeckett Sep 26, 2024
bc9658c
Create matrix-livekit.service.j2
wjbeckett Sep 26, 2024
e910d09
Create matrix-redis.service.j2
wjbeckett Sep 26, 2024
f16ca24
Update install.yml
wjbeckett Sep 26, 2024
a533ec4
Update matrix_servers
wjbeckett Sep 26, 2024
e31e688
Update main.yml
wjbeckett Sep 26, 2024
f762128
Update labels.j2
wjbeckett Sep 26, 2024
bc2ed60
Update main.yml
wjbeckett Sep 26, 2024
ac1295a
Create matrix-jwt-service.service.j2
wjbeckett Sep 26, 2024
f38d6a0
Update main.yml
wjbeckett Sep 26, 2024
9cb236d
Update install.yml
wjbeckett Sep 26, 2024
f2acc74
Create well_known_element.json.j2
wjbeckett Sep 26, 2024
ba54e54
Added well-known element directory
wjbeckett Sep 26, 2024
3f6c327
Update main.yml
wjbeckett Sep 26, 2024
85be689
Migrated from matrix_redis to redis_
wjbeckett Sep 26, 2024
6ef304b
Update validate_config.yml
wjbeckett Sep 26, 2024
656d427
Update install.yml
wjbeckett Sep 26, 2024
e34e5da
Update matrix-redis.service.j2
wjbeckett Sep 26, 2024
5cc9c70
Remove serve command from matrix-element-call.service.j2
wjbeckett Sep 26, 2024
f0632b2
Added missing labels for sfu and jwt
wjbeckett Sep 26, 2024
6a519bb
Created element-call-labels to separate the labels for each container
wjbeckett Sep 26, 2024
2cf4710
Created livekit-labels.j2
wjbeckett Sep 26, 2024
1d7a600
Create jwt-service-labels.j2
wjbeckett Sep 26, 2024
8076380
Updated label file
wjbeckett Sep 26, 2024
d2e2781
Updated label file
wjbeckett Sep 26, 2024
2f2cb89
Updated livekit labels
wjbeckett Sep 26, 2024
df4bf4a
Added tasks for moving the new labels files into place
wjbeckett Sep 26, 2024
dd96b93
Update matrix-element-call.service.j2
wjbeckett Sep 26, 2024
3264408
Rename element-call-labels.j2 to element-call-labels.j2-new
wjbeckett Sep 26, 2024
25909b1
Update and rename labels.j2 to element-call-labels.j2
wjbeckett Sep 26, 2024
1721e85
Corrected element call labels file name
wjbeckett Sep 26, 2024
510cfb2
Update matrix_servers
wjbeckett Sep 26, 2024
5f49433
Handle empty labels correctly.
wjbeckett Sep 26, 2024
805b726
Update element-call-labels.j2
wjbeckett Sep 26, 2024
c14f9cd
Update matrix_servers
wjbeckett Sep 26, 2024
5730dbf
Added hostname label
wjbeckett Sep 26, 2024
6d6f9ab
Added hostnames for livekit and jwt labels
wjbeckett Sep 26, 2024
b6571fc
Update livekit-labels.j2
wjbeckett Sep 26, 2024
089c5f1
Update jwt-service-labels.j2
wjbeckett Sep 27, 2024
3c084e1
Update element-call-labels.j2-new
wjbeckett Sep 27, 2024
14614cb
Update matrix-element-call.service.j2
wjbeckett Sep 27, 2024
5b8dcf3
Added element-call systemd services to the service manager.
wjbeckett Sep 27, 2024
63133d6
Added serve command back in.
wjbeckett Sep 27, 2024
8b172cc
Update env.j2
wjbeckett Sep 27, 2024
a0917fa
Update main.yml
wjbeckett Sep 27, 2024
2492672
Update env.j2
wjbeckett Sep 27, 2024
5db9a5c
Removed env file
wjbeckett Sep 27, 2024
a274d32
Removed serve function
wjbeckett Sep 27, 2024
f036e18
Fix: Restructured Element call configuration files.
wjbeckett Sep 30, 2024
1167e1e
fix: changed matrix server name to matrix domain in element-call config.
wjbeckett Sep 30, 2024
9dbee21
fix: removed duplicate keys.
wjbeckett Sep 30, 2024
93650cf
fix: Type in the element-call main.yml
wjbeckett Sep 30, 2024
f762048
fix: added missing labels to main.
wjbeckett Sep 30, 2024
6143ad7
fix: removed the read-only tag from the element-call systemd file.
wjbeckett Sep 30, 2024
31a138a
fixed traefik router issues.
wjbeckett Sep 30, 2024
cb41fb0
testing traefik labels again.
wjbeckett Sep 30, 2024
b907777
fixing labels again.
wjbeckett Sep 30, 2024
8cb3e33
separated livekit and jwt to separate roles
wjbeckett Sep 30, 2024
e952ba1
removed duplicate tasks.
wjbeckett Sep 30, 2024
3de3990
hard coded redis port.
wjbeckett Sep 30, 2024
58a9642
fixed config file placement.
wjbeckett Sep 30, 2024
71dff50
fixed livekit service name
wjbeckett Sep 30, 2024
8cb7def
cleaned up old services again
wjbeckett Sep 30, 2024
97f93eb
renamed the livekit role and added livekit-server and jwt-service rol…
wjbeckett Sep 30, 2024
b7b8ed5
typo in livekit-server validate.
wjbeckett Sep 30, 2024
812b57c
resolved missing key.
wjbeckett Sep 30, 2024
fd2f505
Fixed typo in livekit server hostname
wjbeckett Oct 1, 2024
7cdec5f
fixed type in livekit image
wjbeckett Oct 1, 2024
d5aabc8
removed redis images in favor of the inbuilt keyDB
wjbeckett Oct 1, 2024
f98a505
changed jwt-service port label.
wjbeckett Oct 1, 2024
d53c242
updated jwt hostname.
wjbeckett Oct 1, 2024
dbbaae4
stopping the recursive loop
wjbeckett Oct 1, 2024
9864996
adjusted jwt service ports for traefik
wjbeckett Oct 1, 2024
5507fb3
added element-call config.json to systemd file
wjbeckett Oct 1, 2024
e421852
updated jwt bind port
wjbeckett Oct 1, 2024
4acb025
testing livekit configuration
wjbeckett Oct 1, 2024
4610956
updated headers for each of the call services.
wjbeckett Oct 1, 2024
9691577
removed additinoal headers
wjbeckett Oct 1, 2024
6c8923a
removed headers.
wjbeckett Oct 1, 2024
2b4fdea
added header flags back in.
wjbeckett Oct 1, 2024
a6e3203
updated docs, broke the well-known and element client modifications o…
wjbeckett Oct 1, 2024
f684719
fixed error with element client update task
wjbeckett Oct 1, 2024
1e6698c
updated documentation or the new roles.
wjbeckett Oct 2, 2024
a03f598
removed trailing whitespaces
wjbeckett Oct 3, 2024
b7e0a41
Merge branch 'spantaleev:master' into element-call-integration
wjbeckett Oct 3, 2024
1906d61
updated traefik label to be in line with the latest change from devtu…
wjbeckett Oct 3, 2024
e18b281
Updated Element call docs with dependent services and fixed typo.
wjbeckett Oct 3, 2024
fa2a913
fixing issue with element call domain not being expanded when writing…
wjbeckett Oct 3, 2024
10df145
Update roles/custom/matrix-livekit-server/tasks/install.yml
spantaleev Nov 21, 2024
b691f39
Update roles/custom/matrix-livekit-server/tasks/install.yml
spantaleev Nov 21, 2024
85c0ffa
Update roles/custom/matrix-livekit-server/tasks/uninstall.yml
spantaleev Nov 21, 2024
8212783
Update roles/custom/matrix-livekit-server/tasks/uninstall.yml
spantaleev Nov 21, 2024
1e82530
Merge branch 'master' into element-call-integration
spantaleev Nov 21, 2024
1838a54
Variables rename (matrix_livekit_server_ -> livekit_server_) to prepa…
spantaleev Nov 21, 2024
88d4668
Variable rename (livekit_server_image -> livekit_server_container_ima…
spantaleev Nov 21, 2024
925ebfb
Update docs/configuring-playbook-element-call.md
spantaleev Nov 21, 2024
55da5c3
Update docs/configuring-playbook-element-call.md
spantaleev Nov 21, 2024
25a8cb3
Update docs/configuring-playbook-element-call.md
spantaleev Nov 21, 2024
32ea60f
Update docs/configuring-playbook-element-call.md
spantaleev Nov 21, 2024
ccb29be
Update docs/configuring-playbook-jwt-service.md
spantaleev Nov 21, 2024
eb048da
Update docs/configuring-playbook-jwt-service.md
spantaleev Nov 21, 2024
df6ef10
Update docs/configuring-playbook-jwt-service.md
spantaleev Nov 21, 2024
ec41c1a
Update docs/configuring-playbook-jwt-service.md
spantaleev Nov 21, 2024
66cc364
Update docs/configuring-playbook-livekit-server.md
spantaleev Nov 21, 2024
3783922
Update docs/configuring-playbook-livekit-server.md
spantaleev Nov 21, 2024
83bb546
Update docs/configuring-playbook-livekit-server.md
spantaleev Nov 21, 2024
0f23e36
Update docs/configuring-playbook-livekit-server.md
spantaleev Nov 21, 2024
164be87
Update docs/configuring-playbook-livekit-server.md
spantaleev Nov 21, 2024
c321ca1
Update docs/configuring-playbook-livekit-server.md
spantaleev Nov 21, 2024
c07b093
Update docs/configuring-playbook-livekit-server.md
spantaleev Nov 21, 2024
79ae704
Merge branch 'element-call-integration' of github.com:wjbeckett/matri…
spantaleev Nov 21, 2024
fa4ebd2
Cleanups
spantaleev Nov 21, 2024
783d4a2
Add livekit_server_identifier
spantaleev Nov 21, 2024
721fb39
More progress on the LiveKit role
spantaleev Nov 21, 2024
3e86ada
Fix port exposure for LiveKit Server
spantaleev Nov 21, 2024
8b84eb6
Default LiveKit Server to a smaller RTC range for faster startup on n…
spantaleev Nov 21, 2024
be72717
Make LiveKit Server logging config configurable
spantaleev Nov 21, 2024
f0466d5
Make LiveKit Server configuration extensible
spantaleev Nov 21, 2024
394fdca
Relocate org.matrix.msc4143.rtc_foci setup to /.well-known/matrix/cli…
spantaleev Nov 21, 2024
7a6fcaa
Fix typo
spantaleev Nov 21, 2024
3f52cec
Relocate Element Web features & element_call configuration to Element…
spantaleev Nov 21, 2024
252ca52
Relocate /.well-known/element/element.json setup to matrix-static-fil…
spantaleev Nov 21, 2024
69d7026
Remove homeserver.yaml patching from Element Call role
spantaleev Nov 21, 2024
0069208
Rename file (element-call-labels -> labels)
spantaleev Nov 21, 2024
c57d0d1
Eliminate remaining matrix references from LiveKit Server role
spantaleev Nov 21, 2024
bb925f4
Merge branch 'master' into element-call-integration
spantaleev Nov 23, 2024
5642755
Rework LiveKit JWT Service role
spantaleev Nov 23, 2024
74fbacb
Update docs/configuring-playbook-element-call.md
spantaleev Nov 23, 2024
bb403e1
Update docs/configuring-playbook-jwt-service.md
spantaleev Nov 23, 2024
9a8a569
Update docs/configuring-playbook-element-call.md
spantaleev Nov 23, 2024
0b9389f
Update docs/configuring-playbook-livekit-server.md
spantaleev Nov 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions docs/configuring-playbook-element-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Setting up Element Call (optional)

The playbook can install and configure [Element Call](https://github.com/vector-im/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.

See the project's [documentation](https://github.com/vector-im/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).

This makes it easy to set it up, **without** having to adjust your DNS records manually.

If you'd like to run Element Call on another hostname or path, use the `matrix_element_call_hostname` and `matrix_element_call_path_prefix` variables.

## Adjusting DNS records

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`
- `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
```

## 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`

## Usage

Once installed, Element Call integrates seamlessly with Matrix clients like [Element Web](configuring-playbook-client-element-web.md). When the Element Call service is installed, the `/.well-known/matrix/client` file is also updated. A new `org.matrix.msc4143.rtc_foci` section is added to point to your LiveKit JWT service URL (e.g., `https://matrix.example.com/lk-jwt-service`).

Additionally, the `/.well-known/element/element.json` file is created to help Element clients discover the Element Call URL (e.g., `https://call.example.com`).

## Required Firewall and Port Forwarding Rules

To ensure the services function correctly, the following firewall rules and port forwarding settings are required:

LiveKit:

- Forward UDP ports 50100:50120 to the Docker instance running LiveKit.
- Forward TCP port 7881 to the Docker instance running LiveKit.

Element Call:

- Forward TCP port 443 to the server running Traefik (for Element Call).

Ensure these ports are open and forwarded appropriately to allow traffic to flow correctly between the services.

## Additional Information

Refer to the Element Call documentation for more details on configuring and using Element Call.
40 changes: 40 additions & 0 deletions docs/configuring-playbook-jwt-service.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Setting up JWT Service (optional)

The playbook can install and configure [LiveKit JWT Service](https://github.com/element-hq/lk-jwt-service) for you.

LK-JWT-Service is currently used for a single reason: generate JWT tokens with a given identity for a given room, so that users can use them to authenticate against LiveKit SFU.

See the project's [documentation](https://github.com/element-hq/lk-jwt-service/) to learn more.

## Decide on a domain and path

By default, JWT Service is configured to be served:

- on the Matrix domain (`matrix.example.com`), configurable via `matrix_livekit_jwt_service_hostname`
- under a `/lk-jwt-service` path prefix, configurable via `matrix_livekit_jwt_service_path_prefix`

This makes it easy to set it up, **without** having to adjust your DNS records manually.

## Adjusting DNS records

If you've changed the default hostname, **you may need to adjust your DNS** records accordingly to point to the correct server.

## Adjusting the playbook configuration

Add the following configuration to your `inventory/host_vars/matrix.example.com/vars.yml` file:

```yaml
matrix_livekit_jwt_service_enabled: true
```

## 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`

## Usage

Once installed, a new `org.matrix.msc4143.rtc_foci` section is added to the Element Web client to point to your JWT service URL (e.g., `https://matrix.example.com/lk-jwt-service`).

## Additional Information

Refer to the LiveKit JWT-Service documentation for more details on configuring and using JWT Service.
55 changes: 55 additions & 0 deletions docs/configuring-playbook-livekit-server.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Setting up LiveKit (optional)

The playbook can install and configure [LiveKit](https://github.com/livekit/livekit) for you.

LiveKit is an open source project that provides scalable, multi-user conferencing based on WebRTC. It's designed to provide everything you need to build real-time video audio data capabilities in your applications.

See the project's [documentation](https://github.com/livekit/livekit) to learn more.

## Decide on a domain and path

By default, LiveKit is configured to be served on the Matrix domain (`sfu.example.com`, controlled by the `livekit_server_hostname` variable).

This makes it easy to set it up, **without** having to adjust your DNS records manually.

If you'd like to run Livekit on another hostname or path, use the `livekit_server_hostname` variable.

## Adjusting DNS records

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`

## Adjusting the playbook configuration

Add the following configuration to your `inventory/host_vars/matrix.example.com/vars.yml` file:

```yaml
livekit_server_enabled: true

# Set a secure key for LiveKit authentication
livekit_server_dev_key: 'your-secure-livekit-key'
```

## 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`

## Usage
Once installed, and in conjunction with Element Call and JWT Service, Livekit will become the WebRTC backend for all Element client calls.

## Required Firewall and Port Forwarding Rules

To ensure the services function correctly, the following firewall rules and port forwarding settings are required:

LiveKit:

- Forward UDP ports 50100:50200 to the Docker instance running LiveKit.
- Forward TCP port 7881 to the Docker instance running LiveKit.

Ensure these ports are open and forwarded appropriately to allow traffic to flow correctly between the services.

## Additional Information

Refer to the Livekit documentation for more details on configuring and using Livekit.
6 changes: 6 additions & 0 deletions docs/configuring-playbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,12 @@ Services that help you in administrating and monitoring your Matrix installation

Various services that don't fit any other categories.

- [Setting up the Element Call server](configuring-playbook-element-call.md) (optional)

- [Setting up the LiveKit JWT Service](configuring-playbook-livekit-jwt-service.md) (optional)

- [Setting up the Livekit server](configuring-playbook-livekit-server.md) (optional)

- [Setting up Synapse Auto Invite Accept](configuring-playbook-synapse-auto-accept-invite.md)

- [Setting up synapse-auto-compressor](configuring-playbook-synapse-auto-compressor.md) for compressing the database on Synapse homeservers
Expand Down
149 changes: 148 additions & 1 deletion group_vars/matrix_servers
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,12 @@ devture_systemd_service_manager_services_list_auto: |
+
([{'name': 'matrix-pantalaimon.service', 'priority': 4000, 'groups': ['matrix', 'pantalaimon']}] if matrix_pantalaimon_enabled else [])
+
([{'name': 'matrix-element-call.service', 'priority': 4000, 'groups': ['matrix', 'element-call']}] if matrix_element_call_enabled else [])
+
([{'name': 'matrix-livekit-jwt-service.service', 'priority': 3500, 'groups': ['matrix', 'livekit-jwt-service']}] if matrix_livekit_jwt_service_enabled else [])
+
([{'name': (livekit_server_identifier + '.service'), 'priority': 3000, 'groups': ['matrix', 'livekit-server']}] if livekit_server_enabled else [])
+
([{'name': 'matrix-registration.service', 'priority': 4000, 'groups': ['matrix', 'registration', 'matrix-registration']}] if matrix_registration_enabled else [])
+
([{'name': 'matrix-sliding-sync.service', 'priority': 1500, 'groups': ['matrix', 'sliding-sync']}] if matrix_sliding_sync_enabled else [])
Expand Down Expand Up @@ -4455,7 +4461,7 @@ keydb_arch: |-
#
######################################################################

valkey_enabled: "{{ matrix_synapse_workers_enabled or (matrix_hookshot_enabled and matrix_hookshot_experimental_encryption_enabled) }}"
valkey_enabled: "{{ matrix_synapse_workers_enabled or (matrix_hookshot_enabled and matrix_hookshot_experimental_encryption_enabled) or matrix_element_call_enabled }}"

valkey_identifier: matrix-valkey

Expand Down Expand Up @@ -4523,6 +4529,14 @@ matrix_client_element_enable_presence_by_hs_url: |-

matrix_client_element_jitsi_preferred_domain: "{{ matrix_server_fqn_jitsi if jitsi_enabled else '' }}"

matrix_client_element_features_feature_video_rooms: "{{ matrix_element_call_enabled }}"
matrix_client_element_features_feature_group_calls: "{{ matrix_element_call_enabled }}"
matrix_client_element_features_feature_element_call_video_rooms: "{{ matrix_element_call_enabled }}"
matrix_client_element_features_feature_oidc_native_flow: "{{ matrix_authentication_service_enabled }}"

matrix_client_element_element_call_enabled: "{{ matrix_element_call_enabled }}"
matrix_client_element_element_call_url: "{{ matrix_element_call_public_url if matrix_element_call_enabled else '' }}"

######################################################################
#
# /matrix-client-element
Expand Down Expand Up @@ -5941,8 +5955,18 @@ matrix_static_files_file_matrix_client_property_m_tile_server_map_style_url: "{{
# See: https://github.com/etkecc/synapse-admin/pull/126
matrix_static_files_file_matrix_client_property_cc_etke_synapse_admin_auto: "{{ matrix_synapse_admin_configuration if matrix_homeserver_implementation == 'synapse' else {} }}"

matrix_static_files_file_matrix_client_property_org_matrix_msc4143_rtc_foci_enabled: "{{ matrix_element_call_enabled }}"
matrix_static_files_file_matrix_client_property_org_matrix_msc4143_rtc_foci_auto: |-
{{
(
[{'type': 'livekit', 'livekit_service_url': matrix_livekit_jwt_service_public_url}] if matrix_livekit_jwt_service_enabled else []
)
}}

matrix_static_files_file_matrix_server_property_m_server: "{{ matrix_server_fqn_matrix_federation }}:{{ matrix_federation_public_port }}"

matrix_static_files_file_element_element_json_property_call_widget_url: "{{ matrix_element_call_public_url if matrix_element_call_enabled else '' }}"

matrix_static_files_scheme: "{{ 'https' if matrix_playbook_ssl_enabled else 'http' }}"

matrix_static_files_self_check_hostname_matrix: "{{ matrix_server_fqn_matrix }}"
Expand Down Expand Up @@ -6049,3 +6073,126 @@ traefik_certs_dumper_ssl_dir_path: "{{ traefik_ssl_dir_path if traefik_enabled e
# /traefik_certs_dumper #
# #
########################################################################


########################################################################
# #
# matrix-element-call #
# #
########################################################################

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_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 }}"
matrix_element_call_container_labels_traefik_tls_certResolver: "{{ traefik_certResolver_primary }}"

########################################################################
# #
# /matrix-element-call #
# #
########################################################################

########################################################################
# #
# livekit-server #
# #
########################################################################

livekit_server_enabled: "{{ matrix_element_call_enabled }}"

livekit_server_identifier: matrix-livekit-server

livekit_server_uid: "{{ matrix_user_uid }}"
livekit_server_gid: "{{ matrix_user_gid }}"

livekit_server_base_path: "{{ matrix_base_data_path }}/livekit-server"

livekit_server_hostname: "sfu.{{ matrix_domain }}"

livekit_server_container_image_self_build: "{{ matrix_architecture not in ['arm64', 'amd64'] }}"

livekit_server_container_network: "{{ matrix_addons_container_network }}"
livekit_server_container_additional_networks_auto: "{{ [matrix_playbook_reverse_proxyable_services_additional_network] if (livekit_server_container_labels_traefik_enabled and matrix_playbook_reverse_proxyable_services_additional_network) else [] }}"

livekit_server_container_labels_traefik_enabled: "{{ matrix_playbook_reverse_proxy_type in ['playbook-managed-traefik', 'other-traefik-container'] }}"
livekit_server_container_labels_traefik_docker_network: "{{ matrix_playbook_reverse_proxyable_services_additional_network }}"
livekit_server_container_labels_traefik_entrypoints: "{{ traefik_entrypoint_primary }}"
livekit_server_container_labels_traefik_tls_certResolver: "{{ traefik_certResolver_primary }}"

livekit_server_config_keys_auto: |-
{{
{}
| combine(
{matrix_livekit_jwt_service_environment_variable_livekit_key: matrix_livekit_jwt_service_environment_variable_livekit_secret}
if matrix_livekit_jwt_service_enabled else {}
)
}}

########################################################################
# #
# /livekit-server #
# #
########################################################################


########################################################################
# #
# matrix-livekit-jwt-service #
# #
########################################################################

matrix_livekit_jwt_service_enabled: "{{ matrix_element_call_enabled and livekit_server_enabled }}"

matrix_livekit_jwt_service_scheme: "{{ 'https' if matrix_playbook_ssl_enabled else 'http' }}"

matrix_livekit_jwt_service_hostname: "{{ matrix_server_fqn_matrix }}"
matrix_livekit_jwt_service_path_prefix: "/lk-jwt-service"

matrix_livekit_jwt_service_container_image_self_build: "{{ matrix_architecture not in ['amd64', 'arm64'] }}"

matrix_livekit_jwt_service_container_network: "{{ matrix_addons_container_network }}"

matrix_livekit_jwt_service_container_additional_networks_auto: |
{{
(
([matrix_playbook_reverse_proxyable_services_additional_network] if (matrix_livekit_jwt_service_container_labels_traefik_enabled and matrix_playbook_reverse_proxyable_services_additional_network) else [])
+
([livekit_server_container_network] if livekit_server_enabled and (matrix_livekit_jwt_service_environment_variable_livekit_url == livekit_server_websocket_container_url and livekit_server_container_network != matrix_livekit_jwt_service_container_network) else [])
) | unique
}}

matrix_livekit_jwt_service_container_labels_traefik_enabled: "{{ matrix_playbook_reverse_proxy_type in ['playbook-managed-traefik', 'other-traefik-container'] }}"
matrix_livekit_jwt_service_container_labels_traefik_docker_network: "{{ matrix_playbook_reverse_proxyable_services_additional_network }}"
matrix_livekit_jwt_service_container_labels_traefik_entrypoints: "{{ traefik_entrypoint_primary }}"
matrix_livekit_jwt_service_container_labels_traefik_tls_certResolver: "{{ traefik_certResolver_primary }}"

matrix_livekit_jwt_service_environment_variable_livekit_url: "{{ livekit_server_websocket_container_url }}"

matrix_livekit_jwt_service_environment_variable_livekit_key: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'lk.key', rounds=655555) | to_uuid }}"

matrix_livekit_jwt_service_environment_variable_livekit_secret: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'lk.secret', rounds=655555) | to_uuid }}"

########################################################################
# #
# /matrix-livekit-jwt-service #
# #
########################################################################
Loading