Update matrix-element-call.service.j2

This commit is contained in:
Backslash 2024-09-27 08:34:01 +10:00 committed by GitHub
parent df4bf4a0c9
commit dd96b93d89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,37 +1,31 @@
[Unit]
Description=Matrix Element Call Service
After=docker.service
Requires=docker.service
{% if matrix_element_call_container_labels_traefik_enabled %}
traefik.enable=true
[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'
{% if matrix_element_call_container_labels_traefik_docker_network %}
traefik.docker.network={{ matrix_element_call_container_labels_traefik_docker_network }}
{% endif %}
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 }} \
-p {{ matrix_element_call_port }}:8080 \
--env-file={{ matrix_element_call_base_path }}/config/env \
--label-file={{ matrix_element_call_base_path }}/config/element-call-labels \
{{ matrix_element_call_image }}
# Define the Traefik router rule
traefik.http.routers.element-call-router.rule={{ matrix_element_call_container_labels_traefik_rule }}
traefik.http.routers.element-call-router.entrypoints={{ matrix_element_call_container_labels_traefik_entrypoints }}
traefik.http.routers.element-call-router.tls.certresolver={{ matrix_element_call_container_labels_traefik_tls_certResolver }}
traefik.http.services.element-call-service.loadbalancer.server.port=8080
{% for network in matrix_element_call_container_additional_networks %}
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-element-call
{% endfor %}
{% set middlewares = [] %}
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-element-call
# Define any path prefix redirection or stripping middleware
{% if matrix_element_call_container_labels_traefik_path_prefix != '/' %}
traefik.http.middlewares.element-call-slashless-redirect.redirectregex.regex=({{ matrix_element_call_container_labels_traefik_path_prefix | quote }})$
traefik.http.middlewares.element-call-slashless-redirect.redirectregex.replacement=${1}/
{% set middlewares = middlewares + ['element-call-slashless-redirect'] %}
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
traefik.http.middlewares.element-call-strip-prefix.stripprefix.prefixes={{ matrix_element_call_container_labels_traefik_path_prefix }}
{% set middlewares = middlewares + ['element-call-strip-prefix'] %}
{% endif %}
[Install]
WantedBy=multi-user.target
# Add middlewares to the router
{% if middlewares | length > 0 %}
traefik.http.routers.element-call-router.middlewares={{ middlewares | join(',') }}
{% endif %}
{% endif %}