Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions graph-node/scripts/init-firehose-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,26 @@ END

# Restore snapshot if url is present
if [ ! -z "$STATE_RESTORE_SNAPSHOT_URL" ]; then
echo "Downloading snapshot from $STATE_RESTORE_SNAPSHOT_URL"
wget -O $HOME_DIR/snapshot.tar.gz $STATE_RESTORE_SNAPSHOT_URL

echo "Extracting snapshot"
tar -xvf $HOME_DIR/snapshot.tar.gz -C $HOME_DIR
rm -rf $HOME_DIR/snapshot.tar.gz
echo "=> Downloading snapshot from $STATE_RESTORE_SNAPSHOT_URL"
FILENAME=$(basename $STATE_RESTORE_SNAPSHOT_URL)
curl $STATE_RESTORE_SNAPSHOT_URL -o $HOME_DIR/$FILENAME

echo "=> Extracting snapshot"
case "$FILENAME" in
*.tar.lz4)
if ! command -v lz4 &> /dev/null; then
apk add lz4
fi

lz4 -c -d $HOME_DIR/$FILENAME | tar -x -C $HOME_DIR
rm -rf $HOME_DIR/$FILENAME
;;

*.tar.gz)
tar -xvf $HOME_DIR/$FILENAME -C $HOME_DIR
rm -rf $HOME_DIR/$FILENAME
;;
esac
fi
fi

Expand Down