Skip to content

Commit

Permalink
Base. Refactoring snapshot download.
Browse files Browse the repository at this point in the history
  • Loading branch information
vlasonfa committed May 16, 2024
1 parent c800879 commit 05bcdd6
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ while (( BASE_SNAPSHOT_DOWNLOAD_STATUS != 0 ))
do
PIDS=$(pgrep wget)
if [ -z "$PIDS" ]; then
wget --continue --retry-connrefused --waitretry=66 --read-timeout=20 --output-document$BASE_SNAPSHOT_DIR/$BASE_SNAPSHOT_FILE_NAME -o download.log -t 0 $SNAPSHOT_URL
wget --continue --retry-connrefused --waitretry=66 --read-timeout=20 --output-document $BASE_SNAPSHOT_DIR/$BASE_SNAPSHOT_FILE_NAME -nv -o download.log -t 0 $SNAPSHOT_URL
fi
BASE_SNAPSHOT_DOWNLOAD_STATUS=$?
pid=$(pidof wget)
Expand Down Expand Up @@ -53,7 +53,3 @@ rm -rf /data/snapshots && \
rm -rf /data/$BASE_SNAPSHOT_FILE_NAME

echo "Processed snapshot"

chown -R bcuser:bcuser /data && \
sudo su bcuser && \
/usr/local/bin/docker-compose -f /home/bcuser/node/docker-compose.yml up -d
10 changes: 9 additions & 1 deletion lib/base/lib/assets/user-data/node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,15 @@ if [ "$RESTORE_FROM_SNAPSHOT" == "false" ]; then
else
echo "Restoring data from snapshot"
chmod 766 /opt/start-from-snapshot.sh
echo "/opt/start-from-snapshot.sh" | at now +3 minutes
/opt/download-snapshot.sh
if [ "$?" == 0 ]; then
echo "Snapshot download successful"
else
echo "Snapshot download failed, falling back to fresh sync"
fi
chown -R bcuser:bcuser /data
sudo su bcuser
/usr/local/bin/docker-compose -f /home/bcuser/node/docker-compose.yml up -d
fi

echo "All Done!!"
31 changes: 31 additions & 0 deletions lib/base/sample-configs/.env-sample-archive
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#############################################################
# Example configuration for Base nodes runner app on AWS #
#############################################################

## Set the AWS account is and region for your environment ##
AWS_ACCOUNT_ID="xxxxxxxx"
AWS_REGION="us-east-1"

## Common configuration parameters ##
BASE_NETWORK_ID="mainnet" # All options: "mainnet", "sepolia"
BASE_NODE_CONFIGURATION="archive" # All options: "full", "archive"
BASE_INSTANCE_TYPE="m7g.2xlarge"
BASE_CPU_TYPE="ARM_64" # All options: "x86_64", "ARM_64". IMPORTANT: Make sure the CPU type matches the instance type used

# Data volume configuration
BASE_DATA_VOL_TYPE="gp3" # Other options: "io1" | "io2" | "gp3" | "instance-store" . IMPORTANT: Use "instance-store" option only with instance types that support that feature, like popular for node im4gn, d3, i3en, and i4i instance families
BASE_DATA_VOL_SIZE="7200" # Current required data size in GB to keep both snapshot archive and unarchived version of it. For Sepolia 1000 will be sufficient.
BASE_DATA_VOL_IOPS="5000" # Max IOPS for EBS volumes (not applicable for "instance-store")
BASE_DATA_VOL_THROUGHPUT="700" # Max throughput for EBS gp3 volumes (not applicable for "io1" | "io2" | "instance-store")
BASE_RESTORE_FROM_SNAPSHOT="true" # Download snapshot to speed up statup time
BASE_L1_EXECUTION_ENDPOINT="https://ethereum-sepolia-rpc.publicnode.com" # Set your own URL to Ethereum L1 node: https://docs.base.org/tools/node-providers
BASE_L1_CONSENSUS_ENDPOINT="https://ethereum-sepolia-beacon-api.publicnode.com"

BASE_SNAPSHOT_URL="none" # Optionally provide the URL to download snpashot: https://docs.base.org/tutorials/run-a-base-node/#snapshots

# Example for Sepolia:
#BASE_L1_EXECUTION_ENDPOINT=https://ethereum-sepolia-rpc.publicnode.com
#BASE_L1_CONSENSUS_ENDPOINT=https://ethereum-sepolia-beacon-api.publicnode.com
# Example for Mainnet and with Ethereum Blueprint with Geth-Lighthouse client combination and private IP:
#BASE_L1_EXECUTION_ENDPOINT=http://172.31.15.220:8545
#BASE_L1_CONSENSUS_ENDPOINT=http://172.31.15.220:5052
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ AWS_ACCOUNT_ID="xxxxxxxx"
AWS_REGION="us-east-1"

## Common configuration parameters ##
BASE_NETWORK_ID="sepolia" # All options: "mainnet", "sepolia"
BASE_NETWORK_ID="mainnet" # All options: "mainnet", "sepolia"
BASE_NODE_CONFIGURATION="full" # All options: "full", "archive"
BASE_INSTANCE_TYPE="m7g.2xlarge"
BASE_CPU_TYPE="ARM_64" # All options: "x86_64", "ARM_64". IMPORTANT: Make sure the CPU type matches the instance type used

# Data volume configuration
BASE_DATA_VOL_TYPE="gp3" # Other options: "io1" | "io2" | "gp3" | "instance-store" . IMPORTANT: Use "instance-store" option only with instance types that support that feature, like popular for node im4gn, d3, i3en, and i4i instance families
BASE_DATA_VOL_SIZE="5100" # Current required data size in GB to keep both snapshot archive and unarchived version of it. For Sepolia 1000 will be sufficient.
BASE_DATA_VOL_SIZE="4000" # Current required data size in GB to keep both snapshot archive and unarchived version of it. For Sepolia 1000 will be sufficient.
BASE_DATA_VOL_IOPS="5000" # Max IOPS for EBS volumes (not applicable for "instance-store")
BASE_DATA_VOL_THROUGHPUT="700" # Max throughput for EBS gp3 volumes (not applicable for "io1" | "io2" | "instance-store")
BASE_RESTORE_FROM_SNAPSHOT="true" # Download snapshot to speed up statup time
Expand Down

0 comments on commit 05bcdd6

Please sign in to comment.