From bc782e68fffeacc885057b58ab26030d8caecd31 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 28 Mar 2021 18:18:58 +0200 Subject: [PATCH] Add systemd service file to linux packages --- build/after-install.sh | 2 ++ nfpm.yaml | 4 ++++ vikunja.service | 24 ++++++++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 vikunja.service diff --git a/build/after-install.sh b/build/after-install.sh index 0299b08c5a..4dc24b15ca 100644 --- a/build/after-install.sh +++ b/build/after-install.sh @@ -1,5 +1,7 @@ #!/bin/bash +systemctl enable vikunja.service + # Fix the config to contain proper values NEW_SECRET=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) sed -i "s//$NEW_SECRET/g" /etc/vikunja/config.yml diff --git a/nfpm.yaml b/nfpm.yaml index ad2248a7d2..ab279fdcd9 100644 --- a/nfpm.yaml +++ b/nfpm.yaml @@ -8,6 +8,8 @@ homepage: "https://vikunja.io" section: "default" priority: "extra" license: "AGPLv3" +depends: + - systemd contents: - src: dst: /opt/vikunja/vikunja @@ -17,5 +19,7 @@ contents: - src: /opt/vikunja/vikunja dst: /usr/local/bin/vikunja type: "symlink" + - src: vikunja.service + dst: /usr/lib/systemd/system/vikunja.service scripts: postinstall: ./build/after-install.sh diff --git a/vikunja.service b/vikunja.service new file mode 100644 index 0000000000..c9f083095c --- /dev/null +++ b/vikunja.service @@ -0,0 +1,24 @@ +[Unit] +Description=Vikunja +After=syslog.target +After=network.target +# Depending on how you configured Vikunja, you may want to uncomment these: +#Requires=mysql.service +#Requires=mariadb.service +#Requires=postgresql.service +#Requires=redis.service + +[Service] +RestartSec=2s +Type=simple +WorkingDirectory=/opt/vikunja +ExecStart=/usr/local/bin/vikunja +Restart=always +# If you want to bind Vikunja to a port below 1024 uncomment +# the two values below +### +#CapabilityBoundingSet=CAP_NET_BIND_SERVICE +#AmbientCapabilities=CAP_NET_BIND_SERVICE + +[Install] +WantedBy=multi-user.target \ No newline at end of file