Skip to content

Commit

Permalink
[node.sh] use rclone to fast sync harmony_db_0 (#2709)
Browse files Browse the repository at this point in the history
Signed-off-by: Leo Chen <leo@harmony.one>
  • Loading branch information
Leo Chen authored Apr 5, 2020
1 parent 05f2e20 commit 8f5f287
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion scripts/node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ do
done
shift $((${OPTIND} - 1))

unset -v bootnodes REL network_type dns_zone
unset -v bootnodes REL network_type dns_zone syncdir

case "${node_type}" in
validator) ;;
Expand All @@ -268,6 +268,7 @@ mainnet)
REL=mainnet
network_type=mainnet
dns_zone=t.hmny.io
syncdir=mainnet.min
;;
testnet) # TODO: update Testnet configs once LRTN is upgraded
bootnodes=(
Expand All @@ -277,6 +278,7 @@ testnet) # TODO: update Testnet configs once LRTN is upgraded
REL=testnet
network_type=testnet
dns_zone=p.hmny.io
syncdir=lrtn
;;
staking)
bootnodes=(
Expand All @@ -286,6 +288,7 @@ staking)
REL=pangaea
network_type=pangaea
dns_zone=os.hmny.io
syncdir=ostn
;;
partner)
bootnodes=(
Expand All @@ -295,6 +298,7 @@ partner)
REL=partner
network_type=partner
dns_zone=ps.hmny.io
syncdir=pstn
;;
stress)
bootnodes=(
Expand All @@ -303,6 +307,7 @@ stress)
REL=stressnet
network_type=stressnet
dns_zone=stn.hmny.io
syncdir=stn
;;
devnet)
bootnodes=(
Expand All @@ -312,6 +317,7 @@ devnet)
REL=devnet
network_type=devnet
dns_zone=pga.hmny.io
syncdir=devnet
;;
*)
err 64 "${network}: invalid network"
Expand Down Expand Up @@ -631,6 +637,24 @@ then
mv -f harmony_db_* latest .dht* "${backup_dir}/" 2>/dev/null || :
rm -rf latest
fi

# do rclone sync
if ! which rclone > /dev/null; then
msg "installing rclone to fast sync db"
msg "curl https://rclone.org/install.sh | sudo bash"
curl https://rclone.org/install.sh | sudo bash
mkdir -p ~/.config/rclone
cat<<-EOT>~/.config/rclone/rclone.conf
[hmy]
type = s3
provider = AWS
env_auth = false
region = us-west-1
acl = public-read
EOT
fi
msg "Syncing harmony_db_0"
rclone sync -P hmy://pub.harmony.one/$syncdir/harmony_db_0 harmony_db_0
fi
mkdir -p latest
Expand Down

0 comments on commit 8f5f287

Please sign in to comment.