diff --git a/build-tools/build-deb.sh b/build-tools/build-deb.sh index 86a5493e8..69faf2bc4 100755 --- a/build-tools/build-deb.sh +++ b/build-tools/build-deb.sh @@ -30,9 +30,14 @@ fpm \ --version "${VERSION}" \ --name "cheqd-node" \ --description "cheqd node" \ + --url "https://github.com/cheqd/cheqd-node" --architecture "${ARCH}" \ + --deb-generate-changes \ + --deb-compression gz \ --after-install "postinst" \ - --after-remove "postremove" \ + --deb-after-purge "postpurge" \ + --deb-systemd-enable \ + --deb-systemd cheqd-noded.service \ --depends "logrotate" \ --verbose \ --package "${PKG_PATH}" \ diff --git a/build-tools/cheqd-noded.service b/build-tools/cheqd-noded.service new file mode 100644 index 000000000..69a4a286f --- /dev/null +++ b/build-tools/cheqd-noded.service @@ -0,0 +1,22 @@ +[Unit] +Description=Service for running cheqd-node daemon +After=network.target +Documentation=https://docs.cheqd.io/node + +[Service] +Type=simple +User=cheqd +ExecStart=/usr/bin/cheqd-noded start +Restart=on-failure +RestartSec=30 +StartLimitBurst=5 +StartLimitInterval=60 +TimeoutSec=120 +StandardOutput=syslog +StandardError=syslog +SyslogFacility=syslog +SyslogIdentifier=cheqd-noded +LimitNOFILE=65535 + +[Install] +WantedBy=multi-user.target diff --git a/build-tools/postinst b/build-tools/postinst index 5aefbeed5..ed8860ce1 100644 --- a/build-tools/postinst +++ b/build-tools/postinst @@ -77,31 +77,3 @@ systemctl restart logrotate.service systemctl restart logrotate.timer fi -# Add systemd script -if [ ! -f /lib/systemd/system/cheqd-noded.service ] ; then - cat < /lib/systemd/system/cheqd-noded.service -[Unit] -Description=Service for running cheqd-node daemon -After=network.target - -[Service] -Type=simple -User=cheqd -ExecStart=/usr/bin/cheqd-noded start -Restart=on-failure -RestartSec=10 -StartLimitBurst=10 -StartLimitInterval=200 -TimeoutSec=300 -StandardOutput=syslog -StandardError=syslog -SyslogFacility=syslog -SyslogIdentifier=cheqd-noded -LimitNOFILE=65535 - -[Install] -WantedBy=multi-user.target -EOF - # Reload daemons for systemctl - systemctl daemon-reload -fi diff --git a/build-tools/postremove b/build-tools/postpurge similarity index 93% rename from build-tools/postremove rename to build-tools/postpurge index b0969a4a9..dc1a589a0 100644 --- a/build-tools/postremove +++ b/build-tools/postpurge @@ -17,8 +17,8 @@ if test -f "/etc/rsyslog.d/cheqd-node.conf"; then # Remove syslog conf rm /etc/rsyslog.d/cheqd-node.conf - # Remove symlink to log location - rm /var/log/cheqd-node + # Remove logs + rm -rf /var/log/cheqd-node/ # Restart syslog systemctl restart rsyslog