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

Commit 3160279

Browse files
committed
Script for running local node and dump job (#532)
1 parent 953769d commit 3160279

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

scripts/create-dump.sh

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
3+
# Run a Cardano local node, and the script dump job
4+
#
5+
# Example usage:
6+
# AWS_ACCESS_KEY_ID=<...> \
7+
# AWS_SECRET_ACCESS_KEY=<...> \
8+
# AWS_DEFAULT_REGION=<...> \
9+
# AWS_ENDPOINT_URL=https://s3.devx.iog.io \
10+
# NODE_DIR=../cardano-node-files \
11+
# NODE_BIN_DIR=../cardano-node-bin \
12+
# S3_DUMP_DIR=s3://plutus/mainnet-script-dump/ \
13+
# LOCAL_DUMP_DIR=../mainnet-script-dump \
14+
# ./scripts/create-dump.sh
15+
16+
set -eEuo pipefail
17+
18+
trap '(kill $pid_node || true); (kill $pid_dump || true); exit' INT TERM QUIT ERR EXIT
19+
20+
mkdir -p "$NODE_DIR"
21+
mkdir -p "$NODE_BIN_DIR"
22+
mkdir -p "$LOCAL_DUMP_DIR"
23+
24+
set -x
25+
26+
# Start running local node
27+
./scripts/cardano-node.sh > /dev/null 2>&1 &
28+
29+
pid_node=$!
30+
31+
# If the local node is run for the first time, the config file needs to be downloaded,
32+
# so here we wait until the config file is available.
33+
while ! [ -f "$NODE_DIR"/mainnet-config.json ]
34+
do
35+
sleep 30
36+
done
37+
38+
cabal update
39+
# Start the dump job
40+
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" &
41+
pid_dump=$!
42+
43+
echo $pid_node
44+
echo $pid_dump
45+
wait $pid_dump
46+
wait $pid_node

0 commit comments

Comments
 (0)