Persist lotus node data to support restarts
This commit is contained in:
parent
656e67ff03
commit
55a72bb4c9
@ -11,6 +11,7 @@ services:
|
||||
- ../config/fixturenet-lotus/fund-account.sh:/fund-account.sh
|
||||
- lotus_miner_params:/var/tmp/filecoin-proof-parameters
|
||||
- lotus-shared:/root/.lotus-shared
|
||||
- lotus_miner_data:/root/data
|
||||
entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-miner.sh"]
|
||||
ports:
|
||||
- "1234"
|
||||
@ -30,6 +31,7 @@ services:
|
||||
- ../config/fixturenet-lotus/setup-node.sh:/docker-entrypoint-scripts.d/setup-node.sh
|
||||
- lotus_node_1_params:/var/tmp/filecoin-proof-parameters
|
||||
- lotus-shared:/root/.lotus-shared
|
||||
- lotus_node_1_data:/root/data
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-vz", "localhost", "1234"]
|
||||
interval: 30s
|
||||
@ -57,6 +59,7 @@ services:
|
||||
- ../config/fixturenet-lotus/setup-node.sh:/docker-entrypoint-scripts.d/setup-node.sh
|
||||
- lotus_node_2_params:/var/tmp/filecoin-proof-parameters
|
||||
- lotus-shared:/root/.lotus-shared
|
||||
- lotus_node_2_data:/root/data
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-vz", "localhost", "1234"]
|
||||
interval: 30s
|
||||
@ -77,3 +80,6 @@ volumes:
|
||||
lotus_node_1_params:
|
||||
lotus_node_2_params:
|
||||
lotus-shared:
|
||||
lotus_miner_data:
|
||||
lotus_node_1_data:
|
||||
lotus_node_2_data:
|
||||
|
@ -1,5 +1,5 @@
|
||||
LOTUS_PATH=/root/.lotus-local-net
|
||||
LOTUS_MINER_PATH=/root/.lotus-miner-local-net
|
||||
LOTUS_PATH=/root/data/.lotus-local-net
|
||||
LOTUS_MINER_PATH=/root/data/.lotus-miner-local-net
|
||||
LOTUS_SKIP_GENESIS_CHECK=_yes_
|
||||
LOTUS_FEVM_ENABLEETHRPC=true
|
||||
CGO_CFLAGS_ALLOW="-D__BLST_PORTABLE__"
|
||||
|
@ -15,12 +15,16 @@ else
|
||||
echo "Existing proof params found"
|
||||
fi
|
||||
|
||||
lotus-seed pre-seal --sector-size 2KiB --num-sectors 2
|
||||
lotus-seed genesis new localnet.json
|
||||
lotus-seed genesis add-miner localnet.json ~/.genesis-sectors/pre-seal-t01000.json
|
||||
# if genesis is not already setup
|
||||
if [ ! -f /root/data/localnet.json ]; then
|
||||
lotus-seed --sector-dir /root/data/.genesis-sectors pre-seal --sector-size 2KiB --num-sectors 2
|
||||
lotus-seed --sector-dir /root/data/ genesis new /root/data/localnet.json
|
||||
lotus-seed --sector-dir /root/data/ genesis add-miner /root/data/localnet.json /root/data/.genesis-sectors/pre-seal-t01000.json
|
||||
fi
|
||||
|
||||
# start daemon
|
||||
nohup lotus daemon --lotus-make-genesis=devgen.car --profile=bootstrapper --genesis-template=localnet.json --bootstrap=false > /var/log/lotus.log 2>&1 &
|
||||
# /root/.lotus-shared/devgen.car path
|
||||
nohup lotus daemon --lotus-make-genesis=/root/.lotus-shared/devgen.car --profile=bootstrapper --genesis-template=/root/data/localnet.json --bootstrap=false > /var/log/lotus.log 2>&1 &
|
||||
|
||||
# Loop until the daemon is started
|
||||
echo "Waiting for daemon to start..."
|
||||
@ -29,21 +33,18 @@ while ! grep -q "started ChainNotify channel" /var/log/lotus.log ; do
|
||||
done
|
||||
echo "Daemon started."
|
||||
|
||||
# copy genesis file to shared volume
|
||||
cp /devgen.car /root/.lotus-shared
|
||||
|
||||
# publish bootnode peer info to shared volume
|
||||
lotus net listen | grep "$(ip addr | grep inet | grep -v '127.0.0.1' | sort | head -1 | awk '{print $2}' | cut -d '/' -f1)" | head -1 > /root/.lotus-shared/miner.addr
|
||||
|
||||
# if miner not already initialized
|
||||
if [ ! -d $LOTUS_MINER_PATH ]; then
|
||||
# initialize miner
|
||||
lotus wallet import --as-default ~/.genesis-sectors/pre-seal-t01000.key
|
||||
lotus wallet import --as-default /root/data/.genesis-sectors/pre-seal-t01000.key
|
||||
|
||||
# fund a known account for usage
|
||||
/fund-account.sh
|
||||
|
||||
lotus-miner init --genesis-miner --actor=t01000 --sector-size=2KiB --pre-sealed-sectors=~/.genesis-sectors --pre-sealed-metadata=~/.genesis-sectors/pre-seal-t01000.json --nosync
|
||||
lotus-miner init --genesis-miner --actor=t01000 --sector-size=2KiB --pre-sealed-sectors=/root/data/.genesis-sectors --pre-sealed-metadata=/root/data/.genesis-sectors/pre-seal-t01000.json --nosync
|
||||
fi
|
||||
|
||||
# start miner
|
||||
|
@ -9,10 +9,8 @@ while [ ! -f /root/.lotus-shared/miner.addr ]; do
|
||||
done
|
||||
echo "Resuming..."
|
||||
|
||||
# if not already initialized
|
||||
if [ ! -f $LOTUS_PATH/config.toml ]; then
|
||||
# init node config
|
||||
mkdir $LOTUS_PATH
|
||||
mkdir -p $LOTUS_PATH
|
||||
lotus config default > $LOTUS_PATH/config.toml
|
||||
|
||||
# add bootstrap peer info if available
|
||||
@ -23,7 +21,6 @@ if [ ! -f $LOTUS_PATH/config.toml ]; then
|
||||
else
|
||||
echo "Bootstrap peer info not found, unable to configure. Manual peering will be required."
|
||||
fi
|
||||
fi
|
||||
|
||||
# start node
|
||||
lotus daemon --genesis=/root/.lotus-shared/devgen.car
|
||||
|
Loading…
Reference in New Issue
Block a user