2 Commits

Author SHA1 Message Date
cventastic
115916a9f9 added libgcc and libstdc++ to polygon-erigon alpine container 2022-10-19 12:38:04 +02:00
cventastic
9cf3c5b71e replace bor with erigon for archive 2022-10-19 12:21:22 +02:00
16 changed files with 98 additions and 360 deletions

View File

@@ -1,60 +0,0 @@
version: '3.1'
services:
dshackle:
image: emeraldpay/dshackle:0.13.1
restart: unless-stopped
volumes:
- ./dshackle/config:/etc/dshackle # This should hold all your yaml files
expose:
- 8080 # /eth
- 8081 # /metrics
- 8082 # healthcheck
- 2449 # grpc
networks:
- chains
ports:
- "127.0.0.1:8082:8082" # healthcheck
environment:
- ALCHEMY_KEY=${ALCHEMY_KEY}
- ANYBLOCK_KEY=${ANYBLOCK_KEY}
- CHAINSTACK_NODE=${CHAINSTACK_NODE}
- CHAINSTACK_USERNAME=${CHAINSTACK_USERNAME}
- CHAINSTACK_PASSWORD=${CHAINSTACK_PASSWORD}
- COINBASE_USERNAME=${COINBASE_USERNAME}
- COINBASE_PASSWORD=${COINBASE_PASSWORD}
- INFURA_KEY=${INFURA_KEY}
- RIVET_KEY=${RIVET_KEY}
- QUICKNODE_HTTP=${QUICKNODE_HTTP}
- QUICKNODE_WSS=${QUICKNODE_WSS}
labels:
- "prometheus-scrape.enabled=true"
- "prometheus-scrape.port=8081"
- "prometheus-scrape.job_name=dshackle"
- "prometheus-scrape.metrics_path=/metrics"
- "traefik.enable=true"
- "traefik.http.middlewares.dshackle-stripprefix.stripprefix.prefixes=/dshackle"
# - "traefik.http.middlewares.shackle-replacepath.replacepath.path=/eth"
- "traefik.http.services.dshackle.loadbalancer.server.port=8080"
- "traefik.http.routers.dshackle.entrypoints=websecure"
- "traefik.http.routers.dshackle.tls.certresolver=myresolver"
- "traefik.http.routers.dshackle.rule=Host(`$DOMAIN`) && PathPrefix(`/dshackle`)"
# - "traefik.http.routers.dshackle.middlewares=dshackle-stripprefix, dshackle-replacepath, ipwhitelist"
- "traefik.http.routers.dshackle.middlewares=dshackle-stripprefix, ipwhitelist"
redis:
image: healthcheck/redis:alpine
restart: unless-stopped
networks:
- chains
environment:
- REDIS_RAM=${REDIS_RAM}
command:
- "redis-server"
- "--maxmemory ${REDIS_RAM}"
- "--maxmemory-policy allkeys-lru"
- '--save ""'

View File

@@ -1,41 +0,0 @@
upstreams:
- id: alchemy
chain: ethereum
role: fallback
priority: 90
options:
disable-validation: false
validate-peers: false
validate-syncing: true
methods:
enabled:
# Manually Enabled
- name: alchemy_getAssetTransfers
- name: alchemy_getTokenAllowance
- name: alchemy_getTokenBalances
- name: alchemy_getTokenMetadata
- name: eth_getFilterChanges
- name: eth_getFilterLogs
- name: eth_maxPriorityFeePerGas
- name: eth_newBlockFilter
- name: eth_newFilter
- name: eth_newPendingTransactionFilter
- name: eth_subscribe
- name: eth_uninstallFilter
- name: eth_unsubscribe
- name: trace_block
- name: trace_call
- name: trace_callMany
- name: trace_filter
- name: trace_get
- name: trace_rawTransaction
- name: trace_replayBlockTransactions
- name: trace_replayTransaction
- name: trace_transaction
connection:
ethereum:
rpc:
url: "https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_KEY}"
ws:
url: "wss://eth-mainnet.ws.alchemyapi.io/v2/${ALCHEMY_KEY}"

View File

@@ -1,14 +0,0 @@
upstreams:
- id: ankr
chain: ethereum
role: fallback
priority: 80
options:
disable-validation: false
validate-peers: false
validate-syncing: true
connection:
ethereum:
rpc:
url: "https://rpc.ankr.com/eth"

View File

@@ -1,14 +0,0 @@
upstreams:
- id: anyblock
chain: ethereum
role: fallback
priority: 70
options:
disable-validation: false
validate-peers: false
validate-syncing: true
connection:
ethereum:
rpc:
url: "https://api.anyblock.tools/ethereum/ethereum/mainnet/rpc/${ANYBLOCK_KEY}"

View File

@@ -1,14 +0,0 @@
upstreams:
- id: avado
chain: ethereum
role: fallback
priority: 60
options:
disable-validation: false
validate-peers: false
validate-syncing: true
connection:
ethereum:
rpc:
url: "https://mainnet.eth.cloud.ava.do"

View File

@@ -1,22 +0,0 @@
upstreams:
- id: chainstack
chain: ethereum
role: fallback
priority: 50
options:
disable-validation: false
validate-peers: false
validate-syncing: true
connection:
ethereum:
rpc:
url: "https://${CHAINSTACK_NODE}.p2pify.com"
basic-auth:
username: ${CHAINSTACK_USERNAME}
password: ${CHAINSTACK_PASSWORD}
ws:
url: "wss://ws-${CHAINSTACK_NODE}.p2pify.com"
basic-auth:
username: ${CHAINSTACK_USERNAME}
password: ${CHAINSTACK_PASSWORD}

View File

@@ -1,14 +0,0 @@
upstreams:
- id: cloudflare
chain: ethereum
role: fallback
priority: 40
options:
disable-validation: false
validate-peers: false
validate-syncing: true
connection:
ethereum:
rpc:
url: "https://cloudflare-eth.com"

View File

@@ -1,31 +0,0 @@
upstreams:
- id: coinbase
chain: ethereum
role: secondary
priority: 30
labels:
provider: geth
archive: false
options:
disable-validation: false
validate-peers: false
validate-syncing: true
methods:
enabled:
# Manually Enabled
- name: coinbaseCloud_getBalances
- name: coinbaseCloud_getSingleBalance
- name: coinbaseCloud_getTokenAllowances
- name: coinbaseCloud_getTransactionByHash
- name: coinbaseCloud_getTransactionsByAddress
- name: coinbaseCloud_getTokenTransfersByAddress
- name: coinbaseCloud_getTokenMetadata
- name: coinbaseCloud_getTokenStandardEvents
connection:
ethereum:
rpc:
url: "https://mainnet.ethereum.coinbasecloud.net"
basic-auth:
username: ${COINBASE_USERNAME}
password: ${COINBASE_PASSWORD}

View File

@@ -1,64 +0,0 @@
host: 0.0.0.0
port: 2449
tls:
enabled: false
monitoring:
enabled: true
jvm: false
extended: false
prometheus:
enabled: true
bind: 0.0.0.0
port: 8081
path: /metrics
health:
port: 8082
host: 0.0.0.0
path: /health
blockchains:
- chain: ethereum
min-available: 1
cache:
redis:
enabled: true
host: redis
password: ""
proxy:
host: 0.0.0.0
port: 8080
tls:
enabled: false
routes:
- id: eth
blockchain: ethereum
cluster:
defaults:
- chains:
- ethereum
options:
min-peers: 10
include:
# Private Nodes
#- "besu.yaml"
#- "geth.yaml"
#- "nethermind.yaml"
#- "erigon.yaml"
# Freemium Nodes
- "alchemy.yaml"
- "anyblock.yaml"
- "chainstack.yaml"
- "coinbase.yaml"
- "infura.yaml"
- "quicknode.yaml"
- "rivet.yaml"
# Public Nodes
- "cloudflare.yaml"
- "avado.yaml"
- "ankr.yaml"

View File

@@ -1,16 +0,0 @@
upstreams:
- id: infura
chain: ethereum
role: fallback
priority: 20
options:
disable-validation: false
validate-peers: false
validate-syncing: true
connection:
ethereum:
rpc:
url: "https://mainnet.infura.io/v3/${INFURA_KEY}"
ws:
url: "wss://mainnet.infura.io/ws/v3/${INFURA_KEY}"

View File

@@ -1,29 +0,0 @@
upstreams:
- id: quicknode
chain: ethereum
role: fallback
priority: 140
options:
disable-validation: false
validate-peers: false
validate-syncing: true
methods:
enabled:
# Manually Enabled
- name: qn_broadcastRawTransaction
- name: qn_fetchNFTCollectionDetails
- name: qn_fetchNFTs
- name: qn_fetchNFTsByCollection
- name: qn_getTokenMetadataByContractAddress
- name: qn_getTokenMetadataBySymbol
- name: qn_getTransfersByNFT
- name: qn_getWalletTokenBalance
- name: qn_getWalletTokenTransactions
- name: qn_verifyNFTsOwner
connection:
ethereum:
rpc:
url: "${QUICKNODE_HTTP}"
ws:
url: "${QUICKNODE_WSS}"

View File

@@ -1,16 +0,0 @@
upstreams:
- id: rivet
chain: ethereum
role: fallback
priority: 10
options:
disable-validation: false
validate-peers: false
validate-syncing: true
connection:
ethereum:
rpc:
url: "https://${RIVET_KEY}.eth.rpc.rivet.cloud"
ws:
url: "wss://${RIVET_KEY}.eth.ws.rivet.cloud"

34
erigon-polygon.yml Normal file
View 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:

View File

@@ -1,25 +0,0 @@
version: '3.1'
services:
eth_proxy:
image: stakesquid/eth-proxy:latest
expose:
- "8080"
- "12449"
ports:
- "127.0.0.1:12449:12449"
environment:
- DSHACKLE_GRPC=http://dshackle:2449
- UPSTREAM_RPCS=${ETH_PROXY_UPSTREAM_RPCS}
networks:
- chains
restart: always
labels:
- "traefik.enable=true"
- "traefik.http.middlewares.eth_proxy-stripprefix.stripprefix.prefixes=/eth-proxy"
- "traefik.http.services.eth_proxy.loadbalancer.server.port=8080"
- "traefik.http.routers.eth_proxy.entrypoints=websecure"
- "traefik.http.routers.eth_proxy.tls.certresolver=myresolver"
- "traefik.http.routers.eth_proxy.rule=Host(`$DOMAIN`) && PathPrefix(`/eth-proxy`)"
- "traefik.http.routers.eth_proxy.middlewares=eth_proxy-stripprefix, ipwhitelist"

31
polygon/erigon/Dockerfile Normal file
View 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 libstdc++ libgcc
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" ]

View 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