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