xoxys.freshrss/templates/systemd/user/freshrss-container.service.j2
Robert Kaussow ea719292e5
All checks were successful
continuous-integration/drone/push Build is passing
initial commit
2022-03-20 16:12:57 +01:00

65 lines
1.9 KiB
Django/Jinja

#jinja2:lstrip_blocks: True
{{ ansible_managed | comment }}
[Unit]
Description=FreshRSS App Server
Wants=network.target network-online.target
After=network-online.target
Requires=dbus.socket
BindsTo={{ __freshrss_pod_name }}.service
After={{ __freshrss_pod_name }}.service
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%N
SyslogIdentifier=%N
LogExtraFields=CONTAINER_NAME=%N
Delegate=memory pids
Restart=always
RestartSec=15s
ExecStartPre=/usr/bin/podman rm --force --ignore {{ __freshrss_container_name }}
ExecStartPre=/usr/bin/podman pod exists {{ __freshrss_pod_name }}
ExecStartPre=/usr/bin/podman create \
--rm \
--restart=no \
--env-file={{ __freshrss_systemd_env_dir }}/freshrss.env \
--pod {{ __freshrss_pod_name }} \
{% if freshrss_memory_limit is defined %}
--memory={{ freshrss_memory_limit }} \
{% endif %}
{% if freshrss_memory_reservation is defined %}
-memory-reservation={{ freshrss_memory_reservation }} \
{% endif %}
{% if freshrss_cpu_quota is defined %}
--cpu-quota={{ freshrss_cpu_quota }} \
{% endif %}
--sdnotify=conmon \
{% for item in freshrss_security_opt %}
--security-opt={{ item }} \
{% endfor %}
{% for item in freshrss_cap_add %}
--cap-add={{ item }} \
{% endfor %}
{% for item in freshrss_cap_drop %}
--cap-drop={{ item }} \
{% endfor %}
--pids-limit={{ freshrss_pids_limit }} \
{% for volume in freshrss_volumes %}
--mount 'type={{ volume.type | default("volume") | lower }},src={{ volume.name }},target={{ volume.dest }}' \
{% endfor %}
--name={{ __freshrss_container_name }} \
{{ freshrss_image }}
ExecStart=/usr/bin/podman start {{ __freshrss_container_name }}
ExecStop=/usr/bin/podman stop --ignore -t 10 {{ __freshrss_container_name }}
ExecStopPost=/usr/bin/podman rm --force --ignore {{ __freshrss_container_name }}
Type=notify
NotifyAccess=all
KillMode=control-group
[Install]
WantedBy=multi-user.target default.target