Skip to content

Commit

Permalink
A0-3432: run_nodes.sh revamp, in particular run bootnode as RPC node (#…
Browse files Browse the repository at this point in the history
…1472)

# Description

This PR revamps `scripts/run_nodes.sh` so that
* there are only two categories of nodes: RPC node and validator node
* boot node is always the first RPC node
* number of either node type is configurable, but sum must not exceed
10,
* script cmd line args was reworked which is a breaking change
* by default, script ideas all the following: builds `aleph-node`,
bootstraps chain, purges db, removes AlephBFT backups. User can opt-out
from either of these, but obviously some of them must be present if
others are etc, so the script checks all that
* script now logs with timestamps and colors, which is justifies as the
script is not intended to run in CI
* as the script is a front card of our repo and most likely the first
point of contact with the new user, it contains now a compact intro
to chain bootstrap in general
* `jq` is now needed, though is not hard blocker for me to revert to
previous behaviour, now it is just cleaner in bash to parse output of
`aleph-node key inspect`
* base path default was changed from `/tmp/` to local `./run-nodes-sh`,
this is because the user must have write permissions in the repo he or
she just cloned, and it's better to have a base path that is not shared
with any other files/dirs.
* arguments were synced with `docker/docker_entrypoint.sh`; they are
indeed duplicated now but it does not make sense to extract them to
common .sh as at some point `run_nodes.sh` might become obsolete due to
dockerization

## Type of change

Please delete options that are not relevant.

- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing
functionality to not work as expected)
  • Loading branch information
Marcin-Radecki authored Nov 6, 2023
1 parent 4f085b2 commit 21ead16
Show file tree
Hide file tree
Showing 4 changed files with 315 additions and 123 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ __pycache__/

# ink!
contracts/addresses.json

# run_nodes.sh
run-nodes-local/
22 changes: 22 additions & 0 deletions scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,25 @@ function get_last_block() {
done
printf "%d" $last_block
}

NORMAL=$(tput sgr0)
GREEN=$(tput setaf 2; tput bold)
YELLOW=$(tput setaf 3)
RED=$(tput setaf 1)

function get_timestamp() {
echo "$(date +'%Y-%m-%d %T:%3N')"
}

function error() {
echo -e "$(get_timestamp) $RED$*$NORMAL"
exit 1
}

function info() {
echo -e "$(get_timestamp) $GREEN$*$NORMAL"
}

function warning() {
echo -e "$(get_timestamp) $YELLOW$*$NORMAL"
}
Loading

0 comments on commit 21ead16

Please sign in to comment.