5
0
mirror of https://github.com/spantaleev/matrix-docker-ansible-deploy.git synced 2026-07-17 15:26:41 +00:00
Files
matrix-docker-ansible-deploy/roles/custom/matrix-bridge-meshtastic-relay/templates/systemd/matrix-meshtastic-relay.service.j2
T
Slavi Pantaleev 97077e2f13 Rename matrix_meshtastic_relay_* variables to matrix_bridge_meshtastic_relay_*
Part of adopting a uniform naming policy for bridge variables,
where the variable prefix matches the role directory name.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 16:12:14 +03:00

62 lines
2.6 KiB
Django/Jinja

#jinja2: lstrip_blocks: True
[Unit]
Description=Matrix <-> Meshtastic bridge
{% for service in matrix_bridge_meshtastic_relay_systemd_required_services_list %}
Requires={{ service }}
After={{ service }}
{% endfor %}
{% for service in matrix_bridge_meshtastic_relay_systemd_wanted_services_list %}
Wants={{ service }}
{% endfor %}
DefaultDependencies=no
[Service]
Type=simple
Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}"
ExecStartPre=-{{ devture_systemd_docker_base_host_command_docker }} stop -t {{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-meshtastic-relay
ExecStartPre=-{{ devture_systemd_docker_base_host_command_docker }} rm matrix-meshtastic-relay
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
--rm \
--name=matrix-meshtastic-relay \
--log-driver=none \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
--cap-drop=ALL \
--read-only \
--tmpfs=/tmp:rw,noexec,nosuid,size=50m \
--tmpfs=/.cache:rw,noexec,nosuid,size=50m \
--mount type=bind,src={{ matrix_bridge_meshtastic_relay_config_path }},dst=/config,ro \
--mount type=bind,src={{ matrix_bridge_meshtastic_relay_data_path }},dst=/data \
{% if matrix_bridge_meshtastic_relay_connection_type == 'ble' %}
--network=host \
--security-opt apparmor=unconfined \
--mount type=bind,src=/var/run/dbus,dst=/var/run/dbus,ro \
{% else %}
--network={{ matrix_bridge_meshtastic_relay_container_network }} \
{% endif %}
{% if matrix_bridge_meshtastic_relay_connection_type == 'serial' %}
--device={{ matrix_bridge_meshtastic_relay_serial_port }} \
{% endif %}
{% for arg in matrix_bridge_meshtastic_relay_container_extra_arguments %}
{{ arg }} \
{% endfor %}
{{ matrix_bridge_meshtastic_relay_container_image }} \
mmrelay --config /config/config.yaml
{% if matrix_bridge_meshtastic_relay_container_network != 'host' %}
{% for network in matrix_bridge_meshtastic_relay_container_additional_networks %}
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-meshtastic-relay
{% endfor %}
{% endif %}
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-meshtastic-relay
ExecStop=-{{ devture_systemd_docker_base_host_command_docker }} stop -t {{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-meshtastic-relay
ExecStop=-{{ devture_systemd_docker_base_host_command_docker }} rm matrix-meshtastic-relay
Restart=always
RestartSec=30
SyslogIdentifier=matrix-meshtastic-relay
[Install]
WantedBy=multi-user.target