Skip to content

Commit

Permalink
[ADP-3387] Add preprod bootup scripts and E2E full syncs (#4680)
Browse files Browse the repository at this point in the history
- [x] Add preprod run scripts via docker and nix
- [x] Add full sync preprod E2E checks to run on release build

ADP-3387
  • Loading branch information
paolino authored Jul 15, 2024
2 parents fe8a171 + b294ff1 commit b842aed
Show file tree
Hide file tree
Showing 12 changed files with 124 additions and 19 deletions.
82 changes: 63 additions & 19 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -537,34 +563,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
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
40 changes: 40 additions & 0 deletions run/common/snapshot.sh
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions run/preprod/docker/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NETWORK="preprod"
1 change: 1 addition & 0 deletions run/preprod/docker/configs
1 change: 1 addition & 0 deletions run/preprod/docker/docker-compose.yml
1 change: 1 addition & 0 deletions run/preprod/docker/run.sh
1 change: 1 addition & 0 deletions run/preprod/docker/snapshot.sh
1 change: 1 addition & 0 deletions run/preprod/nix/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NETWORK="preprod"
1 change: 1 addition & 0 deletions run/preprod/nix/configs
1 change: 1 addition & 0 deletions run/preprod/nix/run.sh
1 change: 1 addition & 0 deletions run/preprod/nix/snapshot.sh

0 comments on commit b842aed

Please sign in to comment.