45 lines
2.6 KiB
Plaintext
Raw Normal View History

2024-09-30 23:04:10 +10:00
#jinja2: lstrip_blocks: "True"
2024-09-26 13:40:38 +10:00
[Unit]
2024-11-21 17:28:06 +02:00
Description=LiveKit Server
2024-09-26 13:40:38 +10:00
After=docker.service
Requires=docker.service
[Service]
Type=simple
Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}"
2024-11-21 17:28:06 +02:00
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 }} {{ livekit_server_identifier }} 2>/dev/null || true'
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm {{ livekit_server_identifier }} 2>/dev/null || true'
2024-09-26 13:40:38 +10:00
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
2024-11-21 17:28:06 +02:00
--rm \
--name={{ livekit_server_identifier }} \
--log-driver=none \
--user={{ livekit_server_uid }}:{{ livekit_server_gid }} \
--cap-drop=ALL \
--network={{ livekit_server_container_network }} \
2024-11-21 18:00:43 +02:00
{% if livekit_server_container_rtc_tcp_host_bind_port != '' %}
-p {{ livekit_server_container_rtc_tcp_host_bind_port }}:{{ livekit_server_config_rtc_tcp_port }} \
{% endif %}
{% if livekit_server_container_rtc_range_listen_interface is not in [none, 'none'] %}
-p {{ livekit_server_container_rtc_range_listen_interface }}{{ ':' if livekit_server_container_rtc_range_listen_interface else '' }}{{ livekit_server_config_rtc_port_range_start }}-{{ livekit_server_config_rtc_port_range_end }}:{{ livekit_server_config_rtc_port_range_start }}-{{ livekit_server_config_rtc_port_range_end }}/udp \
{% endif %}
2024-11-21 17:28:06 +02:00
--mount type=bind,src={{ livekit_server_config_path }}/config.yaml,dst=/livekit-config.yaml,ro \
--label-file={{ livekit_server_base_path }}/labels \
2024-11-21 17:28:06 +02:00
{{ livekit_server_container_image }} \
--dev --config /livekit-config.yaml
2024-09-26 13:40:38 +10:00
2024-11-21 17:28:06 +02:00
{% for network in livekit_server_container_additional_networks %}
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} {{ livekit_server_identifier }}
{% endfor %}
2024-09-26 13:40:38 +10:00
2024-11-21 17:28:06 +02:00
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach {{ livekit_server_identifier }}
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 }} {{ livekit_server_identifier }} 2>/dev/null || true'
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm {{ livekit_server_identifier }} 2>/dev/null || true'
2024-09-26 13:40:38 +10:00
Restart=always
RestartSec=30
2024-11-21 17:28:06 +02:00
SyslogIdentifier={{ livekit_server_identifier }}
2024-09-26 13:40:38 +10:00
[Install]
WantedBy=multi-user.target