stack-orchestrator/app/data/config/fixturenet-lotus/setup-miner.sh
prathamesh0 53ed18b3dc
Update sushiswap-subgraph stack to point to filecoin endpoint (#509)
* Update sushiswap-subgraph stack to point to filecoin endpoint

* Deploy blocks subgraph in sushiswap-subgraph stack

* Update subgraph config

* Remove duplicate nativePricePool

* Enable debug logs in graph-node and update instructions

* Two additional miner nodes in fixturenet-lotus

* Revert experimental change for additional miner nodes

* Set ETHEREUM_REORG_THRESHOLD env for graph-node to catch up to head

* Take ETH RPC endpoint for graph-node from env

* Set default values for RPC endpoint in graph-node

* Rename fixturenet-graph-node pod to graph-node

* Clean up sushiswap-subgraph stack

* Use deployment command in sushiswap-subgraph stack

* Add a separate fixturenet-sushiswap-subgraph stack

* Fix pods in fixturenet-sushiswap-subgraph

* Fix fixturenet subgraph deployment commands and instructions

---------

Co-authored-by: Nabarun <nabarun@deepstacksoft.com>
2023-08-30 16:05:16 +05:30

54 lines
1.9 KiB
Bash

#!/bin/bash
lotus --version
# remove old bootnode peer info if present
if [ -f /root/.lotus-shared/miner.addr ]; then
rm /root/.lotus-shared/miner.addr
fi
# Check if filecoin-proof-parameters exist; avoid fetching if they do
if [ -z "$(find "/var/tmp/filecoin-proof-parameters" -maxdepth 1 -type f)" ]; then
echo "Proof params not found, fetching..."
lotus fetch-params 2048
else
echo "Existing proof params found"
fi
# 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-sectors genesis new /root/data/localnet.json
lotus-seed --sector-dir /root/data/.genesis-sectors genesis add-miner /root/data/localnet.json /root/data/.genesis-sectors/pre-seal-t01000.json
fi
# start daemon
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..."
while ! grep -q "started ChainNotify channel" /var/log/lotus.log ; do
sleep 5
done
echo "Daemon started."
# if miner not already initialized
if [ ! -d $LOTUS_MINER_PATH ]; then
# initialize miner
lotus wallet import --as-default /root/data/.genesis-sectors/pre-seal-t01000.key
# fund a known account for usage
/fund-account.sh
echo "Initializing miner..."
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
# 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
# start miner
nohup lotus-miner run --nosync &
tail -f /dev/null