Skip to content

Commit 05bcdd6

Browse files
committed
Base. Refactoring snapshot download.
1 parent c800879 commit 05bcdd6

File tree

4 files changed

+43
-8
lines changed

4 files changed

+43
-8
lines changed

lib/base/lib/assets/start-from-snapshot.sh renamed to lib/base/lib/assets/download-snapshot.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ while (( BASE_SNAPSHOT_DOWNLOAD_STATUS != 0 ))
1818
do
1919
PIDS=$(pgrep wget)
2020
if [ -z "$PIDS" ]; then
21-
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
21+
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
2222
fi
2323
BASE_SNAPSHOT_DOWNLOAD_STATUS=$?
2424
pid=$(pidof wget)
@@ -53,7 +53,3 @@ rm -rf /data/snapshots && \
5353
rm -rf /data/$BASE_SNAPSHOT_FILE_NAME
5454

5555
echo "Processed snapshot"
56-
57-
chown -R bcuser:bcuser /data && \
58-
sudo su bcuser && \
59-
/usr/local/bin/docker-compose -f /home/bcuser/node/docker-compose.yml up -d

lib/base/lib/assets/user-data/node.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,15 @@ if [ "$RESTORE_FROM_SNAPSHOT" == "false" ]; then
241241
else
242242
echo "Restoring data from snapshot"
243243
chmod 766 /opt/start-from-snapshot.sh
244-
echo "/opt/start-from-snapshot.sh" | at now +3 minutes
244+
/opt/download-snapshot.sh
245+
if [ "$?" == 0 ]; then
246+
echo "Snapshot download successful"
247+
else
248+
echo "Snapshot download failed, falling back to fresh sync"
249+
fi
250+
chown -R bcuser:bcuser /data
251+
sudo su bcuser
252+
/usr/local/bin/docker-compose -f /home/bcuser/node/docker-compose.yml up -d
245253
fi
246254

247255
echo "All Done!!"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#############################################################
2+
# Example configuration for Base nodes runner app on AWS #
3+
#############################################################
4+
5+
## Set the AWS account is and region for your environment ##
6+
AWS_ACCOUNT_ID="xxxxxxxx"
7+
AWS_REGION="us-east-1"
8+
9+
## Common configuration parameters ##
10+
BASE_NETWORK_ID="mainnet" # All options: "mainnet", "sepolia"
11+
BASE_NODE_CONFIGURATION="archive" # All options: "full", "archive"
12+
BASE_INSTANCE_TYPE="m7g.2xlarge"
13+
BASE_CPU_TYPE="ARM_64" # All options: "x86_64", "ARM_64". IMPORTANT: Make sure the CPU type matches the instance type used
14+
15+
# Data volume configuration
16+
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
17+
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.
18+
BASE_DATA_VOL_IOPS="5000" # Max IOPS for EBS volumes (not applicable for "instance-store")
19+
BASE_DATA_VOL_THROUGHPUT="700" # Max throughput for EBS gp3 volumes (not applicable for "io1" | "io2" | "instance-store")
20+
BASE_RESTORE_FROM_SNAPSHOT="true" # Download snapshot to speed up statup time
21+
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
22+
BASE_L1_CONSENSUS_ENDPOINT="https://ethereum-sepolia-beacon-api.publicnode.com"
23+
24+
BASE_SNAPSHOT_URL="none" # Optionally provide the URL to download snpashot: https://docs.base.org/tutorials/run-a-base-node/#snapshots
25+
26+
# Example for Sepolia:
27+
#BASE_L1_EXECUTION_ENDPOINT=https://ethereum-sepolia-rpc.publicnode.com
28+
#BASE_L1_CONSENSUS_ENDPOINT=https://ethereum-sepolia-beacon-api.publicnode.com
29+
# Example for Mainnet and with Ethereum Blueprint with Geth-Lighthouse client combination and private IP:
30+
#BASE_L1_EXECUTION_ENDPOINT=http://172.31.15.220:8545
31+
#BASE_L1_CONSENSUS_ENDPOINT=http://172.31.15.220:5052

lib/base/sample-configs/.env-sample-rpc renamed to lib/base/sample-configs/.env-sample-full

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ AWS_ACCOUNT_ID="xxxxxxxx"
77
AWS_REGION="us-east-1"
88

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

1515
# Data volume configuration
1616
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
17-
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.
17+
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.
1818
BASE_DATA_VOL_IOPS="5000" # Max IOPS for EBS volumes (not applicable for "instance-store")
1919
BASE_DATA_VOL_THROUGHPUT="700" # Max throughput for EBS gp3 volumes (not applicable for "io1" | "io2" | "instance-store")
2020
BASE_RESTORE_FROM_SNAPSHOT="true" # Download snapshot to speed up statup time

0 commit comments

Comments
 (0)