From b792468bc7ef191d36da7fd5d3bf069725698483 Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Tue, 21 Jan 2025 12:06:07 +0100 Subject: [PATCH 1/5] packages: increase octez-node systemd service timeout --- scripts/packaging/octez/debian/octez-node.service | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/packaging/octez/debian/octez-node.service b/scripts/packaging/octez/debian/octez-node.service index f949a2782db0..4ab7ccdef462 100644 --- a/scripts/packaging/octez/debian/octez-node.service +++ b/scripts/packaging/octez/debian/octez-node.service @@ -4,6 +4,7 @@ Documentation=https://tezos.gitlab.io/ After=network.target [Service] +TimeoutSec=600s EnvironmentFile=-/etc/default/octez-node WorkingDirectory=/var/tezos Restart=on-failure -- GitLab From 5ec13b0a8c4dcd1a7b76f80815568bcdde33de4f Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Wed, 27 Nov 2024 11:22:49 +0100 Subject: [PATCH 2/5] packages rpm: add automatic snapshot import script --- scripts/packaging/build-rpm-local.sh | 10 +++++- .../packaging/octez/rpm/SPECS/octez-node.spec | 4 ++- .../octez/scripts/octez-node-prestart.sh | 32 +++++++++++++------ 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/scripts/packaging/build-rpm-local.sh b/scripts/packaging/build-rpm-local.sh index 04d989fb42f7..b676ee5003a3 100755 --- a/scripts/packaging/build-rpm-local.sh +++ b/scripts/packaging/build-rpm-local.sh @@ -78,6 +78,14 @@ packages() { cp "$packaging_dir/scripts/packaging/octez/debian/"*.service "$SPECS_DIR/" cp "$packaging_dir/scripts/packaging/octez/debian/"*.default "$SPECS_DIR/" cp "$packaging_dir/scripts/packaging/octez/debian/"*.manpages "$SPECS_DIR/" + { + echo "DATADIR=/var/tezos/.tezos-node" + echo "NETWORK=mainnet" + echo "HISTORY_MODE=rolling" + echo "SNAPSHOT_IMPORT=true" + echo "SNAPSHOT_NO_CHECK=false" + } >> "$SPECS_DIR/octez-node.default" + grep "Package:" "$packaging_dir/scripts/packaging/octez/debian/control" | cut -d' ' -f2 | while read -r pkg; do cp "$packaging_dir/scripts/packaging/octez/rpm/SPECS/$pkg.spec" "$SPECS_DIR/" @@ -102,7 +110,7 @@ zcash() { while read -r pkg; do cp "$packaging_dir/scripts/packaging/octez/rpm/SPECS/$pkg.spec" "$SPECS_DIR/" cd "$SPECS_DIR" || exit - rpmbuild -ba \ + rpmbuild -ba --quiet \ --define "version $_VERSION" \ --define "epoch $_EPOCH" \ --define '_source_filedir %{nil}' \ diff --git a/scripts/packaging/octez/rpm/SPECS/octez-node.spec b/scripts/packaging/octez/rpm/SPECS/octez-node.spec index 693effad84c8..147b9819c5aa 100644 --- a/scripts/packaging/octez/rpm/SPECS/octez-node.spec +++ b/scripts/packaging/octez/rpm/SPECS/octez-node.spec @@ -26,12 +26,14 @@ install -D -m 644 $HOME/rpmbuild/SPECS/manpages/octez-node.1 %{buildroot}%{_mand gzip %{buildroot}%{_mandir}/man1/octez-node.1 install -D -m 644 $HOME/rpmbuild/SPECS/octez-node.service %{buildroot}/usr/lib/systemd/system/octez-node.service install -D -m 644 $HOME/rpmbuild/SPECS/octez-node.default %{buildroot}/etc/default/octez-node +install -D -m 644 $HOME/rpmbuild/SPECS/scripts/snapshot_import.sh %{buildroot}/usr/share/octez-node/snapshot_import.sh +install -D -m 644 $HOME/rpmbuild/SPECS/scripts/octez-node-prestart.sh %{buildroot}/usr/share/octez-node/octez-node-prestart.sh %files /usr/bin/octez-node %{_mandir}/man1/octez-node.1* /usr/lib/systemd/system/octez-node.service -/etc/default/octez-node /usr/share/octez-node/* +%config /etc/default/octez-node %postun . /etc/default/octez-node diff --git a/scripts/packaging/octez/scripts/octez-node-prestart.sh b/scripts/packaging/octez/scripts/octez-node-prestart.sh index d6d7beefc9e4..87a3ba1edad7 100755 --- a/scripts/packaging/octez/scripts/octez-node-prestart.sh +++ b/scripts/packaging/octez/scripts/octez-node-prestart.sh @@ -15,13 +15,25 @@ fi DATADIR=/var/tezos/.tezos-node # Function to get a Debconf value -get_debconf_value() { +get_value() { + VAR=$1 PACKAGE=octez-node # Package name - TEMPLATE=$1 - - # Query the value using debconf-communicate - echo GET "$TEMPLATE" | - debconf-communicate "$PACKAGE" 2> /dev/null | awk '/^0/ {print $2}' + TEMPLATE="$PACKAGE/$VAR" + + if command -v debconf-communicate > /dev/null; then + # Query the value using debconf-communicate + echo GET "$TEMPLATE" | + debconf-communicate "$PACKAGE" 2> /dev/null | awk '/^0/ {print $2}' + else + # if debconf is not available ( like on rpm systems ), + # we try our luck with the default env vars + if [ -e /etc/default/octez-node ]; then + #shellcheck disable=SC1091 + . /etc/default/octez-node + UPPERVAR=$(echo "$VAR" | tr '[:lower:]' '[:upper:]' | tr '-' '_') + eval "echo \$$UPPERVAR" + fi + fi } # Either we upgrade the store if exists, or we import a snapshot @@ -32,11 +44,11 @@ if [ -d "$DATADIR/store" ]; then rm -rf "$DATADIR/lmdb_store_to_remove" else # we import the snapshot automatically only if the user wants to do so. - if [ "$(get_debconf_value "octez-node/snapshot-import")" = "true" ]; then - network=$(get_debconf_value "octez-node/network") - history_mode=$(get_debconf_value "octez-node/history-mode") + if [ "$(get_value "snapshot-import")" = "true" ]; then + network=$(get_value "network") + history_mode=$(get_value "history-mode") no_check= - if [ "$(get_debconf_value "octez-node/snapshot-no-check")" = "true" ]; then + if [ "$(get_value "snapshot-no-check")" = "true" ]; then no_check="-s --no-check" fi -- GitLab From bd1d6f05465877931d324ebd0b2760ec32780e3c Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Thu, 12 Dec 2024 13:14:43 +0100 Subject: [PATCH 3/5] rpm packages: add sudo as Requires for octez-node --- scripts/packaging/octez/rpm/SPECS/octez-node.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/packaging/octez/rpm/SPECS/octez-node.spec b/scripts/packaging/octez/rpm/SPECS/octez-node.spec index 147b9819c5aa..71d24770f411 100644 --- a/scripts/packaging/octez/rpm/SPECS/octez-node.spec +++ b/scripts/packaging/octez/rpm/SPECS/octez-node.spec @@ -6,7 +6,7 @@ Epoch: %{epoch} Release: 1%{?dist} Summary: L1 Octez node for the Tezos network License: MIT -Requires: shadow-utils logrotate octez-zcash-params systemd +Requires: shadow-utils logrotate octez-zcash-params systemd sudo Recommends: octez-client Suggests: lz4 curl sudo %description -- GitLab From cac6e05a577cc6b46c4c7f3ebf3689112ace790d Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Thu, 12 Dec 2024 13:48:04 +0100 Subject: [PATCH 4/5] rpm packaging: add install_dal_trusted_setup.sh call in local build script --- scripts/packaging/octez/rpm/SPECS/octez-node.spec | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/packaging/octez/rpm/SPECS/octez-node.spec b/scripts/packaging/octez/rpm/SPECS/octez-node.spec index 71d24770f411..4ed2e1c93651 100644 --- a/scripts/packaging/octez/rpm/SPECS/octez-node.spec +++ b/scripts/packaging/octez/rpm/SPECS/octez-node.spec @@ -18,16 +18,14 @@ Suggests: lz4 curl sudo %install mkdir -p %{buildroot}/usr/bin/ mkdir -p %{buildroot}/usr/share/octez-node/ -install -m 0755 $HOME/rpmbuild/SPECS/binaries/octez-node %{buildroot}/usr/bin/ -install -m 0755 $HOME/rpmbuild/SPECS/scripts/octez-node-prestart.sh %{buildroot}/usr/share/octez-node/ -install -m 0755 $HOME/rpmbuild/SPECS/scripts/snapshot-import.sh %{buildroot}/usr/share/octez-node/ -install -m 0755 $HOME/rpmbuild/SPECS/scripts/wait-for-node-up.sh %{buildroot}/usr/share/octez-node/ -install -D -m 644 $HOME/rpmbuild/SPECS/manpages/octez-node.1 %{buildroot}%{_mandir}/man1/octez-node.1 +install -D -m 0755 $HOME/rpmbuild/SPECS/binaries/octez-node %{buildroot}/usr/bin/ +install -D -m 0755 $HOME/rpmbuild/SPECS/scripts/octez-node-prestart.sh %{buildroot}/usr/share/octez-node/ +install -D -m 0755 $HOME/rpmbuild/SPECS/scripts/snapshot-import.sh %{buildroot}/usr/share/octez-node/ +install -D -m 0755 "$HOME/rpmbuild/SPECS/scripts/wait-for-node-up.sh" %{buildroot}/usr/share/octez-node/ +install -D -m 0644 $HOME/rpmbuild/SPECS/manpages/octez-node.1 %{buildroot}%{_mandir}/man1/octez-node.1 +install -D -m 0644 $HOME/rpmbuild/SPECS/octez-node.default %{buildroot}/etc/default/octez-node gzip %{buildroot}%{_mandir}/man1/octez-node.1 install -D -m 644 $HOME/rpmbuild/SPECS/octez-node.service %{buildroot}/usr/lib/systemd/system/octez-node.service -install -D -m 644 $HOME/rpmbuild/SPECS/octez-node.default %{buildroot}/etc/default/octez-node -install -D -m 644 $HOME/rpmbuild/SPECS/scripts/snapshot_import.sh %{buildroot}/usr/share/octez-node/snapshot_import.sh -install -D -m 644 $HOME/rpmbuild/SPECS/scripts/octez-node-prestart.sh %{buildroot}/usr/share/octez-node/octez-node-prestart.sh %files /usr/bin/octez-node %{_mandir}/man1/octez-node.1* -- GitLab From c515d901d320c14d55ec230b06fb7524547f778f Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Wed, 5 Feb 2025 13:14:16 +0100 Subject: [PATCH 5/5] packages: move rpm systemd tests to scripts/packaging/tests/rpm/rpm-install.sh --- .gitlab/ci/pipelines/rpm_repository_full.yml | 3 +- .../ci/pipelines/rpm_repository_partial.yml | 3 +- .../pipelines/rpm_repository_partial_auto.yml | 3 +- ci/bin/rpm_repository.ml | 2 +- docs/introduction/install-bin-rpm.sh | 31 +--------------- scripts/packaging/tests/rpm/rpm-install.sh | 35 +++++++++++++++++-- 6 files changed, 41 insertions(+), 36 deletions(-) diff --git a/.gitlab/ci/pipelines/rpm_repository_full.yml b/.gitlab/ci/pipelines/rpm_repository_full.yml index cbfcfc6367c7..8d329d405c42 100644 --- a/.gitlab/ci/pipelines/rpm_repository_full.yml +++ b/.gitlab/ci/pipelines/rpm_repository_full.yml @@ -470,7 +470,8 @@ oc.install_bin_rockylinux_93_systemd: before_script: - ./scripts/ci/docker_initialize.sh script: - - ./scripts/ci/systemd-packages-test.sh docs/introduction/install-bin-rpm.sh images/packages/rpm-systemd-tests.Dockerfile + - ./scripts/ci/systemd-packages-test.sh scripts/packaging/tests/rpm/rpm-install.sh + images/packages/rpm-systemd-tests.Dockerfile services: - docker:${DOCKER_VERSION}-dind variables: diff --git a/.gitlab/ci/pipelines/rpm_repository_partial.yml b/.gitlab/ci/pipelines/rpm_repository_partial.yml index 0af0f32fe65f..7cd9b8e2d649 100644 --- a/.gitlab/ci/pipelines/rpm_repository_partial.yml +++ b/.gitlab/ci/pipelines/rpm_repository_partial.yml @@ -253,7 +253,8 @@ oc.install_bin_rockylinux_93_systemd: before_script: - ./scripts/ci/docker_initialize.sh script: - - ./scripts/ci/systemd-packages-test.sh docs/introduction/install-bin-rpm.sh images/packages/rpm-systemd-tests.Dockerfile + - ./scripts/ci/systemd-packages-test.sh scripts/packaging/tests/rpm/rpm-install.sh + images/packages/rpm-systemd-tests.Dockerfile services: - docker:${DOCKER_VERSION}-dind variables: diff --git a/.gitlab/ci/pipelines/rpm_repository_partial_auto.yml b/.gitlab/ci/pipelines/rpm_repository_partial_auto.yml index 716d888da434..f2c652407ca0 100644 --- a/.gitlab/ci/pipelines/rpm_repository_partial_auto.yml +++ b/.gitlab/ci/pipelines/rpm_repository_partial_auto.yml @@ -253,7 +253,8 @@ oc.install_bin_rockylinux_93_systemd: before_script: - ./scripts/ci/docker_initialize.sh script: - - ./scripts/ci/systemd-packages-test.sh docs/introduction/install-bin-rpm.sh images/packages/rpm-systemd-tests.Dockerfile + - ./scripts/ci/systemd-packages-test.sh scripts/packaging/tests/rpm/rpm-install.sh + images/packages/rpm-systemd-tests.Dockerfile services: - docker:${DOCKER_VERSION}-dind variables: diff --git a/ci/bin/rpm_repository.ml b/ci/bin/rpm_repository.ml index 6419d9e8cae8..ae973190c8e0 100644 --- a/ci/bin/rpm_repository.ml +++ b/ci/bin/rpm_repository.ml @@ -320,7 +320,7 @@ let jobs pipeline_type = [("DISTRIBUTION", "rockylinux"); ("RELEASE", "9.3")]) [ "./scripts/ci/systemd-packages-test.sh \ - docs/introduction/install-bin-rpm.sh \ + scripts/packaging/tests/rpm/rpm-install.sh \ images/packages/rpm-systemd-tests.Dockerfile"; ]; ] diff --git a/docs/introduction/install-bin-rpm.sh b/docs/introduction/install-bin-rpm.sh index e9dec468e989..9483fc2026d8 100755 --- a/docs/introduction/install-bin-rpm.sh +++ b/docs/introduction/install-bin-rpm.sh @@ -30,17 +30,6 @@ TestBranch) ;; esac -# wait for systemd to be ready -count=0 -while [ "$(systemctl is-system-running)" = "offline" ]; do - count=$((count + 1)) - if [ $count -ge 10 ]; then - echo "System is not running after 10 iterations." - exit 1 - fi - sleep 1 -done - set -e set -x @@ -78,23 +67,10 @@ else fi -dnf -y install sudo procps +dnf -y install sudo # [install tezos] sudo dnf -y install octez-node - -# if systemd is available we test the service scripts -if [ "$(ps --no-headers -o comm 1)" = "systemd" ]; then - systemctl enable octez-node - systemctl start octez-node - - sleep 5 - systemctl status octez-node - - journalctl -xeu octez-node.service - -fi - sudo dnf -y install octez-client sudo dnf -y install octez-node sudo dnf -y install octez-baker @@ -107,10 +83,5 @@ octez-node --version "octez-baker-$protocol" --version "octez-accuser-$protocol" --version -# If systemd is available we stop the service scripts started above. -if [ "$(ps --no-headers -o comm 1)" = "systemd" ]; then - systemctl stop octez-node -fi - # [test autopurge] sudo dnf -y remove octez-node octez-client octez-baker octez-dal-node diff --git a/scripts/packaging/tests/rpm/rpm-install.sh b/scripts/packaging/tests/rpm/rpm-install.sh index 7f995bda8bd4..fdef711a76cf 100755 --- a/scripts/packaging/tests/rpm/rpm-install.sh +++ b/scripts/packaging/tests/rpm/rpm-install.sh @@ -7,6 +7,17 @@ REPO="https://storage.googleapis.com/$GCP_LINUX_PACKAGES_BUCKET/$CI_COMMIT_REF_N DISTRO=$1 RELEASE=$2 +# wait for systemd to be ready +count=0 +while [ "$(systemctl is-system-running)" = "offline" ]; do + count=$((count + 1)) + if [ $count -ge 10 ]; then + echo "System is not running after 10 iterations." + exit 1 + fi + sleep 1 +done + # Update and install the config-mananger plugin dnf -y update dnf -y install dnf-plugins-core @@ -21,6 +32,26 @@ dnf -y update # Install public key rpm --import "$REPO/$DISTRO/octez.asc" +dnf -y install sudo procps + +sudo dnf -y install octez-client dnf -y install octez-node -rpm -v --info -q octez-node -rpm -v --verify octez-node + +# if systemd is available we test the service scripts +if [ "$(ps --no-headers -o comm 1)" = "systemd" ]; then + systemctl enable octez-node + systemctl start octez-node + + sleep 5 + systemctl status octez-node + + journalctl -xeu octez-node.service + +fi + +sudo dnf -y install octez-baker + +# If systemd is available we stop the service scripts started above. +if [ "$(ps --no-headers -o comm 1)" = "systemd" ]; then + systemctl stop octez-node +fi -- GitLab