mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2025-06-25 18:57:50 +02:00
separated livekit and jwt to separate roles
This commit is contained in:
4
roles/custom/matrix-jwt-service/templates/env.j2
Normal file
4
roles/custom/matrix-jwt-service/templates/env.j2
Normal file
@ -0,0 +1,4 @@
|
||||
# Environment variables for JWT Service
|
||||
LIVEKIT_KEY=devkey
|
||||
LIVEKIT_URL=wss://{{ matrix_livekit_server_hostname }}:443
|
||||
LIVEKIT_SECRET={{ matrix_element_call_jwt_secret }}
|
46
roles/custom/matrix-jwt-service/templates/labels.j2
Normal file
46
roles/custom/matrix-jwt-service/templates/labels.j2
Normal 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 }}
|
@ -0,0 +1,37 @@
|
||||
[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 }} \
|
||||
-p {{ matrix_jwt_service_port }}:8080 \
|
||||
--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
|
Reference in New Issue
Block a user