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

Commit

Permalink
Script for running local node and dump job (#532)
Browse files Browse the repository at this point in the history
  • Loading branch information
zliu41 committed Jun 22, 2022
1 parent 262eab6 commit b9adb83
Showing 1 changed file with 46 additions and 0 deletions.
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

0 comments on commit b9adb83

Please sign in to comment.