split up the big files

This commit is contained in:
czarly
2022-03-14 17:49:20 +04:00
parent 258608bb04
commit 6ddc7d5926
23 changed files with 826 additions and 467 deletions

28
polygon/bor/Dockerfile Normal file
View File

@@ -0,0 +1,28 @@
# Build Bor in a stock Go builder container
FROM golang:1.16-alpine as builder
# Install packages we need
RUN apk add --no-cache make gcc musl-dev linux-headers git
# Make a folder to work in
RUN mkdir /bor
# Grab UPSTREAM_VERSION from Build Args
ARG UPSTREAM_VERSION
# Clone the repo to that folder
RUN git clone --branch ${UPSTREAM_VERSION} https://github.com/maticnetwork/bor.git /bor
# Build Bor
RUN cd /bor && make bor
# Pull Bor into a second stage deploy alpine container
FROM alpine:latest
RUN apk add --no-cache ca-certificates curl jq
COPY --from=builder /bor/build/bin/bor /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,60 @@
#!/bin/sh
# exit script on any error
set -e
# Set Bor Home Directory
BOR_HOME=/datadir
# Check for genesis file and download or update it if needed
if [ ! -f "${BOR_HOME}/genesis.json" ];
then
echo "setting up initial configurations"
cd ${BOR_HOME}
echo "downloading launch genesis file"
wget https://raw.githubusercontent.com/maticnetwork/launch/master/mainnet-v1/sentry/sentry/bor/genesis.json
echo "initializing bor with genesis file"
bor --datadir ${BOR_HOME} init ${BOR_HOME}/genesis.json
else
# Check if genesis file needs updating
cd ${BOR_HOME}
GREPSTRING=$(grep londonBlock genesis.json | wc -l) # v0-2-13 Update
if [ ${GREPSTRING} == 0 ];
then
echo "Updating Genesis File"
wget https://raw.githubusercontent.com/maticnetwork/launch/master/mainnet-v1/sentry/sentry/bor/genesis.json
bor --datadir ${BOR_HOME} init ${BOR_HOME}/genesis.json
fi
fi
if [ "${BOOTSTRAP}" == 1 ] && [ -n "${SNAPSHOT_URL}" ] && [ ! -f "${BOR_HOME}/bootstrapped" ];
then
echo "downloading snapshot from ${SNAPSHOT_URL}"
mkdir -p ${BOR_HOME}/bor/chaindata
wget -c "${SNAPSHOT_URL}" -O - | tar -xz -C ${BOR_HOME}/bor/chaindata && touch ${BOR_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
if [ "${ARCHIVE}" == 1 ];
then
exec bor --port=40303 --maxpeers=${MAXPEERS:-200} --datadir=/datadir --networkid=137 --syncmode=full --gcmode=archive \
--ipcpath ${BOR_HOME}/bor.ipc --bor.heimdall=http://heimdallr:1317 \
--txpool.accountslots=16 --txpool.globalslots=131072 --txpool.accountqueue=64 --txpool.globalqueue=131072 \
--txpool.lifetime='1h30m0s' --miner.gaslimit=200000000 --miner.gastarget=20000000 --miner.gasprice '30000000000' \
--http --http.addr=0.0.0.0 --http.port=8545 --http.api=eth,net,web3,txpool,bor --http.corsdomain="*" --http.vhosts="*" \
--ws --ws.addr=0.0.0.0 --ws.port=8545 --ws.api=eth,net,web3,txpool,bor --ws.origins="*"
else
exec bor --port=40303 --maxpeers=${MAXPEERS:-200} --datadir=/datadir --networkid=137 --syncmode=full \
--ipcpath ${BOR_HOME}/bor.ipc --bor.heimdall=http://heimdallr:1317 \
--txpool.accountslots=16 --txpool.globalslots=131072 --txpool.accountqueue=64 --txpool.globalqueue=131072 \
--txpool.lifetime='1h30m0s' --miner.gaslimit=200000000 --miner.gastarget=20000000 --miner.gasprice '30000000000' \
--http --http.addr=0.0.0.0 --http.port=8545 --http.api=eth,net,web3,txpool,bor --http.corsdomain="*" --http.vhosts="*" \
--ws --ws.addr=0.0.0.0 --ws.port=8545 --ws.api=eth,net,web3,txpool,bor --ws.origins="*"
fi