From e13b473487034d4e72239b8072791582ecc7ca66 Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Thu, 11 Jan 2024 13:44:56 +0100 Subject: [PATCH] packages: octez-node We add a new octez-node debian package that is built following debian best practices for packaging, includes a minimal debconf installation routine, use logrotate and systemd. We compile this package for : - debian stable and unstable - ubuntu jammy and focal --- .gitignore | 7 -- .../build-debian-packages-dependencies.sh | 47 +++++++++++ .../jobs/packaging/build-debian-packages.sh | 40 +++++++++ .../ci/jobs/packaging/debian_repository.yml | 83 +++++++++++++++++++ .gitlab/ci/pipelines/before_merging.yml | 1 + .pre-commit-config.yaml | 2 +- debian-deps-build.Dockerfile | 42 ++++++++++ scripts/packaging/.gitignore | 8 ++ scripts/packaging/octez/.gitignore | 37 +++++++++ scripts/packaging/octez/debian/changelog | 5 ++ scripts/packaging/octez/debian/compat | 1 + scripts/packaging/octez/debian/control | 36 ++++++++ scripts/packaging/octez/debian/copyright | 9 ++ .../octez/debian/octez-client.install | 3 + .../packaging/octez/debian/octez-node.config | 19 +++++ .../packaging/octez/debian/octez-node.default | 8 ++ .../packaging/octez/debian/octez-node.install | 2 + .../octez/debian/octez-node.lintian-overrides | 1 + .../octez/debian/octez-node.logrotate | 8 ++ .../octez/debian/octez-node.manpages | 1 + .../octez/debian/octez-node.postinst | 56 +++++++++++++ .../packaging/octez/debian/octez-node.postrm | 37 +++++++++ .../packaging/octez/debian/octez-node.prerm | 17 ++++ .../packaging/octez/debian/octez-node.service | 14 ++++ .../octez/debian/octez-node.templates | 39 +++++++++ .../octez/debian/octez-zcash-params.install | 1 + scripts/packaging/octez/debian/rules | 38 +++++++++ .../packaging/octez/docs/README.octez-node | 24 ++++++ .../packaging/octez/manpages/octez-client.1 | 33 ++++++++ 29 files changed, 611 insertions(+), 8 deletions(-) create mode 100755 .gitlab/ci/jobs/packaging/build-debian-packages-dependencies.sh create mode 100755 .gitlab/ci/jobs/packaging/build-debian-packages.sh create mode 100644 .gitlab/ci/jobs/packaging/debian_repository.yml create mode 100644 debian-deps-build.Dockerfile create mode 100644 scripts/packaging/.gitignore create mode 100644 scripts/packaging/octez/.gitignore create mode 100644 scripts/packaging/octez/debian/changelog create mode 100644 scripts/packaging/octez/debian/compat create mode 100644 scripts/packaging/octez/debian/control create mode 100644 scripts/packaging/octez/debian/copyright create mode 100644 scripts/packaging/octez/debian/octez-client.install create mode 100755 scripts/packaging/octez/debian/octez-node.config create mode 100644 scripts/packaging/octez/debian/octez-node.default create mode 100644 scripts/packaging/octez/debian/octez-node.install create mode 100644 scripts/packaging/octez/debian/octez-node.lintian-overrides create mode 100644 scripts/packaging/octez/debian/octez-node.logrotate create mode 100644 scripts/packaging/octez/debian/octez-node.manpages create mode 100755 scripts/packaging/octez/debian/octez-node.postinst create mode 100755 scripts/packaging/octez/debian/octez-node.postrm create mode 100755 scripts/packaging/octez/debian/octez-node.prerm create mode 100644 scripts/packaging/octez/debian/octez-node.service create mode 100644 scripts/packaging/octez/debian/octez-node.templates create mode 100644 scripts/packaging/octez/debian/octez-zcash-params.install create mode 100755 scripts/packaging/octez/debian/rules create mode 100644 scripts/packaging/octez/docs/README.octez-node create mode 100644 scripts/packaging/octez/manpages/octez-client.1 diff --git a/.gitignore b/.gitignore index 76b5be40e12a..7407e1e2dde5 100644 --- a/.gitignore +++ b/.gitignore @@ -72,15 +72,8 @@ __pycache__ contrib/kaitai-struct-files/doc -*.install .merlin -*.deb -*.rpm -scripts/pkg-common/baker-binaries -scripts/pkg-common/smartrollup-binaries -scripts/pkg-common/client-binaries - *~ \#*\# .\#* diff --git a/.gitlab/ci/jobs/packaging/build-debian-packages-dependencies.sh b/.gitlab/ci/jobs/packaging/build-debian-packages-dependencies.sh new file mode 100755 index 000000000000..203558907b0e --- /dev/null +++ b/.gitlab/ci/jobs/packaging/build-debian-packages-dependencies.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +# Build dependency images for debian based distributions + +set -e + +. scripts/version.sh + +# Determine platform based on runner's tags +# This works with GCP. If switching to AWS these tags must be changed. +case "$TAGS" in +gcp_arm64) + PLATFORM="linux/arm64" + ARCHITECTURE="arm64" + ;; +gcp) + PLATFORM="linux/amd64" + ARCHITECTURE="amd64" + ;; +*) + echo "Unknown tag: $TAGS" + exit 1 + ;; +esac + +docker build \ + --network host \ + --platform $PLATFORM \ + --push \ + --label "com.tezos.build-pipeline-id"="${CI_PIPELINE_ID}" \ + --label "com.tezos.build-pipeline-url"="${CI_PIPELINE_URL}" \ + --label "com.tezos.build-job-id"="${CI_JOB_ID}" \ + --label "com.tezos.build-job-url"="${CI_JOB_URL}" \ + --label "com.tezos.build-tezos-revision"="${CI_COMMIT_SHA}" \ + --label "com.tezos.build-opam_repository_tag"="${opam_repository_tag}" \ + --cache-from="${DEP_IMAGE}:${ARCHITECTURE}" \ + -f debian-deps-build.Dockerfile \ + --build-arg=BUILDKIT_INLINE_CACHE=1 \ + --build-arg IMAGE="$DISTRIBUTION:$RELEASE" \ + -t "$DEP_IMAGE:${ARCHITECTURE}" \ + -t "$DEP_IMAGE:latest" \ + . + +docker buildx imagetools create --append \ + -t "${DEP_IMAGE}:latest" "${DEP_IMAGE}:${ARCHITECTURE}" + +docker buildx imagetools inspect "${DEP_IMAGE}:latest" diff --git a/.gitlab/ci/jobs/packaging/build-debian-packages.sh b/.gitlab/ci/jobs/packaging/build-debian-packages.sh new file mode 100755 index 000000000000..3b2ab3cc04c2 --- /dev/null +++ b/.gitlab/ci/jobs/packaging/build-debian-packages.sh @@ -0,0 +1,40 @@ +#!/bin/sh +set -e + +deps_opam_repository_tag=$(cat /root/tezos/opam_repository_tag) +. scripts/version.sh + +if [ "$deps_opam_repository_tag" != "$opam_repository_tag" ]; then + echo "Dependency tag: $deps_opam_repository_tag" + echo "Actual tag: $opam_repository_tag" + echo "The dependency image is outdated. Please rebuild before lunching this job" + exit 1 +fi + +# Prepare the building area: copying all files from +# the dependency image in the staging area and +# updating the source with the latest commits +cp -a /root/tezos/_opam /builds/tezos/tezos/ + +# Build tezos as usual +eval "$(opam env)" +make all + +# Prepare the packaging by copying all the freshly compiled binaries +mkdir -p scripts/packaging/octez/binaries +mkdir -p scripts/packaging/octez/zcash-params +cp octez-* scripts/packaging/octez/binaries/ + +# Copy the zcash parametes to be packaged +cp -a _opam/share/zcash-params scripts/packaging/octez/ + +# Generate the octez-node manual to be included in the package +./octez-node --help=groff > scripts/packaging/octez/manpages/octez-node.1 + +# Build the debian packages +cd scripts/packaging/octez/ +DEB_BUILD_OPTIONS=noautodbgsym dpkg-buildpackage -b --no-sign -sa + +# Move the debian package to be packed as artifacts +mkdir -p "/builds/tezos/tezos/packages/$DISTRIBUTION/$RELEASE" +mv ../*.deb "/builds/tezos/tezos/packages/$DISTRIBUTION/$RELEASE" diff --git a/.gitlab/ci/jobs/packaging/debian_repository.yml b/.gitlab/ci/jobs/packaging/debian_repository.yml new file mode 100644 index 000000000000..dd3cbdb52bae --- /dev/null +++ b/.gitlab/ci/jobs/packaging/debian_repository.yml @@ -0,0 +1,83 @@ + +variables: + DEP_IMAGE: registry.gitlab.com/tezos/tezos/build-$DISTRIBUTION-$RELEASE + +# This is a generic template to build both Debian- and Ubuntu- +# packages. We use the variable $DISTRIBUTION to discriminate +# between the two. +.docker-build-debian-dependencies: + extends: + - .image_template__docker + - .docker_auth_template + stage: build + needs: [] + rules: + - changes: + - scripts/version.sh + - .gitlab-ci.yml + - debian-deps-build.Dockerfile + when: on_success + - when: manual + tags: + - $TAGS + script: + - .gitlab/ci/jobs/packaging/build-debian-packages-dependencies.sh + +oc.docker-build-debian-dependencies: + extends: + - .docker-build-debian-dependencies + variables: + DISTRIBUTION: debian + parallel: + matrix: + - RELEASE: [unstable, bookworm] + TAGS: [gcp] + +oc.docker-build-ubuntu-dependencies: + extends: + - .docker-build-debian-dependencies + variables: + DISTRIBUTION: ubuntu + parallel: + matrix: + - RELEASE: [focal, jammy] + TAGS: [gcp] + +oc.build-debian-based-packages: + stage: manual + needs: [] + when: manual + script: + echo "Trigger build debian packages" + +.build-debian-packages: + stage: manual + needs: [oc.build-debian-based-packages] + image: $DEP_IMAGE:latest + tags: + - $TAGS + artifacts: + paths: + - packages/$DISTRIBUTION/$RELEASE + script: + - .gitlab/ci/jobs/packaging/build-debian-packages.sh + +oc.build-debian: + extends: + - .build-debian-packages + variables: + DISTRIBUTION: debian + parallel: + matrix: + - RELEASE: [unstable, bookworm] + TAGS: [gcp] + +oc.build-ubuntu: + extends: + - .build-debian-packages + variables: + DISTRIBUTION: ubuntu + parallel: + matrix: + - RELEASE: [jammy, focal] + TAGS: [gcp] diff --git a/.gitlab/ci/pipelines/before_merging.yml b/.gitlab/ci/pipelines/before_merging.yml index 63ad3b43b85a..ac8d54e436bc 100644 --- a/.gitlab/ci/pipelines/before_merging.yml +++ b/.gitlab/ci/pipelines/before_merging.yml @@ -9,6 +9,7 @@ include: # Stage: package - .gitlab/ci/jobs/packaging/opam:prepare.yml - .gitlab/ci/jobs/packaging/opam_package.yml + - .gitlab/ci/jobs/packaging/debian_repository.yml # Stage: build - .gitlab/ci/jobs/build/oc.docker:rust-toolchain-before_merging.yml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8112bd2f126a..3f6136584078 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ repos: rev: v0.0.2 hooks: - id: shfmt - # These settings must mirror the ones set in `scripts/lint.sh`. + # These settings must mirror the ones set in `scripts/lint.sh`. args: [ "-i", "2", "-sr", "-d" ] - repo: https://github.com/arenadotio/pre-commit-ocamlformat rev: 0439858 diff --git a/debian-deps-build.Dockerfile b/debian-deps-build.Dockerfile new file mode 100644 index 000000000000..e88c5ef5aa5b --- /dev/null +++ b/debian-deps-build.Dockerfile @@ -0,0 +1,42 @@ +ARG IMAGE +FROM ${IMAGE} + +ARG DEBIAN_FRONTEND=noninteractive +ENV TZ=Etc/UTC + +RUN apt update && \ + apt-get install -y bubblewrap \ + rsync git m4 build-essential \ + patch unzip wget opam jq bc \ + autoconf cmake libev-dev \ + libffi-dev libgmp-dev \ + libhidapi-dev pkg-config \ + zlib1g-dev debhelper debconf \ + libprotobuf-dev protobuf-compiler && \ + apt-get clean + +COPY scripts/version.sh /tmp/ +RUN wget https://sh.rustup.rs/rustup-init.sh && \ + . /tmp/version.sh && \ + chmod +x rustup-init.sh && \ + ./rustup-init.sh --profile minimal \ + --default-toolchain $recommended_rust_version -y + +RUN opam init --bare --disable-sandboxing +# we do not need everything to run build-deps +# we copy the mininum amount of files to use +# the caching mechanism more efficiently +COPY --link scripts/install_build_deps.sh root/tezos/scripts/ +COPY --link scripts/install_build_deps.raw.sh root/tezos/scripts/ +COPY --link scripts/install_build_deps.rust.sh root/tezos/scripts/ +COPY --link scripts/version.sh root/tezos/scripts/ +COPY --link Makefile root/tezos/ +COPY --link opam/virtual/octez-deps.opam root/tezos/opam/virtual/ +COPY --link opam root/tezos/ + +WORKDIR root/tezos +RUN . /tmp/version.sh && \ + echo $opam_repository_tag > opam_repository_tag +RUN eval $(opam env) ; \ + . $HOME/.cargo/env ; \ + make build-deps diff --git a/scripts/packaging/.gitignore b/scripts/packaging/.gitignore new file mode 100644 index 000000000000..be4bc0be5baf --- /dev/null +++ b/scripts/packaging/.gitignore @@ -0,0 +1,8 @@ +# .gitignore for files autogenerated by dpkg-buildpackage + +*.build +*.buildinfo +*.changes +*.deb +*.dsc +*.tar.* diff --git a/scripts/packaging/octez/.gitignore b/scripts/packaging/octez/.gitignore new file mode 100644 index 000000000000..8f58b304d25d --- /dev/null +++ b/scripts/packaging/octez/.gitignore @@ -0,0 +1,37 @@ +# .gitignore for files autogenerated by dpkg-buildpackage + +*.build +*.buildinfo +*.changes +*.deb +*.dsc +*.tar.* +debian/files +debian/*.debhelper.log +debian/*.substvars +debian/*.debhelper +debian/debhelper-build-stamp +debian/substvars +debian/*.debhelper.log +debian/*debhelper +debian/*debhelper* +debian/debian-builder +debian/.debhelper +debian/debs +debian/dbgsym +debian/*.ddeb +debian/debhelper-build-stamp +debian/debhelper.log +debian/extra-files-for-building +debian/*.udeb +debian/*.changes +debian/*.debhelper.log +debian/*.debhelper +debian/*.substvars +debian/files +debian/substvars +debian/octez-client/ +debian/octez-node/ +binaries +manpages/octez-node.1 +zcash-params diff --git a/scripts/packaging/octez/debian/changelog b/scripts/packaging/octez/debian/changelog new file mode 100644 index 000000000000..098a3603c73f --- /dev/null +++ b/scripts/packaging/octez/debian/changelog @@ -0,0 +1,5 @@ +octez (0.0.1-1) unstable; urgency=medium + + * Initial packaging work with dpkg-buildpackage. + + -- Nomadic Labs Thu, 06 Jul 2017 09:19:24 +0000 diff --git a/scripts/packaging/octez/debian/compat b/scripts/packaging/octez/debian/compat new file mode 100644 index 000000000000..48082f72f087 --- /dev/null +++ b/scripts/packaging/octez/debian/compat @@ -0,0 +1 @@ +12 diff --git a/scripts/packaging/octez/debian/control b/scripts/packaging/octez/debian/control new file mode 100644 index 000000000000..e51bb5805fb3 --- /dev/null +++ b/scripts/packaging/octez/debian/control @@ -0,0 +1,36 @@ +Source: octez +Section: devel +Priority: optional +Maintainer: Nomadic Labs +Homepage: https://gitlab.com/tezos/tezos + +Package: octez-zcash-params +Architecture: all +Multi-Arch: foreign +Description: Octez zcash parameters + This package provides Zcash parameters necessary for the Octez node, + covering cryptographic keys, zk-SNARKs, and protocol configurations. + +Package: octez-node +Architecture: amd64 arm64 +Depends: adduser, + logrotate, + octez-zcash-params, + ${misc:Depends}, + ${shlibs:Depends}, + debconf (>= 0.5) | debconf-2.0 +Recommends: octez-client (= ${source:Version}), +Suggests: lz4, curl +Description: L1 Octez node for the Tezos network + This package serves as the core implementation for the Tezos blockchain node. + It contains the fundamental components required for protocol execution, + consensus, and network communication within the Tezos blockchain network + +Package: octez-client +Architecture: amd64 arm64 +Depends: ${misc:Depends}, ${shlibs:Depends}, +Description: Octez client + This package serves as the client-side interface for interacting with the + Tezos blockchain. It includes command-line tools and functionalities for + querying blockchain data, broadcasting transactions, and interacting with + smart contracts on the Tezos network. diff --git a/scripts/packaging/octez/debian/copyright b/scripts/packaging/octez/debian/copyright new file mode 100644 index 000000000000..4dcaff698a18 --- /dev/null +++ b/scripts/packaging/octez/debian/copyright @@ -0,0 +1,9 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Source: https://gitlab.com/tezos/tezos +Upstream-Name: Octez +Upstream-Contact: Nomadic Labs +License: MIT + +Files: * +Copyright: Copyright Nomadic Labs 2018-2024 +License: MIT diff --git a/scripts/packaging/octez/debian/octez-client.install b/scripts/packaging/octez/debian/octez-client.install new file mode 100644 index 000000000000..54f546d7811a --- /dev/null +++ b/scripts/packaging/octez/debian/octez-client.install @@ -0,0 +1,3 @@ +binaries/octez-client /usr/bin/ +binaries/octez-admin-client /usr/bin/ +binaries/octez-codec /usr/bin/ diff --git a/scripts/packaging/octez/debian/octez-node.config b/scripts/packaging/octez/debian/octez-node.config new file mode 100755 index 000000000000..0d8ba817d656 --- /dev/null +++ b/scripts/packaging/octez/debian/octez-node.config @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +# shellcheck disable=SC1091 +. /usr/share/debconf/confmodule +db_version 2.0 + +db_input high octez-node/configure || true +# shellcheck disable=SC2119 +db_go || true + +db_input high octez-node/history-mode || true +# shellcheck disable=SC2119 +db_go || true + +db_input high octez-node/network || true +# shellcheck disable=SC2119 +db_go || true diff --git a/scripts/packaging/octez/debian/octez-node.default b/scripts/packaging/octez/debian/octez-node.default new file mode 100644 index 000000000000..85640a0036ed --- /dev/null +++ b/scripts/packaging/octez/debian/octez-node.default @@ -0,0 +1,8 @@ +# Data Directory +# An independent mount point of /var/tezos is recommended +# +DATADIR=/var/tezos/.tezos-node + +# Other options to pass the node +# +RUNTIME_OPTS="" diff --git a/scripts/packaging/octez/debian/octez-node.install b/scripts/packaging/octez/debian/octez-node.install new file mode 100644 index 000000000000..c57da6b33602 --- /dev/null +++ b/scripts/packaging/octez/debian/octez-node.install @@ -0,0 +1,2 @@ +binaries/octez-node /usr/bin/ +binaries/octez-proxy-server /usr/bin/ diff --git a/scripts/packaging/octez/debian/octez-node.lintian-overrides b/scripts/packaging/octez/debian/octez-node.lintian-overrides new file mode 100644 index 000000000000..f1a40e97ce6a --- /dev/null +++ b/scripts/packaging/octez/debian/octez-node.lintian-overrides @@ -0,0 +1 @@ +octez-node: initial-upload-closes-no-bugs diff --git a/scripts/packaging/octez/debian/octez-node.logrotate b/scripts/packaging/octez/debian/octez-node.logrotate new file mode 100644 index 000000000000..098a023f60b0 --- /dev/null +++ b/scripts/packaging/octez/debian/octez-node.logrotate @@ -0,0 +1,8 @@ +/var/log/tezos/node.log{ + daily + # we use copytruncate to avoid stopping node. + copytruncate + rotate 5 + compress + minsize 1M +} diff --git a/scripts/packaging/octez/debian/octez-node.manpages b/scripts/packaging/octez/debian/octez-node.manpages new file mode 100644 index 000000000000..34988bcf7ca5 --- /dev/null +++ b/scripts/packaging/octez/debian/octez-node.manpages @@ -0,0 +1 @@ +manpages/octez-node.1 diff --git a/scripts/packaging/octez/debian/octez-node.postinst b/scripts/packaging/octez/debian/octez-node.postinst new file mode 100755 index 000000000000..bd79ac470cfd --- /dev/null +++ b/scripts/packaging/octez/debian/octez-node.postinst @@ -0,0 +1,56 @@ +#!/bin/sh + +set -e + +. /usr/share/debconf/confmodule + +db_version 2.0 + +HOME=/var/tezos + +case "${1}" in + configure) + # these are the defaults for the package and only used + # in the "configure" stage. + DATADIR="$HOME/.tezos-node" + + # shellcheck disable=SC2119 + if ! id "tezos" >/dev/null 2>&1; then + sudo adduser --quiet --disabled-password \ + --home $HOME --shell /bin/bash \ + --gecos "admin user for octez" tezos + mkdir -p /var/log/tezos + mkdir -p "$DATADIR" + chown tezos /var/log/tezos + chown tezos "$DATADIR" + fi + + db_get octez-node/configure + case "$RET" in + no) + db_get octez-node/network + NETWORK=${RET} + echo "NETWORK=${RET}" >> /etc/default/octez-node + db_get octez-node/history-mode + HISTORY_MODE=${RET} + echo "HISTORY_MODE=${RET}" >> /etc/default/octez-node + + if [ ! -e $DATADIR/config.json ]; then + su tezos -c "/usr/bin/octez-node config init --data-dir=$DATADIR\ + --network=\"$NETWORK\" \ + --history-mode=\"$HISTORY_MODE\" \ + --net-addr=\"[::]:9732\" \ + --rpc-addr=\"127.0.0.1:8732\"" + fi + ;; + *) + echo "Skipping initialization." + ;; + esac + ;; + *) + echo "postinst noop" + ;; +esac + +#DEBHELPER# diff --git a/scripts/packaging/octez/debian/octez-node.postrm b/scripts/packaging/octez/debian/octez-node.postrm new file mode 100755 index 000000000000..62811a6c38a7 --- /dev/null +++ b/scripts/packaging/octez/debian/octez-node.postrm @@ -0,0 +1,37 @@ +#!/bin/sh + +set -e + +# Load debconf library +# shellcheck disable=SC1091 +. /usr/share/debconf/confmodule + +case "${1}" in +purge) + + DATADIR=/var/tezos + # display a warning before proceding + db_get octez-node/purge_warning || true + case "$RET" in + "yes, please") + rm -Rf "$DATADIR" + deluser --quiet tezos || true + delgroup --quiet --only-if-empty tezos || true + rm -Rf /var/log/tezos + ;; + *) + echo "Not purging DATADIR. Octez-node data is intact" + ;; + esac + # Purge debconf data for the package in any case + # shellcheck disable=SC2119 + db_purge || true + ;; +remove | upgrade | failed-upgrade | abort-install | abort-upgrade | disappear) ;; +*) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/scripts/packaging/octez/debian/octez-node.prerm b/scripts/packaging/octez/debian/octez-node.prerm new file mode 100755 index 000000000000..841c2b346a37 --- /dev/null +++ b/scripts/packaging/octez/debian/octez-node.prerm @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +# shellcheck disable=SC1091 +. /usr/share/debconf/confmodule + +# make sure to ask this question +db_reset octez-node/purge_warning + +# display a warning before proceding +db_input critical octez-node/purge_warning || true +# shellcheck disable=SC2119 +db_go || true + +echo "Stopping octez-node" +sudo systemctl stop octez-node.service diff --git a/scripts/packaging/octez/debian/octez-node.service b/scripts/packaging/octez/debian/octez-node.service new file mode 100644 index 000000000000..037771911771 --- /dev/null +++ b/scripts/packaging/octez/debian/octez-node.service @@ -0,0 +1,14 @@ +[Unit] +Description=Octez-node +Documentation=https://tezos.gitlab.io/ +After=network.target + +[Service] +EnvironmentFile=-/etc/default/octez-node +WorkingDirectory=/var/tezos +Restart=on-failure +User=tezos +ExecStart=/usr/bin/octez-node run --data-dir $DATADIR --log-output /var/log/tezos/node.log $RUNTIME_OPTS + +[Install] +WantedBy=multi-user.target diff --git a/scripts/packaging/octez/debian/octez-node.templates b/scripts/packaging/octez/debian/octez-node.templates new file mode 100644 index 000000000000..5ebe6d26a7c3 --- /dev/null +++ b/scripts/packaging/octez/debian/octez-node.templates @@ -0,0 +1,39 @@ +Template: octez-node/history-mode +Type: string +Default: full +Description: The type of node you wish to install + - Full (default mode with 1 additional cycle). The node stores the minimal data + since the genesis required to reconstruct (or ‘replay’) the complete chain’s + ledger state. + - Archive: This is the heaviest mode as it keeps the whole chain data to be able + to query any information stored on the chain since the genesis. + It is particularly suitable for indexers or block explorers. + - Rolling: This is the lightest mode as it only maintains a minimal rolling + fragment of the chain data so the node can still validate new blocks and + synchronize with the head. + Source: https://tezos.gitlab.io/user/history_modes.html + +Template: octez-node/network +Type: string +Default: mainnet +Description: The network you want to connect to + - mainnet: + - testnet: + - ghostnet: + +Template: octez-node/purge_warning +Type: string +Default: no +Description: Do you really want to remove all data ? + This operation will remove all node data, the node + configuration and all associated files. Otherwise, + the node data will be left untouched, and only the + packages will be removed. + + Enter "yes, please" to confirm. + +Template: octez-node/configure +Type: string +Default: no +Description: Skipping node init ? + Enter "yes" to skip. diff --git a/scripts/packaging/octez/debian/octez-zcash-params.install b/scripts/packaging/octez/debian/octez-zcash-params.install new file mode 100644 index 000000000000..00defa6bcf43 --- /dev/null +++ b/scripts/packaging/octez/debian/octez-zcash-params.install @@ -0,0 +1 @@ +zcash-params/* usr/share/zcash-params diff --git a/scripts/packaging/octez/debian/rules b/scripts/packaging/octez/debian/rules new file mode 100755 index 000000000000..97bfd5f15561 --- /dev/null +++ b/scripts/packaging/octez/debian/rules @@ -0,0 +1,38 @@ +#!/usr/bin/make -f + +export DEB_BUILD_OPTIONS=noautodbgsym + +%: + dh $@ + +override_dh_auto_build: + binaries/octez-node --help=groff > manpages/octez-node.1 + dh_auto_build --parallel + +override_dh_builddeb: + dh_builddeb + cp debian/octez-node.lintian-overrides debian/octez-node/DEBIAN/ + +override_dh_installman: + dh_installman --name octez-node manpages/octez-node.1 + dh_installman --name octez-client manpages/octez-client.1 + +override_dh_installdocs: + dh_installdocs -p octez-node docs/README.octez-node + +override_dh_installsystemd: + dh_installsystemd --no-enable --no-start --name octez-node + +override_dh_installlogrotate: + dh_installlogrotate --package=octez-node + +override_dh_install: + dh_install + # Include debconf configuration + dh_installdebconf + +# avoid creating debug symbols +override_dh_dwz: + +override_dh_strip: + dh_strip -no-automatic-dbgsym diff --git a/scripts/packaging/octez/docs/README.octez-node b/scripts/packaging/octez/docs/README.octez-node new file mode 100644 index 000000000000..3b9922660ab1 --- /dev/null +++ b/scripts/packaging/octez/docs/README.octez-node @@ -0,0 +1,24 @@ +Optimizing Octez Node Setup: + +By default, the Octez node installation from this package connects +to the Tezos mainnet chain. It commences a bootstrap from scratch in archive +mode, offering full functionality but potentially demanding a substantial amount of +time and resources (currently < 100GB). + +For an expedited synchronization phase, it is recommended to accelerate the +process by downloading a fresh snapshot and initiating the node in +rolling mode. Refer to the "man octez-node" for detailed instructions or +consult the Octez documentation for guidance on configuring the node in rolling +mode. + +Execute the following command to obtain a new data directory: + + + curl -L -o snapshot + + octez-node snapshot import snapshot --block --data-dir /var/tezos/.tezos-node + +Check here the full documentation on how to import a snapshot: https://tezos.gitlab.io/user/snapshots.html#importing-a-snapshot + +The node is managed using systemd, with logs rotated daily through logrotate +and stored in /var/logs/tezos. diff --git a/scripts/packaging/octez/manpages/octez-client.1 b/scripts/packaging/octez/manpages/octez-client.1 new file mode 100644 index 000000000000..501fe5e0f0e1 --- /dev/null +++ b/scripts/packaging/octez/manpages/octez-client.1 @@ -0,0 +1,33 @@ +.TH OCTEZ-CLIENT 1 "January 2024" "Octez Client Manual" + +.SH NAME +octez-client \- Octez Command Line Interface + +.SH SYNOPSIS +.B octez-client +[\fIOPTION\fR]... \fI\fR [\fIARGS\fR]... + +.SH DESCRIPTION +.B octez-client +is the command line interface for interacting with the Octez blockchain. + +.SH OPTIONS +.TP +.B \-h, \-\-help +Display help information. + +.TP +.B \-\-version +Display version information. + +.SH SEE ALSO +Online Octez Documentation: https://tezos.gitlab.io/shell/cli-commands.html + +.SH AUTHOR +Nomadic Labs. + +.SH COPYRIGHT +Copyright \(co 2024 Nomadic Labs. + +.SH BUGS +Report bugs to: https://gitlab.com/tezos/tezos/-/issues -- GitLab