|
|
|
@ -103,6 +103,8 @@ usage: ${progname} [-1ch] [-k KEYFILE] |
|
|
|
|
-p passfile use the given BLS passphrase file |
|
|
|
|
-D do not download Harmony binaries (default: download when start) |
|
|
|
|
-m collect and upload node metrics to harmony prometheus + grafana |
|
|
|
|
-N network join the given network (main, beta, pangaea; default: main) |
|
|
|
|
-t equivalent to -N pangaea (deprecated) |
|
|
|
|
|
|
|
|
|
example: |
|
|
|
|
|
|
|
|
@ -117,17 +119,18 @@ usage() { |
|
|
|
|
exit 64 # EX_USAGE |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
unset start_clean loop run_as_root blspass do_not_download |
|
|
|
|
unset start_clean loop run_as_root blspass do_not_download metrics network |
|
|
|
|
start_clean=false |
|
|
|
|
loop=true |
|
|
|
|
run_as_root=true |
|
|
|
|
do_not_download=false |
|
|
|
|
metrics=false |
|
|
|
|
network=main |
|
|
|
|
${BLSKEYFILE=} |
|
|
|
|
|
|
|
|
|
unset OPTIND OPTARG opt |
|
|
|
|
OPTIND=1 |
|
|
|
|
while getopts :1chk:sSp:D opt |
|
|
|
|
while getopts :1chk:sSp:DmN:t opt |
|
|
|
|
do |
|
|
|
|
case "${opt}" in |
|
|
|
|
'?') usage "unrecognized option -${OPTARG}";; |
|
|
|
@ -141,11 +144,53 @@ do |
|
|
|
|
p) blspass="${OPTARG}";; |
|
|
|
|
D) do_not_download=true;; |
|
|
|
|
m) metrics=true;; |
|
|
|
|
N) network="${OPTARG}";; |
|
|
|
|
t) network=pangaea;; |
|
|
|
|
*) err 70 "unhandled option -${OPTARG}";; # EX_SOFTWARE |
|
|
|
|
esac |
|
|
|
|
done |
|
|
|
|
shift $((${OPTIND} - 1)) |
|
|
|
|
|
|
|
|
|
unset -v bootnodes REL network_type dns_zone |
|
|
|
|
|
|
|
|
|
case "${network}" in |
|
|
|
|
main) |
|
|
|
|
bootnodes=( |
|
|
|
|
/ip4/100.26.90.187/tcp/9874/p2p/Qmdfjtk6hPoyrH1zVD9PEH4zfWLo38dP2mDvvKXfh3tnEv |
|
|
|
|
/ip4/54.213.43.194/tcp/9874/p2p/QmZJJx6AdaoEkGLrYG4JeLCKeCKDjnFz2wfHNHxAqFSGA9 |
|
|
|
|
/ip4/13.113.101.219/tcp/12019/p2p/QmQayinFSgMMw5cSpDUiD9pQ2WeP6WNmGxpZ6ou3mdVFJX |
|
|
|
|
/ip4/99.81.170.167/tcp/12019/p2p/QmRVbTpEYup8dSaURZfF6ByrMTSKa4UyUzJhSjahFzRqNj |
|
|
|
|
) |
|
|
|
|
REL=r3 |
|
|
|
|
network_type=mainnet |
|
|
|
|
dns_zone=t.hmny.io |
|
|
|
|
;; |
|
|
|
|
beta) |
|
|
|
|
bootnodes=( |
|
|
|
|
/ip4/54.213.43.194/tcp/9868/p2p/QmZJJx6AdaoEkGLrYG4JeLCKeCKDjnFz2wfHNHxAqFSGA9 |
|
|
|
|
/ip4/100.26.90.187/tcp/9868/p2p/Qmdfjtk6hPoyrH1zVD9PEH4zfWLo38dP2mDvvKXfh3tnEv |
|
|
|
|
/ip4/13.113.101.219/tcp/12018/p2p/QmQayinFSgMMw5cSpDUiD9pQ2WeP6WNmGxpZ6ou3mdVFJX |
|
|
|
|
) |
|
|
|
|
REL=testnet |
|
|
|
|
network_type=testnet |
|
|
|
|
dns_zone= |
|
|
|
|
;; |
|
|
|
|
pangaea) |
|
|
|
|
bootnodes=( |
|
|
|
|
/ip4/100.26.90.187/tcp/9867/p2p/Qmdfjtk6hPoyrH1zVD9PEH4zfWLo38dP2mDvvKXfh3tnEv |
|
|
|
|
/ip4/54.213.43.194/tcp/9867/p2p/QmZJJx6AdaoEkGLrYG4JeLCKeCKDjnFz2wfHNHxAqFSGA9 |
|
|
|
|
/ip4/13.113.101.219/tcp/9867/p2p/QmQayinFSgMMw5cSpDUiD9pQ2WeP6WNmGxpZ6ou3mdVFJX |
|
|
|
|
/ip4/99.81.170.167/tcp/9867/p2p/QmRVbTpEYup8dSaURZfF6ByrMTSKa4UyUzJhSjahFzRqNj |
|
|
|
|
) |
|
|
|
|
REL=master |
|
|
|
|
network_type=pangaea |
|
|
|
|
dns_zone=p.hmny.io |
|
|
|
|
;; |
|
|
|
|
*) |
|
|
|
|
err 64 "${network}: invalid network" |
|
|
|
|
;; |
|
|
|
|
esac |
|
|
|
|
|
|
|
|
|
case $# in |
|
|
|
|
[1-9]*) |
|
|
|
|
usage "extra arguments at the end ($*)" |
|
|
|
@ -188,7 +233,6 @@ esac |
|
|
|
|
|
|
|
|
|
BUCKET=pub.harmony.one |
|
|
|
|
OS=$(uname -s) |
|
|
|
|
REL=r3 |
|
|
|
|
|
|
|
|
|
if [ "$OS" == "Darwin" ]; then |
|
|
|
|
FOLDER=release/darwin-x86_64/$REL/ |
|
|
|
@ -235,8 +279,11 @@ fi |
|
|
|
|
# find my public ip address |
|
|
|
|
myip |
|
|
|
|
|
|
|
|
|
# public boot node multiaddress |
|
|
|
|
BN_MA=/ip4/100.26.90.187/tcp/9874/p2p/Qmdfjtk6hPoyrH1zVD9PEH4zfWLo38dP2mDvvKXfh3tnEv,/ip4/54.213.43.194/tcp/9874/p2p/QmZJJx6AdaoEkGLrYG4JeLCKeCKDjnFz2wfHNHxAqFSGA9,/ip4/13.113.101.219/tcp/12019/p2p/QmQayinFSgMMw5cSpDUiD9pQ2WeP6WNmGxpZ6ou3mdVFJX,/ip4/99.81.170.167/tcp/12019/p2p/QmRVbTpEYup8dSaURZfF6ByrMTSKa4UyUzJhSjahFzRqNj |
|
|
|
|
unset -v BN_MA bn |
|
|
|
|
for bn in "${bootnodes[@]}" |
|
|
|
|
do |
|
|
|
|
BN_MA="${BN_MA+"${BN_MA},"}${bn}" |
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
if ${start_clean} |
|
|
|
|
then |
|
|
|
@ -364,20 +411,35 @@ fi |
|
|
|
|
while : |
|
|
|
|
do |
|
|
|
|
msg "############### Running Harmony Process ###############" |
|
|
|
|
if [ "$OS" == "Linux" ]; then |
|
|
|
|
# Run Harmony Node |
|
|
|
|
if [ -z "${blspass}" ]; then |
|
|
|
|
echo -n "${passphrase}" | LD_LIBRARY_PATH=$(pwd) ./harmony -bootnodes $BN_MA -ip $PUB_IP -port $NODE_PORT -is_genesis -blskey_file "${BLSKEYFILE}" -blspass stdin -metrics $METRICS -pushgateway_ip $PUSHGATEWAY_IP -pushgateway_port $PUSHGATEWAY_PORT |
|
|
|
|
else |
|
|
|
|
LD_LIBRARY_PATH=$(pwd) ./harmony -bootnodes $BN_MA -ip $PUB_IP -port $NODE_PORT -is_genesis -blskey_file "${BLSKEYFILE}" -blspass file:${blspass} -metrics $METRICS -pushgateway_ip $PUSHGATEWAY_IP -pushgateway_port $PUSHGATEWAY_PORT |
|
|
|
|
fi |
|
|
|
|
else |
|
|
|
|
if [ -z "${blspass}" ]; then |
|
|
|
|
echo -n "${passphrase}" | DYLD_FALLBACK_LIBRARY_PATH=$(pwd) ./harmony -bootnodes $BN_MA -ip $PUB_IP -port $NODE_PORT -is_genesis -blskey_file "${BLSKEYFILE}" -blspass stdin -metrics $METRICS -pushgateway_ip $PUSHGATEWAY_IP -pushgateway_port $PUSHGATEWAY_PORT |
|
|
|
|
else |
|
|
|
|
DYLD_FALLBACK_LIBRARY_PATH=$(pwd) ./harmony -bootnodes $BN_MA -ip $PUB_IP -port $NODE_PORT -is_genesis -blskey_file "${BLSKEYFILE}" -blspass file:${blspass} -metrics $METRICS -pushgateway_ip $PUSHGATEWAY_IP -pushgateway_port $PUSHGATEWAY_PORT |
|
|
|
|
fi |
|
|
|
|
fi || msg "node process finished with status $?" |
|
|
|
|
args=( |
|
|
|
|
-bootnodes "${BN_MA}" |
|
|
|
|
-ip "${PUB_IP}" |
|
|
|
|
-port "${NODE_PORT}" |
|
|
|
|
-is_genesis |
|
|
|
|
-blskey_file "${BLSKEYFILE}" |
|
|
|
|
-network_type="${network_type}" |
|
|
|
|
-dns_zone="${dns_zone}" |
|
|
|
|
) |
|
|
|
|
case "${metrics}" in |
|
|
|
|
true) |
|
|
|
|
args+=( |
|
|
|
|
-metrics "${metrics}" |
|
|
|
|
-pushgateway_ip "${PUSHGATEWAY_IP}" |
|
|
|
|
-pushgateway_port "${PUSHGATEWAY_PORT}" |
|
|
|
|
) |
|
|
|
|
;; |
|
|
|
|
esac |
|
|
|
|
case "$OS" in |
|
|
|
|
Darwin) ld_path_var=DYLD_FALLBACK_LIBRARY_PATH;; |
|
|
|
|
*) ld_path_var=LD_LIBRARY_PATH;; |
|
|
|
|
esac |
|
|
|
|
run() { |
|
|
|
|
env "${ld_path_var}=$(pwd)" ./harmony "${args[@]}" "${@}" |
|
|
|
|
} |
|
|
|
|
case "${blspass:+set}" in |
|
|
|
|
"") echo -n "${passphrase}" | run -blspass stdin;; |
|
|
|
|
*) run -blspass file:${blspass};; |
|
|
|
|
esac || msg "node process finished with status $?" |
|
|
|
|
${loop} || break |
|
|
|
|
msg "restarting in 10s..." |
|
|
|
|
sleep 10 |
|
|
|
|