update the polygon erigon setup to be able to use public rpcs and the new official supported version
This commit is contained in:
@@ -4,19 +4,19 @@ services:
|
|||||||
erigon-polygon:
|
erigon-polygon:
|
||||||
build:
|
build:
|
||||||
args:
|
args:
|
||||||
ERIGON_VERSION: v0.0.3
|
ERIGON_VERSION: v0.0.4
|
||||||
context: ./polygon/erigon
|
context: ./polygon/erigon
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
environment:
|
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
|
- BOOTSTRAP=1
|
||||||
|
- HEIMDALLD=${HEIMDALLD:-http://heimdalld:26657}
|
||||||
|
- HEIMDALLR=${HEIMDALLR:-http://heimdallr:1317}
|
||||||
volumes:
|
volumes:
|
||||||
- "polygon-archive_data:/datadir"
|
- "polygon-archive_data:/datadir"
|
||||||
ports:
|
ports:
|
||||||
- "40303:40303"
|
- "27113:27113"
|
||||||
- "40303:40303/udp"
|
- "27113:27113/udp"
|
||||||
depends_on:
|
|
||||||
- heimdallr
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
stop_grace_period: 1m
|
stop_grace_period: 1m
|
||||||
labels:
|
labels:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ FROM golang:1.19-alpine as builder
|
|||||||
RUN apk add --no-cache make g++ gcc musl-dev linux-headers git
|
RUN apk add --no-cache make g++ gcc musl-dev linux-headers git
|
||||||
|
|
||||||
# Grab ERIGON_VERSION from Build Args
|
# Grab ERIGON_VERSION from Build Args
|
||||||
ARG ERIGON_VERSION
|
ARG ERIGON_VERSION=v0.0.4
|
||||||
|
|
||||||
# Clone the repo to that folder
|
# Clone the repo to that folder
|
||||||
RUN git clone --recurse-submodules -j8 https://github.com/maticnetwork/erigon.git
|
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
|
RUN apk add --no-cache ca-certificates curl jq libstdc++ libgcc
|
||||||
COPY --from=builder /go/erigon/build/bin/erigon /usr/local/bin/
|
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
|
# Set entrypoint
|
||||||
COPY ./scripts/entrypoint.sh /usr/local/bin/entrypoint.sh
|
COPY ./scripts/entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||||
RUN chmod u+x /usr/local/bin/entrypoint.sh
|
RUN chmod u+x /usr/local/bin/entrypoint.sh
|
||||||
|
|||||||
@@ -5,31 +5,33 @@ set -e
|
|||||||
|
|
||||||
# Set Bor Home Directory
|
# Set Bor Home Directory
|
||||||
ERIGON_HOME=/datadir
|
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" ];
|
if [ "${BOOTSTRAP}" == 1 ] && [ -n "${SNAPSHOT_URL}" ] && [ ! -f "${ERIGON_HOME}/bootstrapped" ];
|
||||||
then
|
then
|
||||||
echo "downloading snapshot from ${SNAPSHOT_URL}"
|
echo "downloading snapshot from ${SNAPSHOT_URL}"
|
||||||
mkdir -p ${ERIGON_HOME}
|
mkdir -p ${ERIGON_HOME:-/datadir}
|
||||||
wget --tries=0 -O - "${SNAPSHOT_URL}" | tar -xz -C ${ERIGON_HOME} && touch ${ERIGON_HOME}/bootstrapped
|
wget --tries=0 -O - "${SNAPSHOT_URL}" | tar -xz -C ${ERIGON_HOME:-/datadir} && touch ${ERIGON_HOME:-/datadir}/bootstrapped
|
||||||
fi
|
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" ]];
|
while [[ "${READY}" != "false" ]];
|
||||||
do
|
do
|
||||||
echo "Waiting for heimdalld to catch up."
|
echo "Waiting for heimdalld to catch up."
|
||||||
sleep 30
|
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
|
done
|
||||||
|
|
||||||
# add snap.keepblocks=true as mentioned on https://snapshot.polygon.technology/
|
# add snap.keepblocks=true as mentioned on https://snapshot.polygon.technology/
|
||||||
|
|
||||||
exec erigon \
|
exec erigon \
|
||||||
--chain=bor-mainnet \
|
--chain=bor-mainnet \
|
||||||
--bor.heimdall=http://heimdallr:1317 \
|
--bor.heimdall=${HEIMDALLR:-http://heimdallr:1317} \
|
||||||
--datadir=${ERIGON_HOME} \
|
--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" \
|
--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 \
|
--snap.keepblocks=true \
|
||||||
--snapshots="true" \
|
--snapshots="true" \
|
||||||
--torrent.upload.rate="1250mb" --torrent.download.rate="1250mb" \
|
--torrent.upload.rate="1250mb" --torrent.download.rate="1250mb" \
|
||||||
|
|||||||
Reference in New Issue
Block a user