make erigon init the genesis block before starting

This commit is contained in:
Sebastian
2023-08-13 07:38:09 +02:00
parent e961effb51
commit 03488dbd76
3 changed files with 11 additions and 28 deletions

View File

@@ -2,7 +2,7 @@ version: '3.1'
services: services:
erigon-lukso: erigon-lukso:
image: thorax/erigon:v2.45.1 build: ./lukso/erigon/Dockerfile
expose: expose:
- "51262" - "51262"
- "9090" - "9090"
@@ -13,11 +13,12 @@ services:
- "51262:51262/udp" - "51262:51262/udp"
volumes: volumes:
- erigon-lukso:/home/erigon/.local/share/erigon - erigon-lukso:/home/erigon/.local/share/erigon
- ./lukso/shared:/configs/mainnet/shared
- .jwtsecret:/jwtsecret - .jwtsecret:/jwtsecret
networks: networks:
- chains - chains
command: > command: >
# --chain=mainnet --chain=mainnet
--networkid=42 --networkid=42
--miner.gaslimit=42000000 --miner.gaslimit=42000000
--snapshots=false --snapshots=false
@@ -136,6 +137,7 @@ services:
--http --http
--http-address 0.0.0.0 --http-address 0.0.0.0
--port 17765 --port 17765
--checkpoint-sync-url=https://checkpoints.mainnet.lukso.network
restart: unless-stopped restart: unless-stopped
stop_grace_period: 1m stop_grace_period: 1m
networks: networks:

5
lukso/erigon/Dockerfile Normal file
View File

@@ -0,0 +1,5 @@
FROM thorax/erigon:v2.45.1
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

@@ -3,37 +3,13 @@
# exit script on any error # exit script on any error
set -e set -e
# Set Bor Home Directory
ERIGON_HOME=/datadir ERIGON_HOME=/datadir
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:-/datadir} mkdir -p ${ERIGON_HOME:-/datadir}
wget --tries=0 -O - "${SNAPSHOT_URL}" | tar -xz -C ${ERIGON_HOME:-/datadir} && touch ${ERIGON_HOME:-/datadir}/bootstrapped erigon init --datadir $ERIGON_HOME /configs/mainnet/shared/genesis_42.json
fi fi
READY=$(curl -s ${HEIMDALLD:-http://heimdalld:26657}/status | jq '.result.sync_info.catching_up') exec erigon $@
while [[ "${READY}" != "false" ]];
do
echo "Waiting for heimdalld to catch up."
sleep 30
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/
# add rpc.returndata.limit=1000000 to unstuck subgraphs due to "call retuned result on length 104704 exceeding limit 100000"
exec erigon \
--chain=bor-mainnet \
--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 \
--port=27113 \
--snap.keepblocks=true \
--rpc.returndata.limit=1000000 \
--snapshots="true" \
--torrent.upload.rate="1250mb" --torrent.download.rate="1250mb" \
--metrics --metrics.addr=0.0.0.0 --metrics.port=6060 \
--pprof --pprof.addr=0.0.0.0 --pprof.port=6061