Add a node-specific ip echo service to remove dependency on ifconfig.co (#4137)

This commit is contained in:
Michael Vines
2019-05-03 11:01:35 -07:00
committed by GitHub
parent c8ed41167a
commit 7fe3c75c6b
21 changed files with 239 additions and 325 deletions

View File

@ -44,17 +44,18 @@ bootstrap_leader_vote_id_path="$SOLANA_CONFIG_DIR"/bootstrap-leader-vote-id.json
bootstrap_leader_vote_id=$($solana_keygen pubkey "$bootstrap_leader_vote_id_path")
trap 'kill "$pid" && wait "$pid"' INT TERM ERR
$program \
--identity "$bootstrap_leader_id_path" \
--voting-keypair "$bootstrap_leader_vote_id_path" \
--vote-account "$bootstrap_leader_vote_id" \
--ledger "$SOLANA_CONFIG_DIR"/bootstrap-leader-ledger \
--accounts "$SOLANA_CONFIG_DIR"/bootstrap-leader-accounts \
--gossip-port 8001 \
--rpc-port 8899 \
--rpc-drone-address 127.0.0.1:9900 \
"${extra_fullnode_args[@]}" \
> >($bootstrap_leader_logger) 2>&1 &
default_fullnode_arg --identity "$bootstrap_leader_id_path"
default_fullnode_arg --voting-keypair "$bootstrap_leader_vote_id_path"
default_fullnode_arg --vote-account "$bootstrap_leader_vote_id"
default_fullnode_arg --ledger "$SOLANA_CONFIG_DIR"/bootstrap-leader-ledger
default_fullnode_arg --accounts "$SOLANA_CONFIG_DIR"/bootstrap-leader-accounts
default_fullnode_arg --rpc-port 8899
default_fullnode_arg --rpc-drone-address 127.0.0.1:9900
default_fullnode_arg --gossip-port 8001
echo "$PS4 $program ${extra_fullnode_args[*]}"
$program "${extra_fullnode_args[@]}" > >($bootstrap_leader_logger) 2>&1 &
pid=$!
oom_score_adj "$pid" 1000

View File

@ -82,7 +82,6 @@ Start a full node
--label LABEL - Append the given label to the fullnode configuration files, useful when running
multiple fullnodes from the same filesystem location
--stake LAMPORTS - Number of lamports to stake
--public-address - advertise public machine address in gossip. By default the local machine address is advertised
--no-voting - start node without vote signer
--rpc-port port - custom RPC port for this node

View File

@ -34,9 +34,6 @@ while [[ ${1:0:1} = - ]]; do
elif [[ $1 = --init-complete-file ]]; then
extra_fullnode_args+=("$1" "$2")
shift 2
elif [[ $1 = --public-address ]]; then
extra_fullnode_args+=("$1")
shift
elif [[ $1 = --stake ]]; then
stake="$2"
shift 2
@ -64,3 +61,20 @@ done
if [[ -n $3 ]]; then
fullnode_usage "$@"
fi
default_fullnode_arg() {
declare name=$1
declare value=$2
for arg in "${extra_fullnode_args[@]}"; do
if [[ $arg = "$name" ]]; then
return
fi
done
if [[ -n $value ]]; then
extra_fullnode_args+=("$name" "$value")
else
extra_fullnode_args+=("$name")
fi
}

View File

@ -164,23 +164,21 @@ while true; do
if ((stake)); then
setup_vote_account "${leader_address%:*}" "$fullnode_id_path" "$fullnode_vote_id_path" "$stake"
fi
set +x
$program \
--identity "$fullnode_id_path" \
--voting-keypair "$fullnode_vote_id_path" \
--vote-account "$fullnode_vote_id" \
--network "$leader_address" \
--ledger "$ledger_config_dir" \
--accounts "$accounts_config_dir" \
--rpc-drone-address "${leader_address%:*}:9900" \
"${extra_fullnode_args[@]}" \
> >($fullnode_logger) 2>&1 &
default_fullnode_arg --identity "$fullnode_id_path"
default_fullnode_arg --voting-keypair "$fullnode_vote_id_path"
default_fullnode_arg --vote-account "$fullnode_vote_id"
default_fullnode_arg --network "$leader_address"
default_fullnode_arg --ledger "$ledger_config_dir"
default_fullnode_arg --accounts "$accounts_config_dir"
default_fullnode_arg --rpc-drone-address "${leader_address%:*}:9900"
echo "$PS4 $program ${extra_fullnode_args[*]}"
$program "${extra_fullnode_args[@]}" > >($fullnode_logger) 2>&1 &
pid=$!
oom_score_adj "$pid" 1000
set +x
while true; do
if ! kill -0 "$pid"; then
wait "$pid"
exit 0