diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index cb143c9322d..8792c730db4 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -143,6 +143,22 @@ steps: concurrency: 1 concurrency_group: 'linux-e2e-tests' + - label: Private Network Full Sync + depends_on: linux-nix + timeout: 20 + command: | + rm -rf run/private/nix/logs + mkdir -p run/private/nix/logs + rm -rf run/private/nix/databases + cd run/private/nix && ./run.sh sync + artifact_paths: + - "./run/private/nix/logs/*" + agents: + system: x86_64-linux + env: + NODE_LOGS_FILE: ./logs/node.log + WALLET_LOGS_FILE: ./logs/wallet.log + - block: Sanchonet Full Sync if: build.env("RELEASE_CANDIDATE") == null depends_on: linux-nix @@ -166,22 +182,32 @@ steps: NODE_LOGS_FILE: ./logs/node.log WALLET_LOGS_FILE: ./logs/wallet.log - - label: Private Network Full Sync + - block: Preprod Full Sync + if: build.env("RELEASE_CANDIDATE") == null depends_on: linux-nix - timeout: 20 + key: linux-preprod-full-sync-block + + - label: Preprod Full Sync + depends_on: + - linux-nix + - linux-preprod-full-sync-block + timeout_in_minutes: 240 command: | - rm -rf run/private/nix/logs - mkdir -p run/private/nix/logs - rm -rf run/private/nix/databases - cd run/private/nix && ./run.sh sync + cd run/preprod/nix + rm -rf logs + mkdir -p logs + rm -rf databases + ./snapshot.sh + ./run.sh sync artifact_paths: - - "./run/private/nix/logs/*" + - "./run/preprod/nix/logs/*" agents: system: x86_64-linux env: NODE_LOGS_FILE: ./logs/node.log WALLET_LOGS_FILE: ./logs/wallet.log + - group: Code Quality Checks key: code-quality steps: @@ -523,34 +549,52 @@ steps: concurrency: 1 concurrency_group: 'docker' + - label: Private Network Full Sync + depends_on: + - docker-build + timeout: 20 + command: | + rm -rf run/private/docker/databases + cd run/private/docker && ./run.sh sync + agents: + system: x86_64-linux + concurrency: 1 + concurrency_group: 'docker' + - block: Sanchonet Full Sync if: build.env("RELEASE_CANDIDATE") == null - depends_on: docker-build + depends_on: + - docker-build key: docker-sanchonet-full-sync-block - label: Sanchonet Full Sync - key: docker-smoke-test-full-sync depends_on: - docker-sanchonet-full-sync-block timeout_in_minutes: 240 command: | rm -rf run/sanchonet/docker/databases cd run/sanchonet/docker && ./run.sh sync - artifact_paths: - - "./run/sanchonet/docker/logs/*" agents: - system: x85_64-linux + system: x86_64-linux concurrency: 1 concurrency_group: 'docker' - - label: Private Network Full Sync - depends_on: docker-build - timeout: 20 + - block: Preprod Full Sync + if: build.env("RELEASE_CANDIDATE") == null + depends_on: + - docker-build + key: docker-preprod-full-sync-block + + - label: Preprod Full Sync + depends_on: + - docker-preprod-full-sync-block + timeout_in_minutes: 240 command: | - rm -rf run/private/docker/databases - cd run/private/docker && ./run.sh sync - artifact_paths: - - "./run/private/docker/logs/*" + rm -rf run/preprod/docker/databases + cd run/preprod/docker + # necessary to avoid the broken network + ./snapshot.sh + ./run.sh sync agents: system: x86_64-linux concurrency: 1 diff --git a/README.md b/README.md index 1f918600b59..f88c209e619 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,18 @@ On `mainnet`, the Minimum System Requirements for a `cardano-node` are high: - 200GB of disk space (for the history of blocks) - 24GB of RAM (for the current UTxO set) +### Running on preprod + +Preprod network is broken for node 9.0.0 at some block in the past. +One way to overcome that limitation is to download a snapshot that used an old version node (1.35.2) +to trespass that point. +Use `snpashot.sh` to download the snapshot. + +```bash +cd run/preprod/docker +./snapshot.sh +./run.sh sync +``` ## Obtaining `cardano-wallet` diff --git a/run/common/snapshot.sh b/run/common/snapshot.sh new file mode 100755 index 00000000000..f5b9814a857 --- /dev/null +++ b/run/common/snapshot.sh @@ -0,0 +1,40 @@ +#! /usr/bin/env -S nix shell 'nixpkgs#curl' 'nixpkgs#lz4' 'nixpkgs#gnutar' --command bash +# shellcheck shell=bash + +set -euo pipefail + +# shellcheck disable=SC1091 +source .env + +# Define a local db if NODE_DB is not set +if [[ -z "${NODE_DB-}" ]]; then + LOCAL_NODE_DB=./databases/node-db + mkdir -p $LOCAL_NODE_DB + NODE_DB=$LOCAL_NODE_DB +fi + +# Clean the db directory +rm -rf "${NODE_DB:?}"/* + +echo "Network: $NETWORK" + +case "$NETWORK" in + preprod) + SNAPSHOT_NAME=$(curl -s https://downloads.csnapshots.io/testnet/testnet-db-snapshot.json| jq -r .[].file_name ) + echo "Snapshot name: $SNAPSHOT_NAME" + SNAPSHOT_URL="https://downloads.csnapshots.io/testnet/$SNAPSHOT_NAME" + ;; + *) + echo "Error: Invalid network $NETWORK" + exit 1 + ;; +esac + +echo "Downloading the snapshot..." + +curl -SL "$SNAPSHOT_URL" | lz4 -c -d - | tar -x -C "$NODE_DB" + +mv -f "$NODE_DB"/db/* "$NODE_DB"/ +rm -rf "$NODE_DB"/db + +echo "Snapshot downloaded and extracted to $NODE_DB" diff --git a/run/preprod/docker/.env b/run/preprod/docker/.env new file mode 100644 index 00000000000..cb68696ae98 --- /dev/null +++ b/run/preprod/docker/.env @@ -0,0 +1 @@ +NETWORK="preprod" diff --git a/run/preprod/docker/configs b/run/preprod/docker/configs new file mode 120000 index 00000000000..0456cd8e3d5 --- /dev/null +++ b/run/preprod/docker/configs @@ -0,0 +1 @@ +../../../configs/cardano/preprod/ \ No newline at end of file diff --git a/run/preprod/docker/docker-compose.yml b/run/preprod/docker/docker-compose.yml new file mode 120000 index 00000000000..c984ebb6b07 --- /dev/null +++ b/run/preprod/docker/docker-compose.yml @@ -0,0 +1 @@ +../../common/docker/docker-compose.yml \ No newline at end of file diff --git a/run/preprod/docker/run.sh b/run/preprod/docker/run.sh new file mode 120000 index 00000000000..917564fe878 --- /dev/null +++ b/run/preprod/docker/run.sh @@ -0,0 +1 @@ +../../common/docker/run.sh \ No newline at end of file diff --git a/run/preprod/docker/snapshot.sh b/run/preprod/docker/snapshot.sh new file mode 120000 index 00000000000..ce506a7c77e --- /dev/null +++ b/run/preprod/docker/snapshot.sh @@ -0,0 +1 @@ +../../common/snapshot.sh \ No newline at end of file diff --git a/run/preprod/nix/.env b/run/preprod/nix/.env new file mode 100644 index 00000000000..cb68696ae98 --- /dev/null +++ b/run/preprod/nix/.env @@ -0,0 +1 @@ +NETWORK="preprod" diff --git a/run/preprod/nix/configs b/run/preprod/nix/configs new file mode 120000 index 00000000000..0456cd8e3d5 --- /dev/null +++ b/run/preprod/nix/configs @@ -0,0 +1 @@ +../../../configs/cardano/preprod/ \ No newline at end of file diff --git a/run/preprod/nix/run.sh b/run/preprod/nix/run.sh new file mode 120000 index 00000000000..bba5f1e4434 --- /dev/null +++ b/run/preprod/nix/run.sh @@ -0,0 +1 @@ +../../common/nix/run.sh \ No newline at end of file diff --git a/run/preprod/nix/snapshot.sh b/run/preprod/nix/snapshot.sh new file mode 120000 index 00000000000..ce506a7c77e --- /dev/null +++ b/run/preprod/nix/snapshot.sh @@ -0,0 +1 @@ +../../common/snapshot.sh \ No newline at end of file