Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactorings for postremove actions for debian pacakge #279

Merged
merged 6 commits into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion build-tools/build-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}" \
Expand Down
22 changes: 22 additions & 0 deletions build-tools/cheqd-noded.service
Original file line number Diff line number Diff line change
@@ -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
28 changes: 0 additions & 28 deletions build-tools/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF > /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
4 changes: 2 additions & 2 deletions build-tools/postremove → build-tools/postpurge
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down