Skip to content

Commit c800879

Browse files
committed
Base. Moving to different download method
1 parent 75d6ecd commit c800879

File tree

2 files changed

+14
-28
lines changed

2 files changed

+14
-28
lines changed

lib/base/lib/assets/start-from-snapshot.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,34 @@ echo "Downloading snpashot"
55

66
cd /data
77

8-
BASE_SNAPSHOT_FILE_NAME=snalshot.tar.gz
8+
BASE_SNAPSHOT_FILE_NAME=snapshot.tar.gz
99
BASE_SNAPSHOT_DIR=/data/
1010
BASE_SNAPSHOT_DOWNLOAD_STATUS=-1
11-
BASE_LATEST_SNAPSHOT_FILE_NAME=$(curl https://$NETWORK_ID-$NODE_CONFIG-snapshots.base.org/latest)
1211

1312
if [ "$SNAPSHOT_URL" == "none" ] || [ -z "${SNAPSHOT_URL}" ]; then
13+
BASE_LATEST_SNAPSHOT_FILE_NAME=$(curl https://$NETWORK_ID-$NODE_CONFIG-snapshots.base.org/latest)
1414
SNAPSHOT_URL=https://$NETWORK_ID-$NODE_CONFIG-snapshots.base.org/$BASE_LATEST_SNAPSHOT_FILE_NAME
1515
fi
1616

1717
while (( BASE_SNAPSHOT_DOWNLOAD_STATUS != 0 ))
1818
do
19-
PIDS=$(pgrep aria2c)
19+
PIDS=$(pgrep wget)
2020
if [ -z "$PIDS" ]; then
21-
aria2c -x3 $SNAPSHOT_URL -d $BASE_SNAPSHOT_DIR -o $BASE_SNAPSHOT_FILE_NAME -l aria2c.log --log-level=warn --allow-piece-length-change=true
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
2222
fi
2323
BASE_SNAPSHOT_DOWNLOAD_STATUS=$?
24-
pid=$(pidof aria2c)
24+
pid=$(pidof wget)
2525
wait $pid
26-
echo "aria2c exit."
26+
echo "wget exit."
2727
case $BASE_SNAPSHOT_DOWNLOAD_STATUS in
28+
2)
29+
echo "CLI parsing error. Check variables."
30+
exit 2
31+
;;
2832
3)
29-
echo "file not exist."
33+
echo "File I/O error."
3034
exit 3
3135
;;
32-
9)
33-
echo "No space left on device."
34-
exit 9
35-
;;
3636
*)
3737
continue
3838
;;
@@ -45,14 +45,14 @@ sleep 60
4545
# take about 2 hours to decompress the snapshot
4646
echo "Decompression snapshot start ..."
4747

48-
tar -I zstdmt -xf $BASE_SNAPSHOT_DIR/$BASE_SNAPSHOT_FILE_NAME -C /data 2>&1 | tee unzip.log && echo "decompression success..." || echo "decompression failed..." >> snapshots-decompression.log
49-
echo "Decompressing snapshot success ..."
48+
tar -zxvf $BASE_SNAPSHOT_DIR/$BASE_SNAPSHOT_FILE_NAME -C /data 2>&1 | tee unzip.log && echo "decompresed successfully..." || echo "decompression failed..." >> snapshots-decompression.log
49+
echo "Decompresed snapshot ..."
5050

5151
mv /data/snapshots/$NETWORK_ID/download/* /data && \
5252
rm -rf /data/snapshots && \
5353
rm -rf /data/$BASE_SNAPSHOT_FILE_NAME
5454

55-
echo "Snapshot is ready !!!"
55+
echo "Processed snapshot"
5656

5757
chown -R bcuser:bcuser /data && \
5858
sudo su bcuser && \

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,6 @@ ln /usr/local/bin/aws /usr/bin/aws
6060
echo 'Installing SSM Agent'
6161
yum install -y $SSM_AGENT_BINARY_URI
6262

63-
# install aria2 a p2p downloader
64-
65-
if [ "$arch" == "x86_64" ]; then
66-
wget https://github.com/q3aql/aria2-static-builds/releases/download/v1.36.0/aria2-1.36.0-linux-gnu-64bit-build1.tar.bz2
67-
tar jxvf aria2-1.36.0-linux-gnu-64bit-build1.tar.bz2
68-
cd aria2-1.36.0-linux-gnu-64bit-build1/
69-
make install
70-
else
71-
wget https://github.com/q3aql/aria2-static-builds/releases/download/v1.36.0/aria2-1.36.0-linux-gnu-arm-rbpi-build1.tar.bz2
72-
tar jxvf aria2-1.36.0-linux-gnu-arm-rbpi-build1.tar.bz2
73-
cd aria2-1.36.0-linux-gnu-arm-rbpi-build1/
74-
make install
75-
fi
76-
7763
# Base specific setup starts here
7864

7965
# Set by Base-specic CDK components and stacks

0 commit comments

Comments
 (0)