From 1becc0fae43175435969fddf480db33bbd52c8f6 Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Thu, 7 Mar 2024 12:44:54 +0100 Subject: [PATCH] packaging add octez-smartrollup-node package --- scripts/packaging/octez/debian/control | 11 ++++++ .../debian/octez-smart-rollup-node.default | 9 +++++ .../debian/octez-smart-rollup-node.install | 1 + .../debian/octez-smart-rollup-node.logrotate | 8 +++++ .../debian/octez-smart-rollup-node.postinst | 13 +++++++ .../debian/octez-smart-rollup-node.postrm | 34 +++++++++++++++++++ .../debian/octez-smart-rollup-node.prerm | 14 ++++++++ .../debian/octez-smart-rollup-node.service | 16 +++++++++ scripts/packaging/octez/debian/rules | 1 + 9 files changed, 107 insertions(+) create mode 100644 scripts/packaging/octez/debian/octez-smart-rollup-node.default create mode 100644 scripts/packaging/octez/debian/octez-smart-rollup-node.install create mode 100644 scripts/packaging/octez/debian/octez-smart-rollup-node.logrotate create mode 100755 scripts/packaging/octez/debian/octez-smart-rollup-node.postinst create mode 100755 scripts/packaging/octez/debian/octez-smart-rollup-node.postrm create mode 100755 scripts/packaging/octez/debian/octez-smart-rollup-node.prerm create mode 100644 scripts/packaging/octez/debian/octez-smart-rollup-node.service diff --git a/scripts/packaging/octez/debian/control b/scripts/packaging/octez/debian/control index 4c1636bc789e..62bdd808fe22 100644 --- a/scripts/packaging/octez/debian/control +++ b/scripts/packaging/octez/debian/control @@ -94,3 +94,14 @@ Description: Octez experimental binaries make it easier to test and observe them. - octez-protocol-compiler: used by the node to compile new protocols on the fly, and that can be used for developing new protocols. + +Package: octez-smart-rollup-node +Architecture: amd64 arm64 +Depends: ${misc:Depends}, ${shlibs:Depends}, octez-node (= ${source:Version}), +Recommends: octez-client (= ${source:Version}) +Description: Octez Smart Rollup node + This package enables rollup deployment, managing progress through commitment + publication and refutation games. Similar to the Octez node, it offers an + HTTP-accessible RPC interface. + . + This package installs the Octez rollup node. diff --git a/scripts/packaging/octez/debian/octez-smart-rollup-node.default b/scripts/packaging/octez/debian/octez-smart-rollup-node.default new file mode 100644 index 000000000000..646ad009d4f5 --- /dev/null +++ b/scripts/packaging/octez/debian/octez-smart-rollup-node.default @@ -0,0 +1,9 @@ +# Defaults for the octez smart-rollup-node + +# For client and node data directories (including the wallet) needed by the smart rollup node, +# we use the default ~/.tezos-client and ~/.tezos-node of the user "tezos". + +# The smart rollup data dir is ~/.tezos-smart-rollup-node + +# runtime options associated to the command `run` +# RUNTIME_OPTS= diff --git a/scripts/packaging/octez/debian/octez-smart-rollup-node.install b/scripts/packaging/octez/debian/octez-smart-rollup-node.install new file mode 100644 index 000000000000..aea34c74fd86 --- /dev/null +++ b/scripts/packaging/octez/debian/octez-smart-rollup-node.install @@ -0,0 +1 @@ +binaries/octez-smart-rollup-node /usr/bin/ diff --git a/scripts/packaging/octez/debian/octez-smart-rollup-node.logrotate b/scripts/packaging/octez/debian/octez-smart-rollup-node.logrotate new file mode 100644 index 000000000000..43c6ea9d24ca --- /dev/null +++ b/scripts/packaging/octez/debian/octez-smart-rollup-node.logrotate @@ -0,0 +1,8 @@ +/var/log/tezos/smart-rollup-node.log{ + daily + # we use copytruncate to avoid stopping node. + copytruncate + rotate 5 + compress + minsize 1M +} diff --git a/scripts/packaging/octez/debian/octez-smart-rollup-node.postinst b/scripts/packaging/octez/debian/octez-smart-rollup-node.postinst new file mode 100755 index 000000000000..eb5b24c11c11 --- /dev/null +++ b/scripts/packaging/octez/debian/octez-smart-rollup-node.postinst @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +# shellcheck disable=SC1091 +. /usr/share/debconf/confmodule + +db_version 2.0 + +# work directory to store temporary files associated to this package +mkdir -p /var/lib/octez-smart-rollup-node + +#DEBHELPER# diff --git a/scripts/packaging/octez/debian/octez-smart-rollup-node.postrm b/scripts/packaging/octez/debian/octez-smart-rollup-node.postrm new file mode 100755 index 000000000000..d047a00d7910 --- /dev/null +++ b/scripts/packaging/octez/debian/octez-smart-rollup-node.postrm @@ -0,0 +1,34 @@ +#!/bin/sh + +set -e + +# Load debconf library +# shellcheck disable=SC1091 +. /usr/share/debconf/confmodule + +case "${1}" in +purge) + rm -Rf /var/lib/octez-smart-rollup-node + # Purge debconf data for the package in any case + # shellcheck disable=SC2119 + db_purge || true + ;; +upgrade) + # Check if the daemon was running before the upgrade + if [ -f "/var/lib/octez-smart-rollup-node/daemon_was_running" ] && + [ "$(cat "/var/lib/octez-smart-rollup-node/daemon_was_running")" = "1" ]; then + # Start the daemon if it was running + systemctl start octez-smart-rollup-node.service + fi + ;; +remove | failed-upgrade | abort-install | abort-upgrade | disappear) ;; +*) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# Clean up the temporary file +rm -f /var/lib/octez-smart-rollup-node/daemon_was_running + +#DEBHELPER# diff --git a/scripts/packaging/octez/debian/octez-smart-rollup-node.prerm b/scripts/packaging/octez/debian/octez-smart-rollup-node.prerm new file mode 100755 index 000000000000..69c226f813c7 --- /dev/null +++ b/scripts/packaging/octez/debian/octez-smart-rollup-node.prerm @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +# shellcheck disable=SC1091 +. /usr/share/debconf/confmodule + +# Check if the daemon is active before stopping it +if systemctl is-active --quiet octez-smart-rollup-node.service; then + # Set a flag in a temporary file to indicate the daemon was running + echo "1" > "/var/lib/octez-smart-rollup-node/daemon_was_running" + echo "Stopping octez-smart-rollup-node" + sudo systemctl stop octez-smart-rollup-node.service +fi diff --git a/scripts/packaging/octez/debian/octez-smart-rollup-node.service b/scripts/packaging/octez/debian/octez-smart-rollup-node.service new file mode 100644 index 000000000000..97dfaaaa802c --- /dev/null +++ b/scripts/packaging/octez/debian/octez-smart-rollup-node.service @@ -0,0 +1,16 @@ +[Unit] +Description=Octez Smart Rollup Node +Documentation=https://tezos.gitlab.io/ +After=network.target octez-node.service + +[Service] +EnvironmentFile=-/etc/default/octez-smart-rollup-node +WorkingDirectory=/var/tezos +Restart=on-failure +User=tezos +ExecStart=/usr/bin/octez-smart-rollup-node run $RUNTIME_OPTS +StandardOutput=append:/var/log/tezos/smart-rollup-node.log +StandardError=inherit + +[Install] +WantedBy=multi-user.target diff --git a/scripts/packaging/octez/debian/rules b/scripts/packaging/octez/debian/rules index 7ff1f6517f35..695e90b6c200 100755 --- a/scripts/packaging/octez/debian/rules +++ b/scripts/packaging/octez/debian/rules @@ -25,6 +25,7 @@ override_dh_installdocs: override_dh_installsystemd: dh_installsystemd -p octez-node --no-enable --no-start + dh_installsystemd -p octez-smart-rollup-node --no-enable --no-start dh_installsystemd -p octez-baker --no-enable --no-start --name octez-baker-next dh_installsystemd -p octez-baker --no-enable --no-start --name octez-baker-active dh_installsystemd -p octez-baker --no-enable --no-start --name octez-accuser-next -- GitLab