replace bor with erigon for archive
This commit is contained in:
34
erigon-polygon.yml
Normal file
34
erigon-polygon.yml
Normal file
@@ -0,0 +1,34 @@
|
||||
version: '3.1'
|
||||
|
||||
services:
|
||||
erigon-polygon:
|
||||
build:
|
||||
args:
|
||||
ERIGON_VERSION: v0.0.3
|
||||
context: ./polygon/erigon
|
||||
dockerfile: Dockerfile
|
||||
environment:
|
||||
- SNAPSHOT_URL=https://matic-blockchain-snapshots.s3-accelerate.amazonaws.com/matic-mainnet/erigon-archive-snapshot-2022-10-12.tar.gz
|
||||
- BOOTSTRAP=1
|
||||
volumes:
|
||||
- "bor-archive_data:/datadir"
|
||||
ports:
|
||||
- "40303:40303"
|
||||
- "40303:40303/udp"
|
||||
depends_on:
|
||||
- heimdallr
|
||||
restart: unless-stopped
|
||||
stop_grace_period: 1m
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.middlewares.bor-stripprefix.stripprefix.prefixes=/polygon-archive"
|
||||
- "traefik.http.services.bor.loadbalancer.server.port=8545"
|
||||
- "traefik.http.routers.bor.entrypoints=websecure"
|
||||
- "traefik.http.routers.bor.tls.certresolver=myresolver"
|
||||
- "traefik.http.routers.bor.rule=Host(`$DOMAIN`) && PathPrefix(`/polygon-archive`)"
|
||||
- "traefik.http.routers.bor.middlewares=bor-stripprefix, ipwhitelist"
|
||||
networks:
|
||||
- chains
|
||||
|
||||
volumes:
|
||||
bor-archive_data:
|
||||
31
polygon/erigon/Dockerfile
Normal file
31
polygon/erigon/Dockerfile
Normal file
@@ -0,0 +1,31 @@
|
||||
# Build Bor in a stock Go builder container
|
||||
FROM golang:1.19-alpine as builder
|
||||
|
||||
# Install packages we need
|
||||
RUN apk add --no-cache make g++ gcc musl-dev linux-headers git
|
||||
|
||||
# Grab ERIGON_VERSION from Build Args
|
||||
ARG ERIGON_VERSION
|
||||
|
||||
# Clone the repo to that folder
|
||||
RUN git clone --recurse-submodules -j8 https://github.com/maticnetwork/erigon.git
|
||||
|
||||
# change into repo
|
||||
WORKDIR ./erigon
|
||||
|
||||
# checkout version
|
||||
RUN git checkout ${ERIGON_VERSION}
|
||||
|
||||
# Build Bor
|
||||
RUN make erigon
|
||||
|
||||
# Pull Bor into a second stage deploy alpine container
|
||||
FROM alpine:latest
|
||||
|
||||
RUN apk add --no-cache ca-certificates curl jq
|
||||
COPY --from=builder /go/erigon/build/bin/erigon /usr/local/bin/
|
||||
|
||||
# Set entrypoint
|
||||
COPY ./scripts/entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod u+x /usr/local/bin/entrypoint.sh
|
||||
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
|
||||
33
polygon/erigon/scripts/entrypoint.sh
Normal file
33
polygon/erigon/scripts/entrypoint.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
|
||||
# exit script on any error
|
||||
set -e
|
||||
|
||||
# Set Bor Home Directory
|
||||
ERIGON_HOME=/datadir
|
||||
|
||||
|
||||
if [ "${BOOTSTRAP}" == 1 ] && [ -n "${SNAPSHOT_URL}" ] && [ ! -f "${ERIGON_HOME}/bootstrapped" ];
|
||||
then
|
||||
echo "downloading snapshot from ${SNAPSHOT_URL}"
|
||||
mkdir -p ${ERIGON_HOME}/bor/chaindata
|
||||
wget --tries=0 -O - "${SNAPSHOT_URL}" | tar -xz -C ${ERIGON_HOME}/bor/chaindata && touch ${ERIGON_HOME}/bootstrapped
|
||||
fi
|
||||
|
||||
READY=$(curl -s 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')
|
||||
done
|
||||
|
||||
# add snap.keepblocks=true as mentioned on https://snapshot.polygon.technology/
|
||||
|
||||
exec erigon \
|
||||
--chain=bor-mainnet \
|
||||
--bor.heimdall=http://heimdallr:1317 \
|
||||
--datadir=${ERIGON_HOME} \
|
||||
--snap.keepblocks=true \
|
||||
--metrics --metrics.addr=0.0.0.0 --metrics.port=6060 \
|
||||
--pprof --pprof.addr=0.0.0.0 --pprof.port=6061
|
||||
Reference in New Issue
Block a user