split up the big files
This commit is contained in:
28
polygon/bor/Dockerfile
Normal file
28
polygon/bor/Dockerfile
Normal 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" ]
|
||||
60
polygon/bor/scripts/entrypoint.sh
Executable file
60
polygon/bor/scripts/entrypoint.sh
Executable 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
|
||||
50
polygon/geth-mainnet.yml
Normal file
50
polygon/geth-mainnet.yml
Normal file
@@ -0,0 +1,50 @@
|
||||
version: '3.1'
|
||||
|
||||
services:
|
||||
geth-mainnet:
|
||||
image: ethereum/client-go:stable
|
||||
expose:
|
||||
# HTTP server / GraphQL API
|
||||
- 8545
|
||||
ports:
|
||||
- "30303:30303"
|
||||
- "30303:30303/udp"
|
||||
command:
|
||||
[
|
||||
# Blockchain sync mode ("snap", "full" or "light")
|
||||
"--syncmode=snap",
|
||||
# Megabytes of memory allocated to internal caching
|
||||
"--cache=8192",
|
||||
# Enable the WS-RPC server
|
||||
"--ws",
|
||||
"--ws.addr=0.0.0.0",
|
||||
# Enable the HTTP-RPC server
|
||||
"--http",
|
||||
"--http.addr=0.0.0.0",
|
||||
"--http.vhosts=*",
|
||||
# Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well.
|
||||
"--graphql",
|
||||
"--graphql.vhosts=*",
|
||||
# Enable metrics collection and reporting
|
||||
"--metrics",
|
||||
# Ethereum mainnet
|
||||
"--mainnet",
|
||||
# Maximum number of network peers (network disabled if set to 0) (default: 50)
|
||||
"--maxpeers=30"
|
||||
]
|
||||
networks:
|
||||
- chains
|
||||
volumes:
|
||||
- "geth-mainnet_data:/root/.ethereum"
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.middlewares.ipwhitelist.ipwhitelist.sourcerange=$WHITELIST"
|
||||
- "traefik.http.middlewares.mainnet-stripprefix.stripprefix.prefixes=/mainnet"
|
||||
- "traefik.http.services.mainnet.loadbalancer.server.port=8545"
|
||||
- "traefik.http.routers.mainnet.entrypoints=websecure"
|
||||
- "traefik.http.routers.mainnet.tls.certresolver=myresolver"
|
||||
- "traefik.http.routers.mainnet.rule=Host(`$DOMAIN`) && PathPrefix(`/mainnet`)"
|
||||
- "traefik.http.routers.mainnet.middlewares=mainnet-stripprefix, ipwhitelist"
|
||||
|
||||
volumes:
|
||||
geth-mainnet_data:
|
||||
28
polygon/heimdall/Dockerfile
Normal file
28
polygon/heimdall/Dockerfile
Normal file
@@ -0,0 +1,28 @@
|
||||
# Build and Install Heimdall in a stock Go builder container
|
||||
FROM golang:1.16-alpine
|
||||
|
||||
# Install packages we need
|
||||
RUN apk add --no-cache make gcc musl-dev linux-headers git
|
||||
|
||||
# create go src directory and clone heimdall
|
||||
RUN mkdir -p /root/heimdall
|
||||
|
||||
# Grab UPSTREAM_VERSION from Build Args
|
||||
ARG UPSTREAM_VERSION
|
||||
|
||||
# Clone hemidall release into folder
|
||||
RUN git clone --branch ${UPSTREAM_VERSION} https://github.com/maticnetwork/heimdall.git /root/heimdall
|
||||
|
||||
# change work directory
|
||||
WORKDIR /root/heimdall
|
||||
|
||||
# GOBIN required for go install
|
||||
ENV GOBIN $GOPATH/bin
|
||||
|
||||
# Make and Install Heimdall
|
||||
RUN make install
|
||||
|
||||
# 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" ]
|
||||
50
polygon/heimdall/scripts/entrypoint.sh
Executable file
50
polygon/heimdall/scripts/entrypoint.sh
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/sh [1/1829]
|
||||
|
||||
# exit script on any error
|
||||
set -e
|
||||
|
||||
# Set Heimdall Home Directory
|
||||
HEIMDALLD_HOME=/root/.heimdalld
|
||||
|
||||
if [ ! -f "$HEIMDALLD_HOME/config/config.toml" ];
|
||||
then
|
||||
echo "setting up initial configurations"
|
||||
heimdalld init
|
||||
cd $HEIMDALLD_HOME/config
|
||||
|
||||
echo "removing autogenerated genesis file"
|
||||
rm genesis.json
|
||||
|
||||
echo "downloading launch genesis file"
|
||||
wget https://raw.githubusercontent.com/maticnetwork/launch/master/mainnet-v1/without-sentry/heimdall/config/genesis.json
|
||||
|
||||
echo "overwriting toml config lines"
|
||||
# config.toml
|
||||
# CORS
|
||||
sed -i "s#^cors_allowed_origins.*#cors_allowed_origins = [\"*\"]#" config.toml
|
||||
# SEEDS
|
||||
sed -i "s#^seeds.*#seeds = \"${BOOTNODES:-"f4f605d60b8ffaaf15240564e58a81103510631c@159.203.9.164:26656,4fb1bc820088764a564d4f66bba1963d47d82329@44.232.55.71:26656"}\"#" config.toml
|
||||
# heimdall-config.toml
|
||||
# BOR
|
||||
sed -i "s#^bor_rpc_url.*#bor_rpc_url = \"http://bor:8545\"#" heimdall-config.toml
|
||||
# ETH1
|
||||
sed -i "s#^eth_rpc_url.*#eth_rpc_url = \"${ETH1_RPC_URL}\"#" heimdall-config.toml
|
||||
# RABBITMQ
|
||||
sed -i "s#^amqp_url.*#amqp_url = \"amqp://guest:guest@rabbitmq:5672\"#" heimdall-config.toml
|
||||
fi
|
||||
|
||||
if [ "${BOOTSTRAP}" == 1 ] && [ -n "${SNAPSHOT_URL}" ] && [ ! -f "$HEIMDALLD_HOME/bootstrapped" ];
|
||||
then
|
||||
echo "downloading snapshot from ${SNAPSHOT_URL}"
|
||||
mkdir -p ${HEIMDALLD_HOME}/data
|
||||
wget -c "${SNAPSHOT_URL}" -O - | tar -xz -C ${HEIMDALLD_HOME}/data && touch ${HEIMDALLD_HOME}/bootstrapped
|
||||
fi
|
||||
|
||||
if [ -n "$REST_SERVER" ];
|
||||
then
|
||||
EXEC="heimdalld rest-server --chain-id=137 --laddr=tcp://0.0.0.0:1317 --max-open=1000 --node=tcp://heimdalld:26657 --trust-node=true"
|
||||
else
|
||||
EXEC="heimdalld start --moniker=$MONIKER --fast_sync --p2p.laddr=tcp://0.0.0.0:26656 --p2p.upnp=false --pruning=syncable --rpc.laddr=tcp://0.0.0.0:26657 --with-tendermint=true"
|
||||
fi
|
||||
|
||||
exec ${EXEC}
|
||||
Reference in New Issue
Block a user