Compare commits

...

113 Commits

Author SHA1 Message Date
Backslash
08d3c45bf2
Merge fa2a913d39 into 5dfd023a50 2024-10-24 23:44:27 +02:00
Slavi Pantaleev
5dfd023a50
Merge pull request #3675 from aine-etke/patch-51415
Update configuring-playbook-synapse-admin.md - add community room link
2024-10-24 19:40:58 +03:00
Aine
823a911361
Update configuring-playbook-synapse-admin.md - add community room link 2024-10-24 14:14:17 +03:00
wjbeckett
fa2a913d39 fixing issue with element call domain not being expanded when writing the element web config.json. 2024-10-03 16:20:54 +10:00
wjbeckett
e18b28136c Updated Element call docs with dependent services and fixed typo. 2024-10-03 15:28:56 +10:00
wjbeckett
1906d61c39 updated traefik label to be in line with the latest change from devture_traefik_ to traefik_ 2024-10-03 13:25:40 +10:00
Backslash
b7e0a41134
Merge branch 'spantaleev:master' into element-call-integration 2024-10-03 13:20:02 +10:00
wjbeckett
a03f5985a5 removed trailing whitespaces 2024-10-03 12:38:34 +10:00
wjbeckett
1e6698cb99 updated documentation or the new roles. 2024-10-02 13:27:02 +10:00
wjbeckett
f684719b2a fixed error with element client update task 2024-10-01 22:30:09 +10:00
wjbeckett
a6e3203398 updated docs, broke the well-known and element client modifications out to separate tasks. 2024-10-01 22:20:50 +10:00
wjbeckett
2b4fdea70f added header flags back in. 2024-10-01 17:04:11 +10:00
wjbeckett
6c8923ae28 removed headers. 2024-10-01 16:51:06 +10:00
wjbeckett
9691577b22 removed additinoal headers 2024-10-01 16:45:07 +10:00
wjbeckett
46109565e1 updated headers for each of the call services. 2024-10-01 16:33:48 +10:00
wjbeckett
4acb025130 testing livekit configuration 2024-10-01 13:35:53 +10:00
wjbeckett
e421852af5 updated jwt bind port 2024-10-01 13:09:00 +10:00
wjbeckett
5507fb3bab added element-call config.json to systemd file 2024-10-01 13:08:21 +10:00
wjbeckett
9864996aad adjusted jwt service ports for traefik 2024-10-01 12:46:37 +10:00
wjbeckett
dbbaae4fbe stopping the recursive loop 2024-10-01 12:34:25 +10:00
wjbeckett
d53c2428b8 updated jwt hostname. 2024-10-01 12:29:35 +10:00
wjbeckett
f98a505df8 changed jwt-service port label. 2024-10-01 11:00:56 +10:00
wjbeckett
d5aabc85be removed redis images in favor of the inbuilt keyDB 2024-10-01 10:41:30 +10:00
wjbeckett
7cdec5f251 fixed type in livekit image 2024-10-01 10:17:34 +10:00
wjbeckett
fd2f505b34 Fixed typo in livekit server hostname 2024-10-01 10:00:30 +10:00
wjbeckett
812b57cfaa resolved missing key. 2024-10-01 09:54:02 +10:00
wjbeckett
b7b8ed573b typo in livekit-server validate. 2024-10-01 09:48:44 +10:00
wjbeckett
97f93ebd76 renamed the livekit role and added livekit-server and jwt-service roles to the setup file. 2024-10-01 09:31:42 +10:00
wjbeckett
8cb7deff15 cleaned up old services again 2024-09-30 23:04:10 +10:00
wjbeckett
71dff50a65 fixed livekit service name 2024-09-30 22:53:21 +10:00
wjbeckett
58a9642e8c fixed config file placement. 2024-09-30 22:45:56 +10:00
wjbeckett
3de399025f hard coded redis port. 2024-09-30 22:41:36 +10:00
wjbeckett
e952ba1c3a removed duplicate tasks. 2024-09-30 22:35:59 +10:00
wjbeckett
8cb3e33bbf separated livekit and jwt to separate roles 2024-09-30 22:20:46 +10:00
wjbeckett
b907777ae5 fixing labels again. 2024-09-30 13:13:29 +10:00
wjbeckett
cb41fb02ae testing traefik labels again. 2024-09-30 13:00:10 +10:00
wjbeckett
31a138a6ba fixed traefik router issues. 2024-09-30 12:47:42 +10:00
wjbeckett
6143ad7ffa fix: removed the read-only tag from the element-call systemd file. 2024-09-30 12:27:04 +10:00
wjbeckett
f762048a8d fix: added missing labels to main. 2024-09-30 12:15:27 +10:00
wjbeckett
93650cf20e fix: Type in the element-call main.yml 2024-09-30 12:02:45 +10:00
wjbeckett
9dbee212d8 fix: removed duplicate keys. 2024-09-30 11:37:08 +10:00
wjbeckett
1167e1ec13 fix: changed matrix server name to matrix domain in element-call config. 2024-09-30 11:17:34 +10:00
wjbeckett
f036e18789 Fix: Restructured Element call configuration files. 2024-09-30 11:05:11 +10:00
Backslash
a274d32c6d
Removed serve function 2024-09-27 12:50:31 +10:00
Backslash
5db9a5c061
Removed env file 2024-09-27 12:40:37 +10:00
Backslash
2492672025
Update env.j2 2024-09-27 12:39:39 +10:00
Backslash
a0917fa283
Update main.yml 2024-09-27 12:37:36 +10:00
Backslash
8b172cc194
Update env.j2 2024-09-27 12:35:38 +10:00
Backslash
63133d6599
Added serve command back in. 2024-09-27 11:53:26 +10:00
Backslash
5b8dcf32d5
Added element-call systemd services to the service manager. 2024-09-27 11:42:34 +10:00
Backslash
14614cb211
Update matrix-element-call.service.j2 2024-09-27 10:26:01 +10:00
Backslash
3c084e17d2
Update element-call-labels.j2-new 2024-09-27 10:15:51 +10:00
Backslash
089c5f14c8
Update jwt-service-labels.j2 2024-09-27 10:00:40 +10:00
Backslash
b6571fc4fd
Update livekit-labels.j2 2024-09-27 09:59:54 +10:00
Backslash
6d6f9ab853
Added hostnames for livekit and jwt labels 2024-09-27 09:59:13 +10:00
Backslash
5730dbfc6e
Added hostname label 2024-09-27 09:54:01 +10:00
Backslash
c14f9cdcb5
Update matrix_servers 2024-09-27 09:25:48 +10:00
Backslash
805b726c6d
Update element-call-labels.j2 2024-09-27 09:25:01 +10:00
Backslash
5f49433f6c
Handle empty labels correctly. 2024-09-27 09:15:21 +10:00
Backslash
510cfb2dac
Update matrix_servers 2024-09-27 09:14:29 +10:00
Backslash
1721e85195
Corrected element call labels file name 2024-09-27 09:00:03 +10:00
Backslash
25909b1029
Update and rename labels.j2 to element-call-labels.j2 2024-09-27 08:51:27 +10:00
Backslash
3264408758
Rename element-call-labels.j2 to element-call-labels.j2-new 2024-09-27 08:49:55 +10:00
Backslash
dd96b93d89
Update matrix-element-call.service.j2 2024-09-27 08:34:01 +10:00
Backslash
df4bf4a0c9
Added tasks for moving the new labels files into place 2024-09-27 08:23:24 +10:00
Backslash
2f2cb8962e
Updated livekit labels 2024-09-27 08:19:26 +10:00
Backslash
d2e2781d3b
Updated label file 2024-09-27 08:18:27 +10:00
Backslash
80763804f9
Updated label file 2024-09-27 08:16:56 +10:00
Backslash
1d7a60055c
Create jwt-service-labels.j2 2024-09-27 08:10:06 +10:00
Backslash
2cf471075d
Created livekit-labels.j2 2024-09-27 08:09:32 +10:00
Backslash
6a519bb053
Created element-call-labels to separate the labels for each container 2024-09-27 08:08:42 +10:00
Backslash
f0632b20eb
Added missing labels for sfu and jwt 2024-09-26 21:24:43 +10:00
Backslash
5cc9c70ba6
Remove serve command from matrix-element-call.service.j2 2024-09-26 20:57:47 +10:00
Backslash
e34e5da9a4
Update matrix-redis.service.j2 2024-09-26 19:57:39 +10:00
Backslash
656d4275bc
Update install.yml 2024-09-26 19:48:06 +10:00
Backslash
6ef304b118
Update validate_config.yml 2024-09-26 19:43:22 +10:00
Backslash
85be68946c
Migrated from matrix_redis to redis_ 2024-09-26 19:30:15 +10:00
Backslash
3f6c327da2
Update main.yml 2024-09-26 19:18:47 +10:00
Backslash
ba54e549c4
Added well-known element directory 2024-09-26 19:08:09 +10:00
Backslash
f2acc7430d
Create well_known_element.json.j2 2024-09-26 18:53:49 +10:00
Backslash
9cb236da30
Update install.yml 2024-09-26 18:50:48 +10:00
Backslash
f38d6a0d88
Update main.yml 2024-09-26 18:39:03 +10:00
Backslash
ac1295ac45
Create matrix-jwt-service.service.j2 2024-09-26 18:33:22 +10:00
Backslash
bc2ed60762
Update main.yml 2024-09-26 17:23:03 +10:00
Backslash
f7621283fd
Update labels.j2 2024-09-26 16:31:23 +10:00
Backslash
e31e688a41
Update main.yml 2024-09-26 15:42:05 +10:00
Backslash
a533ec4204
Update matrix_servers 2024-09-26 15:38:12 +10:00
Backslash
f16ca24408
Update install.yml 2024-09-26 15:17:15 +10:00
Backslash
e910d09ff1
Create matrix-redis.service.j2 2024-09-26 14:52:30 +10:00
Backslash
bc9658c06b
Create matrix-livekit.service.j2 2024-09-26 13:40:38 +10:00
Backslash
45c8a61f04
Migrating to systemd for container management 2024-09-26 11:39:33 +10:00
Backslash
954d46cfd7
Update labels.j2 2024-09-26 09:25:49 +10:00
Backslash
dfeca192ab
Update redis.conf.j2 2024-09-26 09:23:26 +10:00
Backslash
f306a47b83
Update livekit.yaml.j2 2024-09-26 09:22:29 +10:00
Backslash
becdb0810c
Update config.json.j2 2024-09-26 09:18:55 +10:00
Backslash
37fd2e701d
Update env.j2 to support the new configuration 2024-09-26 09:15:07 +10:00
Backslash
68cc1f4b2b
Simplified the validation step. 2024-09-26 08:29:16 +10:00
Backslash
5efc189293
Updated to support new structure 2024-09-26 08:12:06 +10:00
Backslash
02479e8bec
Updated with new structure. 2024-09-26 07:59:09 +10:00
Backslash
0eef094f2b
Restructure install.yml to follow other roles more closely 2024-09-26 06:51:36 +10:00
Backslash
16ed788b3f
Update main.yml 2024-09-25 21:07:22 +10:00
Backslash
6364101410
Adding another debug task for testing the labels file. 2024-09-25 20:20:20 +10:00
Backslash
81735503f8
Added debug task to test labels configuration 2024-09-25 20:06:27 +10:00
Backslash
8644a7383e
Removed additional label loop 2024-09-25 19:22:21 +10:00
Backslash
ce827e7953
Changed matrix_base_domain to matrix_domain 2024-09-25 19:09:13 +10:00
Backslash
c93d30bcb8
Added matrix_server_name to the defaults 2024-09-25 19:07:03 +10:00
Backslash
90ea758c3b
Fixed regex for checking the hostname. 2024-09-25 18:39:26 +10:00
Backslash
350d4d4bcd
Fixed assertion block to remove jinja2 delimiters 2024-09-25 18:35:09 +10:00
Backslash
fc6357a089
Update main.yml 2024-09-25 18:05:34 +10:00
wjbeckett
60f34cd7af fixed matrix_redis for migration 2024-09-25 16:13:29 +10:00
wjbeckett
d1ba784dde added doc for setting up element call. 2024-09-25 15:01:53 +10:00
Backslash
434157eb98
Merge branch 'spantaleev:master' into element-call-integration 2024-09-25 14:55:42 +10:00
wjbeckett
6594cce570 Feat: Added element call setup and configuration. 2024-09-25 14:53:48 +10:00
35 changed files with 1372 additions and 1 deletions

View File

@ -0,0 +1,71 @@
# 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.DOMAIN`
- `sfu.DOMAIN`
- `sfu-jwt.DOMAIN`
## Adjusting the playbook configuration
NOTE: Element call is dependent on two other services for it to function as intended. In orter to utilise Element Call you need to also enable the [JWT Service](configuring-playbook-jwt-service.md) and [Livekit Server](configuring-playbook-livekit-server.md).
Add the following configuration to your `inventory/host_vars/matrix.DOMAIN/vars.yml` file:
```yaml
# Enable dependent services
keydb_enabled: true
matrix_element_call_enabled: true
matrix_livekit_server_enabled: true
matrix_jwt_service_enabled: true
# Set a secure key for LiveKit authentication
matrix_livekit_server_dev_key: 'your-secure-livekit-key'
```
## Installing
After potentially adjusting DNS records and configuring the playbook, run the installation command again:
```yaml
ansible-playbook -i inventory setup.yml
```
## Usage
Once installed, Element Call integrates seamlessly with Matrix clients like Element Web. 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 JWT service URL (e.g., `https://sfu-jwt.DOMAIN`).
Additionally, the `/.well-known/element/element.json` file is created to help Element clients discover the Element Call URL (e.g., `https://call.DOMAIN`).
## 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.
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.

View File

@ -0,0 +1,45 @@
# Setting up JWT Service (optional)
The playbook can install and configure [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 (`sfu-jwt.DOMAIN`, controlled by the `matrix_jwt-service_hostname` variable).
This makes it easy to set it up, **without** having to adjust your DNS records manually.
If you'd like to run JWT Service on another hostname or path, use the `matrix_jwt-service_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-jwt.DOMAIN`
## Adjusting the playbook configuration
Add the following configuration to your `inventory/host_vars/matrix.DOMAIN/vars.yml` file:
```yaml
matrix_jwt_service_enabled: true
# Set a secure key for LiveKit authentication
matrix_element_call_livekit_dev_key: 'your-secure-livekit-key'
```
## Installing
After potentially adjusting DNS records and configuring the playbook, run the installation command again:
```yaml
ansible-playbook -i inventory setup.yml
```
## 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://sfu-jwt.DOMAIN`).
## Additional Information
Refer to the JWT-Service documentation for more details on configuring and using JWT Service.

View File

@ -0,0 +1,56 @@
# 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.DOMAIN`, controlled by the `matrix_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 `matrix_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.DOMAIN`
## Adjusting the playbook configuration
Add the following configuration to your `inventory/host_vars/matrix.DOMAIN/vars.yml` file:
```yaml
matrix_livekit_server_enabled: true
# Set a secure key for LiveKit authentication
matrix_element_call_livekit_dev_key: 'your-secure-livekit-key'
```
## Installing
After potentially adjusting DNS records and configuring the playbook, run the installation command again:
```yaml
ansible-playbook -i inventory setup.yml
```
## 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.

View File

@ -1,6 +1,6 @@
# Setting up Synapse Admin (optional)
The playbook can install and configure [etkecc/synapse-admin](https://github.com/etkecc/synapse-admin) (a [feature-rich](https://github.com/etkecc/synapse-admin#fork-differences) fork of [Awesome-Technologies/synapse-admin](https://github.com/Awesome-Technologies/synapse-admin)) for you.
The playbook can install and configure [etkecc/synapse-admin](https://github.com/etkecc/synapse-admin) (a [feature-rich](https://github.com/etkecc/synapse-admin#fork-differences) fork of [Awesome-Technologies/synapse-admin](https://github.com/Awesome-Technologies/synapse-admin), community room: [#synapse-admin:etke.cc](https://matrix.to/#/#synapse-admin:etke.cc)) for you.
synapse-admin is a web UI tool you can use to **administrate users, rooms, media, etc. on your Matrix server**. It's designed to work with the Synapse homeserver implementation and WON'T work with Dendrite because [Dendrite Admin API](https://matrix-org.github.io/dendrite/administration/adminapi) differs from [Synapse Admin API](https://element-hq.github.io/synapse/latest/usage/administration/admin_api/).

View File

@ -235,3 +235,9 @@ When you're done with all the configuration you'd like to do, continue with [Ins
- [Setting up the rageshake bug report server](configuring-playbook-rageshake.md) (optional)
- [Setting up Prometheus Alertmanager integration via matrix-alertmanager-receiver](configuring-playbook-alertmanager-receiver.md) (optional)
- [Setting up the Element Call server](configuring-playbook-element-call.md) (optional)
- [Setting up the JWT Service](configuring-playbook-jwt-service.md) (optional)
- [Setting up the Livekit server](configuring-playbook-livekit-server.md) (optional)

View File

@ -435,6 +435,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-jwt-service.service', 'priority': 3000, 'groups': ['matrix', 'jwt-service']}] if matrix_jwt_service_enabled else [])
+
([{'name': 'matrix-livekit-server.service', 'priority': 3000, 'groups': ['matrix', 'livekit-server']}] if matrix_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 [])
@ -5989,3 +5995,110 @@ traefik_certs_dumper_ssl_dir_path: "{{ traefik_ssl_dir_path if traefik_enabled e
# /traefik_certs_dumper #
# #
########################################################################
########################################################################
# #
# matrix-element-call #
# #
########################################################################
# Matrix Element Call Configuration
matrix_element_call_enabled: false # Default is false; should be enabled in host_vars as needed
matrix_element_call_version: "latest" # Default version; can be overridden in host_vars
matrix_element_call_scheme: "https" # Scheme for Element Call (e.g., https)
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 #
# #
########################################################################
########################################################################
# #
# matrix-livekit-server #
# #
########################################################################
# Matrix Livekit Server Configuration
matrix_livekit_server_enabled: false # Default is false; should be enabled in host_vars as needed
matrix_livekit_server_version: "latest" # Default version; can be overridden in host_vars
matrix_livekit_server_scheme: "https"
matrix_livekit_server_hostname: "sfu.{{ matrix_domain }}" # Default hostname; should be overridden in host_vars if different
matrix_livekit_server_path_prefix: "/"
matrix_livekit_server_base_path: "{{ matrix_base_data_path }}/livekit-server"
matrix_livekit_server_container_image: "livekit/livekit-server:{{ matrix_livekit_server_version }}"
matrix_livekit_server_container_image_force_pull: true
# Docker network configuration for Livekit
matrix_livekit_server_container_network: "{{ matrix_addons_container_network }}"
matrix_livekit_server_container_additional_networks: "{{ [matrix_playbook_reverse_proxyable_services_additional_network] if (matrix_livekit_server_container_labels_traefik_enabled and matrix_playbook_reverse_proxyable_services_additional_network) else [] }}"
# Traefik Configuration for Livekit
matrix_livekit_container_labels_traefik_enabled: "{{ matrix_playbook_reverse_proxy_type in ['playbook-managed-traefik', 'other-traefik-container'] }}"
matrix_livekit_container_labels_traefik_docker_network: "{{ matrix_playbook_reverse_proxyable_services_additional_network }}"
matrix_livekit_server_container_labels_traefik_entrypoints: "{{ traefik_entrypoint_primary }}"
matrix_livekit_server_container_labels_traefik_tls_certResolver: "{{ traefik_certResolver_primary }}"
# LiveKit Service Configuration
matrix_livekit_server_livekit_dev_key: "{{ matrix_livekit_server_dev_key }}" # LiveKit dev key
########################################################################
# #
# /matrix-livekit-server #
# #
########################################################################
########################################################################
# #
# matrix-jwt-service #
# #
########################################################################
# Matrix JWT Service Configuration
matrix_jwt_service_enabled: false # Default is false; should be enabled in host_vars as needed
matrix_jwt_service_version: "latest-ci" # Default version; can be overridden in host_vars
matrix_jwt_service_scheme: "https" # Scheme for Element Call (e.g., https)
matrix_jwt_service_hostname: "sfu-jwt.{{ matrix_domain }}" # Default hostname; should be overridden in host_vars if different
matrix_jwt_service_path_prefix: "/" # Path prefix for Element Call
matrix_jwt_service_base_path: "{{ matrix_base_data_path }}/matrix-jwt-service" # Base path for storing Element Call-related files
matrix_jwt_service_container_image: "ghcr.io/element-hq/lk-jwt-service:{{ matrix_jwt_service_version }}"
matrix_jwt_service_container_image_name_prefix: ghcr.io/
matrix_jwt_service_container_image_registry_prefix: ghcr.io/
matrix_jwt_service_container_image_force_pull: true
# Docker network configuration for JWT Service
matrix_jwt_service_container_network: "{{ matrix_addons_container_network }}"
matrix_jwt_service_container_additional_networks: "{{ [matrix_playbook_reverse_proxyable_services_additional_network] if (matrix_jwt_service_container_labels_traefik_enabled and matrix_playbook_reverse_proxyable_services_additional_network) else [] }}"
# Traefik Configuration for JWT Service
matrix_jwt_service_container_labels_traefik_enabled: "{{ matrix_playbook_reverse_proxy_type in ['playbook-managed-traefik', 'other-traefik-container'] }}"
matrix_jwt_service_container_labels_traefik_docker_network: "{{ matrix_playbook_reverse_proxyable_services_additional_network }}"
matrix_jwt_service_container_labels_traefik_entrypoints: "{{ traefik_entrypoint_primary }}"
matrix_jwt_service_container_labels_traefik_tls_certResolver: "{{ traefik_certResolver_primary }}"
# JWT Service Configuration
matrix_jwt_service_url: "https://sfu-jwt.{{ matrix_domain }}" # Default JWT service URL; adjust as needed
########################################################################
# #
# /matrix-jwt-service #
# #
########################################################################

View File

@ -0,0 +1,125 @@
---
# Enable or disable matrix-element-call deployment
matrix_element_call_enabled: false
# Base path configuration
matrix_element_call_base_path: "{{ matrix_base_data_path }}/element-call"
matrix_homeserver_config_path: "{{ matrix_base_data_path }}/synapse/config/homeserver.yaml"
element_web_config_path: "{{ matrix_base_data_path }}/client-element/config.json"
# 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
# Docker images
matrix_element_call_image: "ghcr.io/element-hq/element-call:latest"
# Ports
matrix_element_call_port: "8093"
# Well-known paths and domains (derived from matrix_domain)
matrix_element_call_domain: "call.{{ matrix_domain }}"
matrix_element_call_well_known_client_path: "{{ matrix_base_data_path }}/static-files/public/.well-known/matrix/client"
matrix_element_call_well_known_element_path: "{{ matrix_base_data_path }}/static-files/public/.well-known/element/element.json"
matrix_element_call_base_url: "https://{{ matrix_element_call_domain }}"
# Traefik Configuration for Element Call
matrix_element_call_container_labels_traefik_enabled: true
matrix_element_call_container_labels_traefik_docker_network: "{{ matrix_element_call_container_network }}"
matrix_element_call_container_labels_traefik_hostname: "{{ matrix_element_call_domain }}"
# The path prefix must either be `/` or not end with a slash (e.g. `/element`).
matrix_element_call_container_labels_traefik_path_prefix: "{{ matrix_element_call_path_prefix }}"
matrix_element_call_container_labels_traefik_rule: "Host(`{{ matrix_element_call_container_labels_traefik_hostname }}`){% if matrix_element_call_container_labels_traefik_path_prefix != '/' %} && PathPrefix(`{{ matrix_element_call_container_labels_traefik_path_prefix }}`){% endif %}"
matrix_element_call_container_labels_traefik_priority: 0
matrix_element_call_container_labels_traefik_entrypoints: web-secure
matrix_element_call_container_labels_traefik_tls: "{{ matrix_element_call_container_labels_traefik_entrypoints != 'web' }}"
matrix_element_call_container_labels_traefik_tls_certResolver: default # noqa var-naming
# Controls which additional headers to attach to all HTTP responses.
# To add your own headers, use `matrix_element_call_container_labels_traefik_additional_response_headers_custom`
matrix_element_call_container_labels_traefik_additional_response_headers: "{{ matrix_element_call_container_labels_traefik_additional_response_headers_auto | combine(matrix_element_call_container_labels_traefik_additional_response_headers_custom) }}"
matrix_element_call_container_labels_traefik_additional_response_headers_auto: |
{{
{}
| combine ({'X-XSS-Protection': matrix_element_call_http_header_xss_protection} if matrix_element_call_http_header_xss_protection else {})
| combine ({'X-Frame-Options': matrix_element_call_http_header_frame_options} if matrix_element_call_http_header_frame_options else {})
| combine ({'X-Content-Type-Options': matrix_element_call_http_header_content_type_options} if matrix_element_call_http_header_content_type_options else {})
| combine ({'Content-Security-Policy': matrix_element_call_http_header_content_security_policy} if matrix_element_call_http_header_content_security_policy else {})
| combine ({'Permission-Policy': matrix_element_call_http_header_content_permission_policy} if matrix_element_call_http_header_content_permission_policy else {})
| combine ({'Strict-Transport-Security': matrix_element_call_http_header_strict_transport_security} if matrix_element_call_http_header_strict_transport_security and matrix_element_call_container_labels_traefik_tls else {})
}}
matrix_element_call_container_labels_traefik_additional_response_headers_custom: {}
# matrix_client_element_container_labels_additional_labels contains a multiline string with additional labels to add to the container label file.
# See `../templates/labels.j2` for details.
#
# Example:
# matrix_client_element_container_labels_additional_labels: |
# my.label=1
# another.label="here"
matrix_element_call_container_labels_additional_labels: ''
# A list of extra arguments to pass to the container
matrix_element_call_container_extra_arguments: []
# Additional environment variables for the container
matrix_element_call_environment_variables_additional: {}
# List of systemd services that matrix-element-call.service depends on
matrix_element_call_systemd_required_services_list: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}"
# Specifies the value of the `X-XSS-Protection` header
# Stops pages from loading when they detect reflected cross-site scripting (XSS) attacks.
#
# Learn more about it is here:
# - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection
# - https://portswigger.net/web-security/cross-site-scripting/reflected
matrix_element_call_http_header_xss_protection: ''
# Specifies the value of the `X-Frame-Options` header which controls whether framing can happen.
# See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
matrix_element_call_http_header_frame_options: ''
# Specifies the value of the `X-Content-Type-Options` header.
# See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
matrix_element_call_http_header_content_type_options: ''
# Specifies the value of the `Content-Security-Policy` header.
# See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
matrix_element_call_http_header_content_security_policy: ''
# Specifies the value of the `Permission-Policy` header.
# See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permission-Policy
matrix_element_call_http_header_content_permission_policy: ''
# Specifies the value of the `Strict-Transport-Security` header.
# See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
matrix_element_call_http_header_strict_transport_security: ''
# Controls whether to send a "Permissions-Policy interest-cohort=();" header along with all responses
#
# Learn more about what it is here:
# - https://www.eff.org/deeplinks/2021/03/googles-floc-terrible-idea
# - https://paramdeo.com/blog/opting-your-website-out-of-googles-floc-network
# - https://amifloced.org/
#
# Of course, a better solution is to just stop using browsers (like Chrome), which participate in such tracking practices.
# See: `matrix_element_call_content_permission_policy`
matrix_element_call_floc_optout_enabled: false
# Controls if HSTS preloading is enabled
#
# In its strongest and recommended form, the [HSTS policy](https://www.chromium.org/hsts) includes all subdomains, and
# indicates a willingness to be "preloaded" into browsers:
# `Strict-Transport-Security: max-age=31536000; includeSubDomains; preload`
# For more information visit:
# - https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security
# - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
# - https://hstspreload.org/#opt-in
# See: `matrix_element_call_http_header_strict_transport_security`
matrix_element_call_hsts_preload_enabled: false
# Enable or disable metrics collection
matrix_element_call_metrics_enabled: false
matrix_element_call_metrics_port: 2112

View File

@ -0,0 +1,99 @@
---
# roles/custom/matrix-element-call/tasks/install.yml
# Ensure Required Directories Exist
- name: Ensure matrix-element-call paths exist
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
mode: 0750
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
with_items:
- path: "{{ matrix_element_call_base_path }}"
- path: "{{ matrix_base_data_path }}/static-files/public/.well-known/element" # Directory for element.json
# Ensure Configuration Files are in Place
- name: Ensure Element Call config.json is in place
ansible.builtin.template:
src: "{{ role_path }}/templates/config.json.j2"
dest: "{{ matrix_element_call_base_path }}/config.json"
mode: 0640
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-element-call Docker labels file is in place
ansible.builtin.template:
src: "{{ role_path }}/templates/element-call-labels.j2"
dest: "{{ matrix_element_call_base_path }}/element-call-labels"
mode: 0640
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
# Ensure Docker Images are Pulled
- name: Ensure matrix-element-call Docker image is pulled
community.docker.docker_image:
name: "{{ matrix_element_call_container_image }}"
source: pull
force_source: "{{ matrix_element_call_container_image_force_pull }}"
register: element_call_image_result
retries: "{{ devture_playbook_help_container_retries_count }}"
delay: "{{ devture_playbook_help_container_retries_delay }}"
until: element_call_image_result is not failed
# Systemd Services for Element Call
- name: Ensure matrix-element-call systemd service is installed
ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-element-call.service.j2"
dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-element-call.service"
mode: 0644
# Update homeserver.yaml for Element Call
- name: Add listeners section for Element Call to homeserver.yaml
ansible.builtin.blockinfile:
path: "{{ matrix_homeserver_config_path }}"
block: |
listeners:
- port: 8008
tls: false
type: http
x_forwarded: true
resources:
- names: [client, federation, openid]
compress: false
marker: "# ANSIBLE MANAGED BLOCK - Element Call listeners"
mode: '0644'
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
when: matrix_element_call_enabled | bool
- name: Ensure serve_server_wellknown is enabled in homeserver.yaml
ansible.builtin.lineinfile:
path: "{{ matrix_homeserver_config_path }}"
line: "serve_server_wellknown: true"
insertafter: EOF
state: present
mode: '0644'
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
when: matrix_element_call_enabled | bool
# Update the well-known client file for Element Call (adding RTC FOCI)
- name: Update the well-known client file for Element Call
ansible.builtin.include_tasks: "tasks/update_well_known_client.yml"
when: matrix_element_call_enabled | bool
# Create .well-known/element/element.json for Element Call
- name: Create the well-known element.json file
ansible.builtin.template:
src: "{{ role_path }}/templates/well_known_element.json.j2"
dest: "{{ matrix_base_data_path }}/static-files/public/.well-known/element/element.json"
mode: '0644'
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
# Update Element Web config.json with Element Call settings
- name: Update Element Web config.json
ansible.builtin.include_tasks: "tasks/update_element_web_config.yml"
when: matrix_element_call_enabled | bool

View File

@ -0,0 +1,21 @@
---
# Main task file for matrix-element-call
- tags:
- setup-all
- setup-element-call
- install-all
- install-element-call
block:
- when: matrix_element_call_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml"
- when: matrix_element_call_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/install.yml"
- tags:
- setup-all
- setup-element-call
block:
- when: not matrix_element_call_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/uninstall.yml"

View File

@ -0,0 +1,21 @@
---
# Uninstall tasks for matrix-element-call
- name: Stop and remove matrix-element-call container
community.docker.docker_container:
name: "matrix-element-call"
state: absent
- name: Remove matrix-element-call systemd service
ansible.builtin.file:
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-element-call.service"
state: absent
- name: Remove matrix-element-call configuration files
ansible.builtin.file:
path: "{{ matrix_element_call_base_path }}"
state: absent
- name: Reload systemd daemon
ansible.builtin.systemd:
daemon_reload: true

View File

@ -0,0 +1,40 @@
- name: Read Element Web config.json
ansible.builtin.slurp:
src: "{{ element_web_config_path }}"
register: element_web_config_content
- name: Load JSON data from config.json
ansible.builtin.set_fact:
element_web_config: "{{ element_web_config_content['content'] | b64decode | from_json }}"
- name: Update Element Call configuration in config.json
ansible.builtin.set_fact:
updated_element_call_config: >
{{
{
"element_call": {
"url": "https://{{ matrix_element_call_domain }}",
"participant_limit": 8,
"brand": "Element Call",
"use_exclusively": true
},
"features": {
"feature_video_rooms": true,
"feature_new_room_decoration_ui": true,
"feature_group_calls": true,
"feature_element_call_video_rooms": true
}
}
}}
- name: Merge updated Element Call configuration with existing config.json
ansible.builtin.set_fact:
element_web_config: "{{ element_web_config | combine(updated_element_call_config, recursive=True) }}"
- name: Write updated Element Web config.json
ansible.builtin.copy:
content: "{{ element_web_config | to_nice_json }}"
dest: "{{ element_web_config_path }}"
mode: '0644'
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"

View File

@ -0,0 +1,21 @@
---
- name: Read the existing well-known client file
ansible.builtin.slurp:
path: "{{ matrix_base_data_path }}/static-files/public/.well-known/matrix/client"
register: client_file_content
- name: Load the existing JSON content
ansible.builtin.set_fact:
client_json: "{{ client_file_content['content'] | b64decode | from_json }}"
- name: Update the existing well-known client file for Element Call (RTC FOCI)
ansible.builtin.set_fact:
updated_client_json: "{{ client_json | combine({'org.matrix.msc4143.rtc_foci': [{'type': 'livekit', 'livekit_service_url': matrix_jwt_service_url}]}, recursive=True) }}"
- name: Write the updated well-known client file
ansible.builtin.copy:
content: "{{ updated_client_json | to_nice_json }}"
dest: "{{ matrix_base_data_path }}/static-files/public/.well-known/matrix/client"
mode: '0644'
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"

View File

@ -0,0 +1,12 @@
---
# Validate configuration for matrix-element-call
- name: Fail if required matrix-element-call settings are not defined
ansible.builtin.fail:
msg: >
You need to define a required configuration setting (`{{ item.name }}`).
when: "item.when | bool and vars[item.name] == ''"
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}

View File

@ -0,0 +1,11 @@
{
"default_server_config": {
"m.homeserver": {
"base_url": "{{ matrix_homeserver_url }}",
"server_name": "{{ matrix_domain }}"
}
},
"livekit": {
"livekit_service_url": "{{ matrix_jwt_service_url }}"
}
}

View File

@ -0,0 +1,46 @@
{% if matrix_element_call_container_labels_traefik_enabled %}
traefik.enable=true
# Network configuration for Traefik
{% if matrix_element_call_container_labels_traefik_docker_network %}
traefik.docker.network={{ matrix_element_call_container_labels_traefik_docker_network }}
{% endif %}
traefik.http.services.matrix-element-call.loadbalancer.server.port=8080
{% set middlewares = [] %}
# Path prefix handling for Element Call
{% if matrix_element_call_container_labels_traefik_path_prefix != '/' %}
traefik.http.middlewares.matrix-element-call-slashless-redirect.redirectregex.regex=({{ matrix_element_call_container_labels_traefik_path_prefix | quote }})$
traefik.http.middlewares.matrix-element-call-slashless-redirect.redirectregex.replacement=${1}/
{% set middlewares = middlewares + ['matrix-element-call-slashless-redirect'] %}
traefik.http.middlewares.matrix-element-call-strip-prefix.stripprefix.prefixes={{ matrix_element_call_container_labels_traefik_path_prefix }}
{% set middlewares = middlewares + ['matrix-element-call-strip-prefix'] %}
{% endif %}
{% if matrix_element_call_container_labels_traefik_additional_response_headers.keys() | length > 0 %}
{% for name, value in matrix_element_call_container_labels_traefik_additional_response_headers.items() %}
traefik.http.middlewares.matrix-element-call-add-headers.headers.customresponseheaders.{{ name }}={{ value }}
{% endfor %}
{% set middlewares = middlewares + ['matrix-element-call-add-headers'] %}
{% endif %}
traefik.http.routers.matrix-element-call.rule={{ matrix_element_call_container_labels_traefik_rule }}
{% if matrix_element_call_container_labels_traefik_priority | int > 0 %}
traefik.http.routers.matrix-element-call.priority={{ matrix_element_call_container_labels_traefik_priority }}
{% endif %}
traefik.http.routers.matrix-element-call.service=matrix-element-call
{% if middlewares | length > 0 %}
traefik.http.routers.matrix-element-call.middlewares={{ middlewares | join(',') }}
{% endif %}
traefik.http.routers.matrix-element-call.entrypoints={{ matrix_element_call_container_labels_traefik_entrypoints }}
traefik.http.routers.matrix-element-call.tls={{ matrix_element_call_container_labels_traefik_tls | to_json }}
{% if matrix_element_call_container_labels_traefik_tls %}
traefik.http.routers.matrix-element-call.tls.certResolver={{ matrix_element_call_container_labels_traefik_tls_certResolver }}
{% endif %}
{% endif %}
{{ matrix_element_call_container_labels_additional_labels }}

View File

@ -0,0 +1,46 @@
#jinja2: lstrip_blocks: "True"
[Unit]
Description=Matrix Element Call Service
{% for service in matrix_client_element_systemd_required_services_list %}
Requires={{ service }}
After={{ service }}
{% endfor %}
DefaultDependencies=no
[Service]
Type=simple
Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}"
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-element-call 2>/dev/null || true'
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-element-call 2>/dev/null || true'
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
--rm \
--name=matrix-element-call \
--log-driver=none \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
--cap-drop=ALL \
--network={{ matrix_element_call_container_network }} \
--mount type=bind,src={{ matrix_element_call_base_path }}/config.json,dst=/app/config.json,ro \
{% if matrix_element_call_container_http_host_bind_port %}
-p {{ matrix_element_call_container_http_host_bind_port }}:8080 \
{% endif %}
--label-file={{ matrix_element_call_base_path }}/element-call-labels \
{% for arg in matrix_element_call_container_extra_arguments %}
{{ arg }} \
{% endfor %}
{{ matrix_element_call_image }}
{% for network in matrix_element_call_container_additional_networks %}
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-element-call
{% endfor %}
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-element-call
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-element-call 2>/dev/null || true'
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-element-call 2>/dev/null || true'
Restart=always
RestartSec=30
SyslogIdentifier=matrix-element-call
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,5 @@
{
"call": {
"widget_url": "https://{{ matrix_element_call_domain }}"
}
}

View File

@ -0,0 +1,5 @@
---
# roles/custom/matrix-element-call/vars/main.yml
# Variables specific to matrix-element-call, like service configurations, can go here.
# Any environment-specific values can be overridden here.

View File

@ -0,0 +1,117 @@
---
# Enable or disable matrix-element-call deployment
matrix_jwt_service_enabled: false
# Base path configuration
matrix_jwt_service_base_path: "{{ matrix_base_data_path }}/jwt-service"
# Docker network configuration
matrix_jwt_service_container_network: ''
matrix_jwt_service_container_http_host_bind_port: '8881'
matrix_jwt_service_container_additional_networks: [] # No additional networks by default
# Docker images
matrix_jwt_service_image: "ghcr.io/element-hq/lk-jwt-service:latest-ci"
# Ports
matrix_jwt_service_port: "8881"
# jwt configuration
matrix_jwt_service_hostname: "sfu-jwt.{{ matrix_domain }}"
matrix_jwt_service_url: "https://sfu-jwt.{{ matrix_domain }}"
# Traefik Configuration for JWT Service
matrix_jwt_service_container_labels_traefik_enabled: true
matrix_jwt_service_container_labels_traefik_docker_network: "{{ matrix_jwt_service_container_network }}"
matrix_jwt_service_container_labels_traefik_hostname: "{{ matrix_jwt_service_hostname }}"
# The path prefix must either be `/` or not end with a slash (e.g. `/element`).
matrix_jwt_service_container_labels_traefik_path_prefix: "{{ matrix_jwt_service_path_prefix }}"
matrix_jwt_service_container_labels_traefik_rule: "Host(`{{ matrix_jwt_service_container_labels_traefik_hostname }}`){% if matrix_jwt_service_container_labels_traefik_path_prefix != '/' %} && PathPrefix(`{{ matrix_jwt_service_container_labels_traefik_path_prefix }}`){% endif %}"
matrix_jwt_service_container_labels_traefik_priority: 0
matrix_jwt_service_container_labels_traefik_entrypoints: web-secure
matrix_jwt_service_container_labels_traefik_tls: "{{ matrix_jwt_service_container_labels_traefik_entrypoints != 'web' }}"
matrix_jwt_service_container_labels_traefik_tls_certResolver: default # noqa var-naming
# Controls which additional headers to attach to all HTTP responses.
# To add your own headers, use `matrix_jwt_service_container_labels_traefik_additional_response_headers_custom`
matrix_jwt_service_container_labels_traefik_additional_response_headers: "{{ matrix_jwt_service_container_labels_traefik_additional_response_headers_auto | combine(matrix_jwt_service_container_labels_traefik_additional_response_headers_custom) }}"
matrix_jwt_service_container_labels_traefik_additional_response_headers_auto: |
{{
{}
| combine ({'X-XSS-Protection': matrix_jwt_service_http_header_xss_protection} if matrix_jwt_service_http_header_xss_protection else {})
| combine ({'X-Frame-Options': matrix_jwt_service_http_header_frame_options} if matrix_jwt_service_http_header_frame_options else {})
| combine ({'X-Content-Type-Options': matrix_jwt_service_http_header_content_type_options} if matrix_jwt_service_http_header_content_type_options else {})
| combine ({'Content-Security-Policy': matrix_jwt_service_http_header_content_security_policy} if matrix_jwt_service_http_header_content_security_policy else {})
| combine ({'Permission-Policy': matrix_jwt_service_http_header_content_permission_policy} if matrix_jwt_service_http_header_content_permission_policy else {})
| combine ({'Strict-Transport-Security': matrix_jwt_service_http_header_strict_transport_security} if matrix_jwt_service_http_header_strict_transport_security and matrix_jwt_service_container_labels_traefik_tls else {})
}}
matrix_jwt_service_container_labels_traefik_additional_response_headers_custom: {}
# matrix_client_element_container_labels_additional_labels contains a multiline string with additional labels to add to the container label file.
# See `../templates/labels.j2` for details.
#
# Example:
# matrix_client_element_container_labels_additional_labels: |
# my.label=1
# another.label="here"
matrix_jwt_service_container_labels_additional_labels: ''
# A list of extra arguments to pass to the container
matrix_jwt_service_container_extra_arguments: []
# Additional environment variables for the container
matrix_jwt_service_environment_variables_additional: {}
# List of systemd services that matrix-element-call.service depends on
matrix_jwt_service_systemd_required_services_list: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}"
# Specifies the value of the `X-XSS-Protection` header
# Stops pages from loading when they detect reflected cross-site scripting (XSS) attacks.
#
# Learn more about it is here:
# - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection
# - https://portswigger.net/web-security/cross-site-scripting/reflected
matrix_jwt_service_http_header_xss_protection: ''
# Specifies the value of the `X-Frame-Options` header which controls whether framing can happen.
# See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
matrix_jwt_service_http_header_frame_options: ''
# Specifies the value of the `X-Content-Type-Options` header.
# See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
matrix_jwt_service_http_header_content_type_options: ''
# Specifies the value of the `Content-Security-Policy` header.
# See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
matrix_jwt_service_http_header_content_security_policy: ''
# Specifies the value of the `Permission-Policy` header.
# See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permission-Policy
matrix_jwt_service_http_header_content_permission_policy: ''
# Specifies the value of the `Strict-Transport-Security` header.
# See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
matrix_jwt_service_http_header_strict_transport_security: ''
# Controls whether to send a "Permissions-Policy interest-cohort=();" header along with all responses
#
# Learn more about what it is here:
# - https://www.eff.org/deeplinks/2021/03/googles-floc-terrible-idea
# - https://paramdeo.com/blog/opting-your-website-out-of-googles-floc-network
# - https://amifloced.org/
#
# Of course, a better solution is to just stop using browsers (like Chrome), which participate in such tracking practices.
# See: `matrix_jwt_service_content_permission_policy`
matrix_jwt_service_floc_optout_enabled: false
# Controls if HSTS preloading is enabled
#
# In its strongest and recommended form, the [HSTS policy](https://www.chromium.org/hsts) includes all subdomains, and
# indicates a willingness to be "preloaded" into browsers:
# `Strict-Transport-Security: max-age=31536000; includeSubDomains; preload`
# For more information visit:
# - https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security
# - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
# - https://hstspreload.org/#opt-in
# See: `matrix_jwt_service_http_header_strict_transport_security`
matrix_jwt_service_hsts_preload_enabled: true

View File

@ -0,0 +1,46 @@
---
# roles/custom/matrix-jwt-service/tasks/install.yml
# Ensure Required Directories Exist
- name: Ensure matrix-jwt-service paths exist
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
mode: 0750
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
with_items:
- path: "{{ matrix_jwt_service_base_path }}"
- name: Ensure matrix-jwt-service environment file is in place
ansible.builtin.template:
src: "{{ role_path }}/templates/env.j2"
dest: "{{ matrix_jwt_service_base_path }}/env"
mode: 0640
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
- name: Ensure JWT Service labels file is in place
ansible.builtin.template:
src: "{{ role_path }}/templates/labels.j2"
dest: "{{ matrix_jwt_service_base_path }}/labels"
mode: 0640
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
# Ensure Docker Images are Pulled
- name: Ensure jwt-service Docker image is pulled
community.docker.docker_image:
name: "{{ matrix_jwt_service_image }}"
source: pull
register: jwt_image_result
retries: 3
delay: 10
until: jwt_image_result is not failed
# Systemd Services for JWT Service
- name: Ensure jwt-service systemd service is installed
ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-jwt-service.service.j2"
dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jwt-service.service"
mode: 0644

View File

@ -0,0 +1,21 @@
---
# Main task file for matrix-element-call
- tags:
- setup-all
- setup-jwt-service
- install-all
- install-wt-service
block:
- when: matrix_jwt_service_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml"
- when: matrix_jwt_service_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/install.yml"
- tags:
- setup-all
- setup-jwt-service
block:
- when: not matrix_jwt_service_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/uninstall.yml"

View File

@ -0,0 +1,22 @@
---
# Uninstall tasks for matrix-jwt-service
- name: Stop and remove jwt-service container
community.docker.docker_container:
name: "matrix-jwt-service"
state: absent
- name: Remove jwt-service systemd service
ansible.builtin.file:
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-jwt-service.service"
state: absent
- name: Remove matrix-jwt-service configuration files
ansible.builtin.file:
path: "{{ matrix_jwt_service_base_path }}"
state: absent
- name: Reload systemd daemon
ansible.builtin.systemd:
daemon_reload: true

View File

@ -0,0 +1,12 @@
---
# Validate configuration for matrix-jwt-service
- name: Fail if required matrix-jwt-service settings are not defined
ansible.builtin.fail:
msg: >
You need to define a required configuration setting (`{{ item.name }}`).
when: "item.when | bool and vars[item.name] == ''"
with_items:
- {'name': 'matrix_jwt_service_base_path', when: true}
- {'name': 'matrix_jwt_service_container_network', when: true}
- {'name': 'matrix_jwt_service_image', when: true}

View File

@ -0,0 +1,4 @@
# Environment variables for JWT Service
LIVEKIT_KEY=devkey
LIVEKIT_URL=wss://{{ matrix_livekit_server_hostname }}:443
LIVEKIT_SECRET={{ matrix_livekit_server_dev_key }}

View File

@ -0,0 +1,46 @@
{% if matrix_element_call_container_labels_traefik_enabled %}
traefik.enable=true
# Network configuration for Traefik
{% if matrix_jwt_service_container_labels_traefik_docker_network %}
traefik.docker.network={{ matrix_jwt_service_container_labels_traefik_docker_network }}
{% endif %}
traefik.http.services.matrix-jwt-service.loadbalancer.server.port=8080
{% set middlewares = [] %}
# Path prefix handling for JWT
{% if matrix_jwt_service_container_labels_traefik_path_prefix != '/' %}
traefik.http.middlewares.matrix-jwt-service-slashless-redirect.redirectregex.regex=({{ matrix_jwt_service_container_labels_traefik_path_prefix | quote }})$
traefik.http.middlewares.matrix-jwt-service-slashless-redirect.redirectregex.replacement=${1}/
{% set middlewares = middlewares + ['matrix-jwt-service-slashless-redirect'] %}
traefik.http.middlewares.matrix-jwt-service-strip-prefix.stripprefix.prefixes={{ matrix_jwt_service_container_labels_traefik_path_prefix }}
{% set middlewares = middlewares + ['matrix-jwt-service-strip-prefix'] %}
{% endif %}
{% if matrix_jwt_service_container_labels_traefik_additional_response_headers.keys() | length > 0 %}
{% for name, value in matrix_jwt_service_container_labels_traefik_additional_response_headers.items() %}
traefik.http.middlewares.matrix-jwt-service-add-headers.headers.customresponseheaders.{{ name }}={{ value }}
{% endfor %}
{% set middlewares = middlewares + ['matrix-jwt-service-add-headers'] %}
{% endif %}
traefik.http.routers.matrix-jwt-service.rule={{ matrix_jwt_service_container_labels_traefik_rule }}
{% if matrix_jwt_service_container_labels_traefik_priority | int > 0 %}
traefik.http.routers.matrix-jwt-service.priority={{ matrix_jwt_service_container_labels_traefik_priority }}
{% endif %}
traefik.http.routers.matrix-jwt-service.service=matrix-jwt-service
{% if middlewares | length > 0 %}
traefik.http.routers.matrix-jwt-service.middlewares={{ middlewares | join(',') }}
{% endif %}
traefik.http.routers.matrix-jwt-service.entrypoints={{ matrix_jwt_service_container_labels_traefik_entrypoints }}
traefik.http.routers.matrix-jwt-service.tls={{ matrix_jwt_service_container_labels_traefik_tls | to_json }}
{% if matrix_jwt_service_container_labels_traefik_tls %}
traefik.http.routers.matrix-jwt-service.tls.certResolver={{ matrix_jwt_service_container_labels_traefik_tls_certResolver }}
{% endif %}
{% endif %}
{{ matrix_jwt_service_container_labels_additional_labels }}

View File

@ -0,0 +1,40 @@
#jinja2: lstrip_blocks: "True"
[Unit]
Description=Matrix JWT Service
After=docker.service
Requires=docker.service
[Service]
Type=simple
Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}"
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-jwt-service 2>/dev/null || true'
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-jwt-service 2>/dev/null || true'
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
--rm \
--name=matrix-jwt-service \
--log-driver=none \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
--cap-drop=ALL \
--network={{ matrix_jwt_service_container_network }} \
{% if matrix_jwt_service_container_http_host_bind_port %}
-p {{ matrix_jwt_service_container_http_host_bind_port }}:8080 \
{% endif %}
--env-file={{ matrix_jwt_service_base_path }}/env \
--label-file={{ matrix_jwt_service_base_path }}/labels \
{{ matrix_jwt_service_image }}
{% for network in matrix_jwt_service_container_additional_networks %}
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-jwt-service
{% endfor %}
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-jwt-service
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-jwt-service 2>/dev/null || true'
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-jwt-service 2>/dev/null || true'
Restart=always
RestartSec=30
SyslogIdentifier=matrix-jwt-service
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,115 @@
---
# Enable or disable matrix-livekit-server deployment
matrix_livekit_server_enabled: false
# Base path configuration
matrix_livekit_server_base_path: "{{ matrix_base_data_path }}/livekit-server"
# Docker network configuration
matrix_livekit_server_container_network: ''
matrix_livekit_server_container_http_host_bind_port: ''
matrix_livekit_server_container_additional_networks: [] # No additional networks by default
# Docker images
matrix_livekit_server_image: "livekit/livekit-server:latest"
# LiveKit configuration
matrix_livekit_server_livekit_server_dev_key: "{{ matrix_livekit_server_dev_key }}" # Must be defined in host_vars
matrix_livekit_server_jwt_secret: "{{ matrix_element_call_jwt_secret }}" # Must be defined in host_vars
matrix_livekit_server_hostname: "sfu.{{ matrix_domain }}"
# Traefik Configuration for Element Call
matrix_livekit_server_container_labels_traefik_enabled: true
matrix_livekit_server_container_labels_traefik_docker_network: "{{ matrix_livekit_server_container_network }}"
matrix_livekit_server_container_labels_traefik_hostname: "{{ matrix_livekit_server_hostname }}"
# The path prefix must either be `/` or not end with a slash (e.g. `/element`).
matrix_livekit_server_container_labels_traefik_path_prefix: "{{ matrix_livekit_server_path_prefix }}"
matrix_livekit_server_container_labels_traefik_rule: "Host(`{{ matrix_livekit_server_container_labels_traefik_hostname }}`){% if matrix_livekit_server_container_labels_traefik_path_prefix != '/' %} && PathPrefix(`{{ matrix_livekit_server_container_labels_traefik_path_prefix }}`){% endif %}"
matrix_livekit_server_container_labels_traefik_priority: 0
matrix_livekit_server_container_labels_traefik_entrypoints: web-secure
matrix_livekit_server_container_labels_traefik_tls: "{{ matrix_livekit_server_container_labels_traefik_entrypoints != 'web' }}"
matrix_livekit_server_container_labels_traefik_tls_certResolver: default # noqa var-naming
# Controls which additional headers to attach to all HTTP responses.
# To add your own headers, use `matrix_livekit_server_container_labels_traefik_additional_response_headers_custom`
matrix_livekit_server_container_labels_traefik_additional_response_headers: "{{ matrix_livekit_server_container_labels_traefik_additional_response_headers_auto | combine(matrix_livekit_server_container_labels_traefik_additional_response_headers_custom) }}"
matrix_livekit_server_container_labels_traefik_additional_response_headers_auto: |
{{
{}
| combine ({'X-XSS-Protection': matrix_livekit_server_http_header_xss_protection} if matrix_livekit_server_http_header_xss_protection else {})
| combine ({'X-Frame-Options': matrix_livekit_server_http_header_frame_options} if matrix_livekit_server_http_header_frame_options else {})
| combine ({'X-Content-Type-Options': matrix_livekit_server_http_header_content_type_options} if matrix_livekit_server_http_header_content_type_options else {})
| combine ({'Content-Security-Policy': matrix_livekit_server_http_header_content_security_policy} if matrix_livekit_server_http_header_content_security_policy else {})
| combine ({'Permission-Policy': matrix_livekit_server_http_header_content_permission_policy} if matrix_livekit_server_http_header_content_permission_policy else {})
| combine ({'Strict-Transport-Security': matrix_livekit_server_http_header_strict_transport_security} if matrix_livekit_server_http_header_strict_transport_security and matrix_livekit_server_container_labels_traefik_tls else {})
}}
matrix_livekit_server_container_labels_traefik_additional_response_headers_custom: {}
# matrix_client_element_container_labels_additional_labels contains a multiline string with additional labels to add to the container label file.
# See `../templates/labels.j2` for details.
#
# Example:
# matrix_client_element_container_labels_additional_labels: |
# my.label=1
# another.label="here"
matrix_livekit_server_container_labels_additional_labels: ''
# A list of extra arguments to pass to the container
matrix_livekit_server_container_extra_arguments: []
# Additional environment variables for the container
matrix_livekit_server_environment_variables_additional: {}
# List of systemd services that matrix-element-call.service depends on
matrix_livekit_server_systemd_required_services_list: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}"
# Specifies the value of the `X-XSS-Protection` header
# Stops pages from loading when they detect reflected cross-site scripting (XSS) attacks.
#
# Learn more about it is here:
# - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection
# - https://portswigger.net/web-security/cross-site-scripting/reflected
matrix_livekit_server_http_header_xss_protection: ''
# Specifies the value of the `X-Frame-Options` header which controls whether framing can happen.
# See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
matrix_livekit_server_http_header_frame_options: ''
# Specifies the value of the `X-Content-Type-Options` header.
# See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
matrix_livekit_server_http_header_content_type_options: ''
# Specifies the value of the `Content-Security-Policy` header.
# See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
matrix_livekit_server_http_header_content_security_policy: ''
# Specifies the value of the `Permission-Policy` header.
# See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permission-Policy
matrix_livekit_server_http_header_content_permission_policy: ''
# Specifies the value of the `Strict-Transport-Security` header.
# See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
matrix_livekit_server_http_header_strict_transport_security: ''
# Controls whether to send a "Permissions-Policy interest-cohort=();" header along with all responses
#
# Learn more about what it is here:
# - https://www.eff.org/deeplinks/2021/03/googles-floc-terrible-idea
# - https://paramdeo.com/blog/opting-your-website-out-of-googles-floc-network
# - https://amifloced.org/
#
# Of course, a better solution is to just stop using browsers (like Chrome), which participate in such tracking practices.
# See: `matrix_livekit_server_content_permission_policy`
matrix_livekit_server_floc_optout_enabled: false
# Controls if HSTS preloading is enabled
#
# In its strongest and recommended form, the [HSTS policy](https://www.chromium.org/hsts) includes all subdomains, and
# indicates a willingness to be "preloaded" into browsers:
# `Strict-Transport-Security: max-age=31536000; includeSubDomains; preload`
# For more information visit:
# - https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security
# - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
# - https://hstspreload.org/#opt-in
# See: `matrix_livekit_server_http_header_strict_transport_security`
matrix_livekit_server_hsts_preload_enabled: true

View File

@ -0,0 +1,47 @@
---
# roles/custom/matrix-livekit-server/tasks/install.yml
# Ensure Required Directories Exist
- name: Ensure matrix-livekit-server paths exist
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
mode: 0750
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
with_items:
- path: "{{ matrix_livekit_server_base_path }}"
# Ensure Configuration Files are in Place
- name: Ensure LiveKit livekit.yaml is in place
ansible.builtin.template:
src: "{{ role_path }}/templates/livekit.yaml.j2"
dest: "{{ matrix_livekit_server_base_path }}/livekit.yaml"
mode: 0640
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
- name: Ensure LiveKit labels file is in place
ansible.builtin.template:
src: "{{ role_path }}/templates/labels.j2"
dest: "{{ matrix_livekit_server_base_path }}/labels"
mode: 0640
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
# Ensure Docker Images are Pulled
- name: Ensure livekit Docker image is pulled
community.docker.docker_image:
name: "{{ matrix_livekit_server_image }}"
source: pull
register: livekit_image_result
retries: 3
delay: 10
until: livekit_image_result is not failed
# Systemd Services for LiveKit
- name: Ensure livekit systemd service is installed
ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-livekit-server.service.j2"
dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-livekit-server.service"
mode: 0644

View File

@ -0,0 +1,21 @@
---
# Main task file for matrix-livekit-server
- tags:
- setup-all
- setup-livekit-server
- install-all
- install-livekit-server
block:
- when: matrix_livekit_server_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml"
- when: matrix_livekit_server_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/install.yml"
- tags:
- setup-all
- setup-livekit-server
block:
- when: not matrix_livekit_server_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/uninstall.yml"

View File

@ -0,0 +1,21 @@
---
# Uninstall tasks for matrix-livekit-server
- name: Stop and remove livekit container
community.docker.docker_container:
name: "matrix-livekit-server"
state: absent
- name: Remove livekit systemd service
ansible.builtin.file:
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-livekit-server.service"
state: absent
- name: Remove matrix-livekit-server configuration files
ansible.builtin.file:
path: "{{ matrix_livekit_serverbase_path }}"
state: absent
- name: Reload systemd daemon
ansible.builtin.systemd:
daemon_reload: true

View File

@ -0,0 +1,13 @@
---
# Validate configuration for matrix-livekit-server
- name: Fail if required matrix-livekit-server settings are not defined
ansible.builtin.fail:
msg: >
You need to define a required configuration setting (`{{ item.name }}`).
when: "item.when | bool and vars[item.name] == ''"
with_items:
- {'name': 'matrix_livekit_server_base_path', when: true}
- {'name': 'matrix_livekit_server_container_network', when: true}
- {'name': 'matrix_livekit_server_image', when: true}
- {'name': 'matrix_livekit_server_image', when: true}

View File

@ -0,0 +1,46 @@
{% if matrix_livekit_server_container_labels_traefik_enabled %}
traefik.enable=true
# Network configuration for Traefik
{% if matrix_livekit_server_container_labels_traefik_docker_network %}
traefik.docker.network={{ matrix_livekit_server_container_labels_traefik_docker_network }}
{% endif %}
traefik.http.services.matrix-livekit-server.loadbalancer.server.port=7880
{% set middlewares = [] %}
# Path prefix handling for Livekit
{% if matrix_livekit_server_container_labels_traefik_path_prefix != '/' %}
traefik.http.middlewares.matrix-livekit-server-slashless-redirect.redirectregex.regex=({{ matrix_livekit_server_container_labels_traefik_path_prefix | quote }})$
traefik.http.middlewares.matrix-livekit-server-slashless-redirect.redirectregex.replacement=${1}/
{% set middlewares = middlewares + ['matrix-livekit-server-slashless-redirect'] %}
traefik.http.middlewares.matrix-livekit-server-strip-prefix.stripprefix.prefixes={{ matrix_livekit_server_container_labels_traefik_path_prefix }}
{% set middlewares = middlewares + ['matrix-livekit-server-strip-prefix'] %}
{% endif %}
{% if matrix_livekit_server_container_labels_traefik_additional_response_headers.keys() | length > 0 %}
{% for name, value in matrix_livekit_server_container_labels_traefik_additional_response_headers.items() %}
traefik.http.middlewares.matrix-livekit-server-add-headers.headers.customresponseheaders.{{ name }}={{ value }}
{% endfor %}
{% set middlewares = middlewares + ['matrix-livekit-server-add-headers'] %}
{% endif %}
traefik.http.routers.matrix-livekit-server.rule={{ matrix_livekit_server_container_labels_traefik_rule }}
{% if matrix_livekit_server_container_labels_traefik_priority | int > 0 %}
traefik.http.routers.matrix-livekit-server.priority={{ matrix_livekit_server_container_labels_traefik_priority }}
{% endif %}
traefik.http.routers.matrix-livekit-server.service=matrix-livekit-server
{% if middlewares | length > 0 %}
traefik.http.routers.matrix-livekit-server.middlewares={{ middlewares | join(',') }}
{% endif %}
traefik.http.routers.matrix-livekit-server.entrypoints={{ matrix_livekit_server_container_labels_traefik_entrypoints }}
traefik.http.routers.matrix-livekit-server.tls={{ matrix_livekit_server_container_labels_traefik_tls | to_json }}
{% if matrix_livekit_server_container_labels_traefik_tls %}
traefik.http.routers.matrix-livekit-server.tls.certResolver={{ matrix_livekit_server_container_labels_traefik_tls_certResolver }}
{% endif %}
{% endif %}
{{ matrix_livekit_server_container_labels_additional_labels }}

View File

@ -0,0 +1,20 @@
port: 7880
bind_addresses:
- "0.0.0.0"
rtc:
tcp_port: 7881
port_range_start: 50100
port_range_end: 50200
use_external_ip: true
turn:
enabled: false
domain: localhost
cert_file: ""
key_file: ""
tls_port: 5349
udp_port: 443
external_tls: true
keys:
devkey: "{{ matrix_livekit_server_livekit_dev_key }}"

View File

@ -0,0 +1,34 @@
#jinja2: lstrip_blocks: "True"
[Unit]
Description=Matrix LiveKit Server
After=docker.service
Requires=docker.service
[Service]
Type=simple
Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}"
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-livekit-server 2>/dev/null || true'
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-livekit-server 2>/dev/null || true'
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
--rm \
--name=matrix-livekit-server \
--log-driver=none \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
--cap-drop=ALL \
--network=host \
--mount type=bind,src={{ matrix_livekit_server_base_path }}/livekit.yaml,dst=/etc/livekit.yaml,ro \
--label-file={{ matrix_livekit_server_base_path }}/labels \
{{ matrix_livekit_server_image }} \
--dev --config /etc/livekit.yaml
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-livekit-server
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-livekit-server 2>/dev/null || true'
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-livekit-server 2>/dev/null || true'
Restart=always
RestartSec=30
SyslogIdentifier=matrix-livekit-server
[Install]
WantedBy=multi-user.target

View File

@ -131,6 +131,9 @@
- custom/matrix-coturn
- custom/matrix-media-repo
- custom/matrix-pantalaimon
- custom/matrix-element-call
- custom/matrix-livekit-server
- custom/matrix-jwt-service
- role: galaxy/postgres_backup