Devnet 3; Builtin bootstrap; NAT Port Map
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
[Libp2p]
|
||||
ListenAddresses = ["/ip4/0.0.0.0/tcp/1347"]
|
||||
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Lotus Daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/lotus daemon
|
||||
|
||||
[Install]
|
||||
WantedBy=multiuser.target
|
||||
Executable
+110
@@ -0,0 +1,110 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
############
|
||||
## Settings
|
||||
GENESIS_HOST=root@147.75.80.29
|
||||
BOOTSTRAPPERS=( root@147.75.80.17 )
|
||||
|
||||
############
|
||||
|
||||
log() {
|
||||
echo -e "\e[33m$1\e[39m"
|
||||
}
|
||||
|
||||
rm -f build/bootstrap/*.pi
|
||||
|
||||
log '> Generating genesis'
|
||||
|
||||
make
|
||||
|
||||
GENPATH=$(mktemp -d)
|
||||
|
||||
log 'staring temp daemon'
|
||||
|
||||
./lotus --repo="${GENPATH}" daemon --lotus-make-random-genesis="${GENPATH}/devnet.car" &
|
||||
GDPID=$!
|
||||
|
||||
sleep 3
|
||||
|
||||
log 'Extracting genesis miner prvate key'
|
||||
|
||||
ADDR=$(./lotus --repo="${GENPATH}" wallet list)
|
||||
./lotus --repo="${GENPATH}" wallet export "$ADDR" > "${GENPATH}/wallet.key"
|
||||
|
||||
kill "$GDPID"
|
||||
|
||||
wait
|
||||
|
||||
log '> Creating genesis binary'
|
||||
cp "${GENPATH}/devnet.car" build/genesis/devnet.car
|
||||
rm -f build/bootstrap/*.pi
|
||||
|
||||
make
|
||||
|
||||
log '> Deploying and starting genesis miner'
|
||||
|
||||
ssh $GENESIS_HOST 'systemctl stop lotus-daemon' &
|
||||
ssh $GENESIS_HOST 'systemctl stop lotus-storage-miner' &
|
||||
|
||||
wait
|
||||
|
||||
ssh $GENESIS_HOST 'rm -rf .lotus' &
|
||||
ssh $GENESIS_HOST 'rm -rf .lotusstorage' &
|
||||
|
||||
scp -C lotus "${GENESIS_HOST}":/usr/local/bin/lotus &
|
||||
scp -C lotus-storage-miner "${GENESIS_HOST}":/usr/local/bin/lotus-storage-miner &
|
||||
|
||||
wait
|
||||
|
||||
log 'Initializing genesis miner repo'
|
||||
|
||||
ssh $GENESIS_HOST 'systemctl start lotus-daemon'
|
||||
|
||||
scp scripts/bootstrap.toml "${GENESIS_HOST}:.lotus/config.toml" &
|
||||
ssh < "${GENPATH}/wallet.key" $GENESIS_HOST '/usr/local/bin/lotus wallet import' &
|
||||
wait
|
||||
|
||||
ssh $GENESIS_HOST 'systemctl restart lotus-daemon'
|
||||
|
||||
log 'Starting genesis mining'
|
||||
|
||||
ssh $GENESIS_HOST '/usr/local/bin/lotus-storage-miner init --genesis-miner --actor=t0101'
|
||||
ssh $GENESIS_HOST 'systemctl start lotus-storage-miner'
|
||||
|
||||
|
||||
log 'Getting genesis addr info'
|
||||
|
||||
ssh $GENESIS_HOST './lotus net listen' | grep -v '/10' | grep -v '/127' > build/bootstrap/root.pi
|
||||
|
||||
log '> Creating bootstrap binaries'
|
||||
make
|
||||
|
||||
|
||||
for host in "${BOOTSTRAPPERS[@]}"
|
||||
do
|
||||
log "> Deploying bootstrap node $host"
|
||||
log "Stopping lotus daemon"
|
||||
|
||||
ssh "$host" 'systemctl stop lotus-daemon' &
|
||||
ssh "$host" 'systemctl stop lotus-storage-miner' &
|
||||
|
||||
wait
|
||||
|
||||
ssh "$host" 'rm -rf .lotus' &
|
||||
ssh "$host" 'rm -rf .lotusstorage' &
|
||||
|
||||
scp -C lotus "${host}":/usr/local/bin/lotus &
|
||||
scp -C lotus-storage-miner "${host}":/usr/local/bin/lotus-storage-miner &
|
||||
|
||||
wait
|
||||
|
||||
log 'Initializing repo'
|
||||
|
||||
ssh "$host" 'systemctl start lotus-daemon'
|
||||
scp scripts/bootstrap.toml "${host}:.lotus/config.toml"
|
||||
ssh "$host" 'systemctl restart lotus-daemon'
|
||||
|
||||
log 'Extracting addr info'
|
||||
|
||||
ssh "$host" './lotus net listen' | grep -v '/10' | grep -v '/127' >> build/bootstrap/bootstrappers.pi
|
||||
done
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
HOST=$1
|
||||
|
||||
scp scripts/daemon.service "${HOST}:/etc/systemd/system/lotus-daemon.service"
|
||||
scp scripts/sminer.service "${HOST}:/etc/systemd/system/lotus-storage-miner.service"
|
||||
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Lotus Storage Miner
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/lotus-storage-miner run
|
||||
|
||||
[Install]
|
||||
WantedBy=multiuser.target
|
||||
Reference in New Issue
Block a user