Load from a snapshot if provided
This commit is contained in:
parent
a2abcff2a7
commit
aa04f65468
@ -10,9 +10,11 @@ services:
|
|||||||
- ../config/docker-entrypoint.sh:/bsc/docker-entrypoint.sh
|
- ../config/docker-entrypoint.sh:/bsc/docker-entrypoint.sh
|
||||||
- data:/data
|
- data:/data
|
||||||
- bsc:/bsc
|
- bsc:/bsc
|
||||||
|
- snapshot:/var/tmp/snapshot
|
||||||
ports:
|
ports:
|
||||||
- 30303:30303
|
- 30303:30303
|
||||||
- 30311:30311
|
- 30311:30311
|
||||||
|
- 6060:6060
|
||||||
- 8545:8545
|
- 8545:8545
|
||||||
- 8546:8546
|
- 8546:8546
|
||||||
healthcheck:
|
healthcheck:
|
||||||
@ -25,3 +27,4 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
data:
|
data:
|
||||||
bsc:
|
bsc:
|
||||||
|
snapshot:
|
||||||
|
@ -16,9 +16,22 @@ else
|
|||||||
unzip config.zip -d config
|
unzip config.zip -d config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Use snapshot if provided
|
||||||
|
geth_dir=${DATA_DIR}/geth
|
||||||
|
snapshot_file=$((ls /var/dev/snapshot/*.tar.lz4) 2>/dev/null | head -1)
|
||||||
|
if [ ! -d "$geth_dir" ] && [ -n "$snapshot_file" ]; then
|
||||||
|
echo Using snapshot $snapshot_file
|
||||||
|
|
||||||
|
if [ "$CERC_BSC_NETWORK" = "testnet" ]; then
|
||||||
|
# snapshot dir structure for testnet different than that for mainnet
|
||||||
|
tar -C /${DATA_DIR}/ -I lz4 -xvf ${snapshot_file} --strip-components=3 server/testnet/dataseed/geth
|
||||||
|
else
|
||||||
|
tar -C /${DATA_DIR}/ -I lz4 -xvf ${snapshot_file} --strip-components=2 server/data-seed/geth
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Init genesis state if geth sub dir does not exist
|
# Init genesis state if geth sub dir does not exist
|
||||||
GETH_DIR=${DATA_DIR}/geth
|
if [ ! -d "$geth_dir" ]; then
|
||||||
if [ ! -d "$GETH_DIR" ]; then
|
|
||||||
STATE_SCHEME_OPTS=""
|
STATE_SCHEME_OPTS=""
|
||||||
if [ "$CERC_GETH_GCMODE" = "archive" ]; then
|
if [ "$CERC_GETH_GCMODE" = "archive" ]; then
|
||||||
# Archive mode only works with state.scheme set to hash
|
# Archive mode only works with state.scheme set to hash
|
||||||
@ -34,6 +47,7 @@ fi
|
|||||||
exec "geth" \
|
exec "geth" \
|
||||||
--config="${BSC_CONFIG}" \
|
--config="${BSC_CONFIG}" \
|
||||||
--datadir="${DATA_DIR}" \
|
--datadir="${DATA_DIR}" \
|
||||||
|
--rpc.allow-unprotected-txs \
|
||||||
--http \
|
--http \
|
||||||
--http.addr="0.0.0.0" \
|
--http.addr="0.0.0.0" \
|
||||||
--http.port 8545 \
|
--http.port 8545 \
|
||||||
|
Loading…
Reference in New Issue
Block a user