Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

PLT-333: Script for running local node and dump job #532

Merged
merged 1 commit into from
Jun 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions scripts/create-dump.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env bash

# Run a Cardano local node, and the script dump job
#
# Example usage:
# AWS_ACCESS_KEY_ID=<...> \
# AWS_SECRET_ACCESS_KEY=<...> \
# AWS_DEFAULT_REGION=<...> \
# AWS_ENDPOINT_URL=https://s3.devx.iog.io \
# NODE_DIR=../cardano-node-files \
# NODE_BIN_DIR=../cardano-node-bin \
# S3_DUMP_DIR=s3://plutus/mainnet-script-dump/ \
# LOCAL_DUMP_DIR=../mainnet-script-dump \
# ./scripts/create-dump.sh

set -eEuo pipefail

trap '(kill $pid_node || true); (kill $pid_dump || true); exit' INT TERM QUIT ERR EXIT

mkdir -p "$NODE_DIR"
mkdir -p "$NODE_BIN_DIR"
mkdir -p "$LOCAL_DUMP_DIR"

set -x

# Start running local node
./scripts/cardano-node.sh > /dev/null 2>&1 &

pid_node=$!

# If the local node is run for the first time, the config file needs to be downloaded,
# so here we wait until the config file is available.
while ! [ -f "$NODE_DIR"/mainnet-config.json ]
do
sleep 30
done

cabal update
# Start the dump job
cabal v2-run plutus-script-evaluation-test:dump-script-events -- --socket-path "$NODE_DIR"/db/node.socket --config "$NODE_DIR"/mainnet-config.json --mainnet --blocks-per-file 10000 --events-per-file 50000 --dir "$LOCAL_DUMP_DIR" &
pid_dump=$!

echo $pid_node
echo $pid_dump
wait $pid_dump
wait $pid_node