update the polygon erigon setup to be able to use public rpcs and the new official supported version

This commit is contained in:
Sebastian
2022-12-18 12:02:30 +01:00
parent f0ee4c3038
commit d5313803dd
3 changed files with 35 additions and 14 deletions

View File

@@ -4,19 +4,19 @@ services:
erigon-polygon:
build:
args:
ERIGON_VERSION: v0.0.3
ERIGON_VERSION: v0.0.4
context: ./polygon/erigon
dockerfile: Dockerfile
environment:
- SNAPSHOT_URL=https://matic-blockchain-snapshots.s3-accelerate.amazonaws.com/matic-mainnet/erigon-archive-snapshot-2022-11-17.tar.gz
- SNAPSHOT_URL=https://matic-blockchain-snapshots.s3-accelerate.amazonaws.com/matic-mainnet/erigon-archive-snapshot-2022-12-13.tar.gz
- BOOTSTRAP=1
- HEIMDALLD=${HEIMDALLD:-http://heimdalld:26657}
- HEIMDALLR=${HEIMDALLR:-http://heimdallr:1317}
volumes:
- "polygon-archive_data:/datadir"
ports:
- "40303:40303"
- "40303:40303/udp"
depends_on:
- heimdallr
- "27113:27113"
- "27113:27113/udp"
restart: unless-stopped
stop_grace_period: 1m
labels:

View File

@@ -5,7 +5,7 @@ FROM golang:1.19-alpine as builder
RUN apk add --no-cache make g++ gcc musl-dev linux-headers git
# Grab ERIGON_VERSION from Build Args
ARG ERIGON_VERSION
ARG ERIGON_VERSION=v0.0.4
# Clone the repo to that folder
RUN git clone --recurse-submodules -j8 https://github.com/maticnetwork/erigon.git
@@ -25,6 +25,25 @@ FROM alpine:latest
RUN apk add --no-cache ca-certificates curl jq libstdc++ libgcc
COPY --from=builder /go/erigon/build/bin/erigon /usr/local/bin/
# ENV HEIMDALLD=http://heimdalld:26657
# ENV HEIMDALLR=http://heimdallr:1317
ENV HEIMDALLD=https://polygon-mainnet-rpc.allthatnode.com:26657
ENV HEIMDALLR=https://polygon-mainnet-rpc.allthatnode.com:1317
# P2P
EXPOSE 27113
# HTTP / WS
EXPOSE 8545
# Metrics
EXPOSE 6060
# PProf
EXPOSE 6061
# Set entrypoint
COPY ./scripts/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod u+x /usr/local/bin/entrypoint.sh

View File

@@ -5,31 +5,33 @@ set -e
# Set Bor Home Directory
ERIGON_HOME=/datadir
HEIMDALL_RPC=heimdall:26657
#HEIMDALLD=http://heimdalld:26657
#HEIMDALLR=http://heimdallr:1317
if [ "${BOOTSTRAP}" == 1 ] && [ -n "${SNAPSHOT_URL}" ] && [ ! -f "${ERIGON_HOME}/bootstrapped" ];
then
echo "downloading snapshot from ${SNAPSHOT_URL}"
mkdir -p ${ERIGON_HOME}
wget --tries=0 -O - "${SNAPSHOT_URL}" | tar -xz -C ${ERIGON_HOME} && touch ${ERIGON_HOME}/bootstrapped
mkdir -p ${ERIGON_HOME:-/datadir}
wget --tries=0 -O - "${SNAPSHOT_URL}" | tar -xz -C ${ERIGON_HOME:-/datadir} && touch ${ERIGON_HOME:-/datadir}/bootstrapped
fi
READY=$(curl -s http://heimdalld:26657/status | jq '.result.sync_info.catching_up')
READY=$(curl -s ${HEIMDALLD:-http://heimdalld:26657}/status | jq '.result.sync_info.catching_up')
while [[ "${READY}" != "false" ]];
do
echo "Waiting for heimdalld to catch up."
sleep 30
READY=$(curl -s heimdalld:26657/status | jq '.result.sync_info.catching_up')
READY=$(curl -s ${HEIMDALLD:-http://heimdalld:26657}/status | jq '.result.sync_info.catching_up')
done
# add snap.keepblocks=true as mentioned on https://snapshot.polygon.technology/
exec erigon \
--chain=bor-mainnet \
--bor.heimdall=http://heimdallr:1317 \
--bor.heimdall=${HEIMDALLR:-http://heimdallr:1317} \
--datadir=${ERIGON_HOME} \
--http --http.addr="0.0.0.0" --http.port="8545" --http.compression --http.vhosts="*" --http.corsdomain="*" --http.api="eth,debug,net,trace,web3,erigon,bor" \
--ws --ws.compression \
--ws --ws.compression --ws.port="8545" \
--port=27113
--snap.keepblocks=true \
--snapshots="true" \
--torrent.upload.rate="1250mb" --torrent.download.rate="1250mb" \