Add a stack to run a BSC node #1
@ -2,12 +2,13 @@ services:
|
||||
bsc:
|
||||
image: ghcr.io/bnb-chain/bsc:1.4.8
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
# environment:
|
||||
volumes:
|
||||
- ../config/docker-entrypoint.sh:/bsc/docker-entrypoint.sh
|
||||
- data:/data
|
||||
- config:/bsc/config
|
||||
- bsc:/bsc
|
||||
ports:
|
||||
- 30303:30303
|
||||
- 30311:30311
|
||||
- 8545:8545
|
||||
- 8546:8546
|
||||
@ -20,4 +21,4 @@ services:
|
||||
|
||||
volumes:
|
||||
data:
|
||||
config:
|
||||
bsc:
|
||||
|
@ -1,19 +1,28 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# TODO: Check for testnet flag
|
||||
# TODO: Download and unzip the config files
|
||||
|
||||
BSC_CONFIG=${BSC_HOME}/config/config.toml
|
||||
BSC_GENESIS=${BSC_HOME}/config/genesis.json
|
||||
|
||||
# Init genesis state if geth not exist
|
||||
DATA_DIR=$(cat ${BSC_CONFIG} | grep -A1 '\[Node\]' | grep -oP '\"\K.*?(?=\")')
|
||||
# TODO: Check for testnet flag
|
||||
|
||||
if [ -f "$BSC_CONFIG" ]; then
|
||||
echo "Config file found at $BSC_CONFIG"
|
||||
else
|
||||
echo "Config file not found at $BSC_CONFIG, downloading..."
|
||||
|
||||
# Download and unzip the config files
|
||||
wget -O config.zip $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep mainnet |cut -d\" -f4)
|
||||
unzip config.zip -d config
|
||||
fi
|
||||
|
||||
# Init genesis state if geth sub dir does not exist
|
||||
GETH_DIR=${DATA_DIR}/geth
|
||||
if [ ! -d "$GETH_DIR" ]; then
|
||||
echo Initializing geth...
|
||||
geth --datadir ${DATA_DIR} init ${BSC_GENESIS}
|
||||
echo Initialization done
|
||||
fi
|
||||
|
||||
# TODO: Check for archive mode flag
|
||||
exec "geth" "--config" ${BSC_CONFIG} "$@"
|
||||
exec "geth" "--config" ${BSC_CONFIG} "--datadir" ${DATA_DIR} "$@"
|
||||
|
Loading…
Reference in New Issue
Block a user