From 597f6c2cdaf5dd187c83ba4724a8b1339910cff1 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Tue, 28 Jun 2022 22:52:45 +0200 Subject: [PATCH] cleanup systemd files --- .../systemd/user/freshrss-container.service.j2 | 18 ++++++++++-------- templates/systemd/user/freshrss-pod.service.j2 | 10 +++++----- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/templates/systemd/user/freshrss-container.service.j2 b/templates/systemd/user/freshrss-container.service.j2 index 0180314..9afd239 100644 --- a/templates/systemd/user/freshrss-container.service.j2 +++ b/templates/systemd/user/freshrss-container.service.j2 @@ -5,6 +5,8 @@ Description=FreshRSS App Server Wants=network.target network-online.target After=network-online.target + +RequiresMountsFor=%t/containers Requires=dbus.socket BindsTo={{ __freshrss_pod_name }}.service @@ -13,20 +15,22 @@ After={{ __freshrss_pod_name }}.service [Service] Type=notify NotifyAccess=all -KillMode=control-group Environment=PODMAN_SYSTEMD_UNIT=%N SyslogIdentifier=%N LogExtraFields=CONTAINER_NAME=%N Delegate=memory pids -Restart=always -RestartSec=15s +Restart=on-failure +TimeoutSec=70 -ExecStartPre=/usr/bin/podman rm --force --ignore {{ __freshrss_container_name }} ExecStartPre=/usr/bin/podman pod exists {{ __freshrss_pod_name }} -ExecStartPre=/usr/bin/podman create \ +ExecStart=/usr/bin/podman run \ --rm \ + --replace \ + --detach \ --restart=no \ + --cgroups=no-conmon \ + --sdnotify=conmon \ --env-file={{ __freshrss_systemd_env_dir }}/freshrss.env \ --pod {{ __freshrss_pod_name }} \ {% if freshrss_memory_limit is defined %} @@ -38,7 +42,6 @@ ExecStartPre=/usr/bin/podman create \ {% if freshrss_cpu_quota is defined %} --cpu-quota={{ freshrss_cpu_quota }} \ {% endif %} - --sdnotify=conmon \ {% for item in freshrss_security_opt %} --security-opt={{ item }} \ {% endfor %} @@ -55,8 +58,7 @@ ExecStartPre=/usr/bin/podman create \ --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 }} +ExecStop=/usr/bin/podman stop --ignore {{ __freshrss_container_name }} ExecStopPost=/usr/bin/podman rm --force --ignore {{ __freshrss_container_name }} [Install] diff --git a/templates/systemd/user/freshrss-pod.service.j2 b/templates/systemd/user/freshrss-pod.service.j2 index 516c252..b2ccb61 100644 --- a/templates/systemd/user/freshrss-pod.service.j2 +++ b/templates/systemd/user/freshrss-pod.service.j2 @@ -6,22 +6,22 @@ Description=FreshRSS Pod Wants=network.target network-online.target After=network-online.target -Requires= dbus.socket {{ __freshrss_container_name }}.service +RequiresMountsFor= +Requires=dbus.socket {{ __freshrss_container_name }}.service Before={{ __freshrss_container_name }}.service [Service] Type=forking -KillMode=control-group Environment=PODMAN_SYSTEMD_UNIT=%N SyslogIdentifier=%N LogExtraFields=CONTAINER_NAME=%N Delegate=memory pids -Restart=always -RestartSec=15s +Restart=on-failure +TimeoutSec=70 -ExecStartPre=/usr/bin/podman pod rm --force --ignore {{ __freshrss_pod_name }} ExecStartPre=/usr/bin/podman pod create \ + --replace \ {% for port in freshrss_exposed_ports %} --publish {{ port }} \ {% endfor %}