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] {% if matrix_element_call_container_labels_traefik_enabled %}
Description=Matrix Element Call Service traefik.enable=true
After=docker.service
Requires=docker.service
[Service] {% if matrix_element_call_container_labels_traefik_docker_network %}
Type=simple traefik.docker.network={{ matrix_element_call_container_labels_traefik_docker_network }}
Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}" {% endif %}
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 \ # Define the Traefik router rule
--rm \ traefik.http.routers.element-call-router.rule={{ matrix_element_call_container_labels_traefik_rule }}
--name=matrix-element-call \ traefik.http.routers.element-call-router.entrypoints={{ matrix_element_call_container_labels_traefik_entrypoints }}
--log-driver=none \ traefik.http.routers.element-call-router.tls.certresolver={{ matrix_element_call_container_labels_traefik_tls_certResolver }}
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ traefik.http.services.element-call-service.loadbalancer.server.port=8080
--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 }}
{% for network in matrix_element_call_container_additional_networks %} {% set middlewares = [] %}
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 # 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' traefik.http.middlewares.element-call-strip-prefix.stripprefix.prefixes={{ matrix_element_call_container_labels_traefik_path_prefix }}
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-element-call 2>/dev/null || true' {% set middlewares = middlewares + ['element-call-strip-prefix'] %}
Restart=always {% endif %}
RestartSec=30
SyslogIdentifier=matrix-element-call
[Install] # Add middlewares to the router
WantedBy=multi-user.target {% if middlewares | length > 0 %}
traefik.http.routers.element-call-router.middlewares={{ middlewares | join(',') }}
{% endif %}
{% endif %}