Skip to content

Commit

Permalink
Script for running a local node in buildkite
Browse files Browse the repository at this point in the history
  • Loading branch information
zliu41 committed Jun 22, 2022
1 parent ae81022 commit c7f40e1
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
47 changes: 47 additions & 0 deletions scripts/cardano-node.sh
@@ -0,0 +1,47 @@
#!/usr/bin/env bash

# Run a mainnet Cardano node.
# Example usage:
#
# NODE_BIN_DIR=../cardano-node-bin \
# NODE_DIR=../cardano-node
# ./scripts/cardano-node.sh

set -euo pipefail

node_zipped="cardano-node-1.34.1-linux.tar.gz"
node_config_files=(
"mainnet-config.json"
"mainnet-byron-genesis.json"
"mainnet-shelley-genesis.json"
"mainnet-alonzo-genesis.json"
"mainnet-topology.json"
)

trap 'kill $cardano_node_pid; exit' INT TERM QUIT ERR EXIT

set -x
mkdir -p "$NODE_BIN_DIR"
# Download cardano-node binary. The -nc option avoids downloading if the file
# already exists locally.
wget -nc https://hydra.iohk.io/build/13065769/download/1/$node_zipped -P "$NODE_BIN_DIR"

tar zxvf "$NODE_BIN_DIR"/$node_zipped -C "$NODE_BIN_DIR"

mkdir -p "$NODE_DIR"
# Download config files
for x in "${node_config_files[@]}"; do
wget -nc https://hydra.iohk.io/build/7370192/download/1/"$x" -P "$NODE_DIR"
done

# Launch node
"$NODE_BIN_DIR"/cardano-node run \
--config "$NODE_DIR"/mainnet-config.json \
--topology "$NODE_DIR"/mainnet-topology.json \
--database-path "$NODE_DIR"/db/ \
--socket-path "$NODE_DIR"/db/node.socket \
--host-addr 127.0.0.1 \
--port 1337 &

cardano_node_pid=$!
wait $cardano_node_pid
1 change: 1 addition & 0 deletions shell.nix
Expand Up @@ -103,6 +103,7 @@ let
shellcheck
sqlite-interactive
stack
wget
yq
z3
zlib
Expand Down

0 comments on commit c7f40e1

Please sign in to comment.