Skip to content

Commit

Permalink
Merge pull request #24 from dappnode/3alpha/download-from-s3-directly
Browse files Browse the repository at this point in the history
Download snapshot using awscli
  • Loading branch information
eduadiez authored Nov 17, 2022
2 parents 0833a2b + 7626e23 commit a17eda6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion neard_image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN yarn add express cors shelljs
# ======================== BUILD NEAR ==================================
FROM nearprotocol/nearcore:${UPSTREAM_VERSION}

RUN apt update && apt install -y axel wget nginx supervisor
RUN apt-get update && DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -y nginx supervisor wget awscli

COPY start_near.sh /usr/local/bin/
# COPY start_api.sh /usr/local/bin/
Expand Down
8 changes: 4 additions & 4 deletions neard_image/start_near.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

export NEAR_HOME=/srv/near
CHAIN_ID=mainnet
SNAPSHOT_URL="https://near-protocol-public.s3.ca-central-1.amazonaws.com/backups/$CHAIN_ID/rpc/data.tar"
SNAPSHOT_URL="s3://near-protocol-public/backups/$CHAIN_ID/rpc"
FULL_ACCOUNT_ID="$ACCOUNT_ID.$CONTRACT_NAME"
NEARD_FLAGS=${NEAR_HOME:+--home="$NEAR_HOME"}
mkdir -p $NEAR_HOME/data
Expand All @@ -14,9 +14,9 @@ if [ ! -f ${NEAR_HOME}/node_key.json ]; then
fi
if [ ! -f ${NEAR_HOME}/data/CURRENT ]; then
echo "Downloading a snapshot, this can take a while..."
axel $SNAPSHOT_URL -o ${NEAR_HOME}
tar -xvf ${NEAR_HOME}/data.tar -C ${NEAR_HOME}/data
rm ${NEAR_HOME}/data.tar
aws s3 --no-sign-request cp $SNAPSHOT_URL/latest .
LATEST=$(cat latest)
aws s3 --no-sign-request cp --no-sign-request --recursive $SNAPSHOT_URL/$LATEST ${NEAR_HOME}/data
fi

# if [ -n "$ACCOUNT_ID" ] && [ -n "$VALIDATOR_PUBLIC_KEY" ] && [ -n "$VALIDATOR_SECRET_KEY" ]
Expand Down

0 comments on commit a17eda6

Please sign in to comment.