3
0
mirror of https://github.com/spantaleev/matrix-docker-ansible-deploy.git synced 2026-04-25 09:57:35 +00:00
Files
matrix-docker-ansible-deploy/roles/custom/matrix-bridge-meshtastic-relay/templates/systemd/matrix-meshtastic-relay.service.j2
Slavi Pantaleev 8e2545a100 Upgrade meshtastic-relay (v1.2.8 -> v1.3.5) and adapt for MMRELAY_HOME
v1.3.0 moved the container's runtime paths to a unified MMRELAY_HOME=/data
model (credentials, database, logs, E2EE store, plugins all live under /data).
Legacy /app paths still work until v1.4.

Adapted the role to the new model: drop the three `/app/*` bind mounts and
the `_logs_path` variable, mount `_config_path` read-only at `/config` and
`_data_path` read-write at `/data`, and invoke the container as
`mmrelay --config /config/config.yaml` so the Ansible-managed config stays
separate from runtime data. Also drop the hardcoded `/app/data/...` database
and e2ee store_path overrides from the default config; MMRELAY_HOME defaults
place them under `_data_path/database/` and `_data_path/matrix/store/` on the
host.
2026-04-24 10:54:18 +03:00

60 lines
2.4 KiB
Django/Jinja

#jinja2: lstrip_blocks: True
[Unit]
Description=Matrix <-> Meshtastic bridge
{% for service in matrix_meshtastic_relay_systemd_required_services_list %}
Requires={{ service }}
After={{ service }}
{% endfor %}
{% for service in matrix_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_meshtastic_relay_config_path }},dst=/config,ro \
--mount type=bind,src={{ matrix_meshtastic_relay_data_path }},dst=/data \
{% if matrix_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_meshtastic_relay_container_network }} \
{% endif %}
{% if matrix_meshtastic_relay_connection_type == 'serial' %}
--device={{ matrix_meshtastic_relay_serial_port }} \
{% endif %}
{% for arg in matrix_meshtastic_relay_container_extra_arguments %}
{{ arg }} \
{% endfor %}
{{ matrix_meshtastic_relay_container_image }} \
mmrelay --config /config/config.yaml
{% for network in matrix_meshtastic_relay_container_additional_networks %}
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-meshtastic-relay
{% endfor %}
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