-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
178 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
# | ||
# Simplified interface to starting a full node | ||
# | ||
|
||
usage() { | ||
cat <<EOF | ||
Usage: $0 [mode] [leader_address]" | ||
mode Select operation mode: | ||
leader - Run a leader | ||
leader-cuda - Run a leader with CUDA | ||
validator - Run a validator | ||
validator-cuda - Run a validator with CUDA | ||
leader_address Address of the leader node to connect with. | ||
Only required when mode=validator or mode=validator-cuda | ||
EOF | ||
exit 1 | ||
} | ||
|
||
here="$(dirname "$0")" | ||
|
||
|
||
MODE= | ||
if [[ -n "$1" ]]; then | ||
MODE="$1" | ||
elif [[ -d $SNAP ]]; then # Running as a Linux Snap? | ||
MODE="$(snapctl get daemon)" | ||
fi | ||
[[ -n "$MODE" ]] || usage | ||
|
||
case $MODE in | ||
leader-cuda|leader) | ||
echo "Starting $MODE" | ||
# TODO: Run setup.sh here if necessary | ||
# TODO: Consider CUDA | ||
exec "$here"/leader.sh | ||
;; | ||
|
||
validator-cuda|validator) | ||
LEADER_ADDRESS=testnet.solana.com | ||
if [[ -n "$2" ]]; then | ||
LEADER_ADDRESS="$2" | ||
elif [[ -d $SNAP ]]; then # Running as a Linux Snap? | ||
LEADER_ADDRESS="$(snapctl get leader-address)" | ||
fi | ||
[[ -n "$LEADER_ADDRESS" ]] || usage | ||
|
||
# TODO: Run setup.sh here if necessary | ||
# TODO: Consider CUDA | ||
echo "Starting $MODE with leader address: $LEADER_ADDRESS" | ||
exec "$here"/validator.sh "$LEADER_ADDRESS" | ||
;; | ||
|
||
*) | ||
echo "Error: Unknown mode: $MODE" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash -e | ||
|
||
MODE="$(snapctl get daemon)" | ||
|
||
# Setup aliases to the normal solana command to make the reset of configure more | ||
# readable. | ||
shopt -s expand_aliases | ||
export SNAP SNAP_LIBRARY_PATH | ||
alias solana-mint-demo=$SNAP/command-mint-demo.wrapper | ||
alias solana-genesis-demo=$SNAP/command-genesis-demo.wrapper | ||
alias solana-fullnode-config=$SNAP/command-fullnode-config.wrapper | ||
|
||
echo Stopping daemon | ||
snapctl stop --disable solana.daemon | ||
if [[ -n "$MODE" ]]; then | ||
|
||
# | ||
# TODO: Merge this file with ../../../multinode-demo/setup.sh | ||
# | ||
|
||
NUM_TOKENS=1000000000 | ||
|
||
echo Cleaning $SNAP_DATA | ||
rm -rvf $SNAP_DATA/* | ||
|
||
echo Creating $SNAP_DATA/mint-demo.json | ||
solana-mint-demo <<<"$NUM_TOKENS" > $SNAP_DATA/mint-demo.json | ||
|
||
echo Creating $SNAP_DATA/genesis.log | ||
solana-genesis-demo < $SNAP_DATA/mint-demo.json > $SNAP_DATA/genesis.log | ||
|
||
echo Creating $SNAP_DATA/leader.json | ||
solana-fullnode-config -d > $SNAP_DATA/leader.json | ||
|
||
echo Creating $SNAP_DATA/validator.json | ||
solana-fullnode-config -d -b 9000 > $SNAP_DATA/validator.json | ||
|
||
echo Starting daemon as $MODE | ||
snapctl start --enable solana.daemon | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters