connect to bootnode

This commit is contained in:
iskay 2023-05-09 22:56:44 +00:00
parent a6a1399138
commit 20884d8047
7 changed files with 111 additions and 73 deletions

View File

@ -11,15 +11,13 @@ services:
- ../config/fixturenet-lotus/genesis/devgen.car:/devgen.car - ../config/fixturenet-lotus/genesis/devgen.car:/devgen.car
- $HOME/stack-orchestrator/app/data/config/fixturenet-lotus/genesis/.genesis-sectors:/root/.genesis-sectors - $HOME/stack-orchestrator/app/data/config/fixturenet-lotus/genesis/.genesis-sectors:/root/.genesis-sectors
- lotus-shared:/root/.lotus-shared - lotus-shared:/root/.lotus-shared
# - lotus-local-net-shared:/root/.lotus-local-net
healthcheck: healthcheck:
test: ["CMD-SHELL", "grep 'started ChainNotify channel' /var/log/lotus.log"] # test: ["CMD-SHELL", "grep 'started ChainNotify channel' /var/log/lotus.log"]
test: ["CMD-SHELL", "[ -f /root/.lotus-shared/miner.addr ]"]
interval: 10s interval: 10s
timeout: 10s timeout: 10s
retries: 5 retries: 10
start_period: 30s start_period: 60s
# depends_on:
# - fixturenet-lotus-bootnode
entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-miner.sh"] entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-miner.sh"]
ports: ports:
- "1234" - "1234"
@ -35,22 +33,11 @@ services:
volumes: volumes:
- ../config/fixturenet-lotus/setup-node.sh:/docker-entrypoint-scripts.d/setup-node.sh - ../config/fixturenet-lotus/setup-node.sh:/docker-entrypoint-scripts.d/setup-node.sh
- ../config/fixturenet-lotus/genesis/devgen.car:/devgen.car - ../config/fixturenet-lotus/genesis/devgen.car:/devgen.car
# - ../config/fixturenet-lotus/genesis/.genesis-sectors:/root/.genesis-sectors
# - ./myscripts/pre-seal-t01000.key:/root/.genesis-sectors/pre-seal-t01000.key
# - ./myscripts/pre-seal-t01000.json:/root/.genesis-sectors/pre-seal-t01000.json
# - lotus-local-net-shared:/root/.lotus-local-net
- lotus-shared:/root/.lotus-shared - lotus-shared:/root/.lotus-shared
# healthcheck:
# test: ["CMD", "nc", "-v", "localhost", "8545"]
# interval: 30s
# timeout: 10s
# retries: 10
# start_period: 3s
depends_on: depends_on:
lotus-miner: lotus-miner:
condition: service_healthy condition: service_healthy
entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-node.sh"] entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-node.sh"]
# entrypoint: ["lotus", "--version"]
ports: ports:
- "1234" - "1234"
- "2345" - "2345"
@ -65,27 +52,16 @@ services:
volumes: volumes:
- ../config/fixturenet-lotus/setup-node.sh:/docker-entrypoint-scripts.d/setup-node.sh - ../config/fixturenet-lotus/setup-node.sh:/docker-entrypoint-scripts.d/setup-node.sh
- ../config/fixturenet-lotus/genesis/devgen.car:/devgen.car - ../config/fixturenet-lotus/genesis/devgen.car:/devgen.car
# - ../config/fixturenet-lotus/genesis/.genesis-sectors:/root/.genesis-sectors
# - ./myscripts/pre-seal-t01000.key:/root/.genesis-sectors/pre-seal-t01000.key
# - ./myscripts/pre-seal-t01000.json:/root/.genesis-sectors/pre-seal-t01000.json
# - lotus-local-net-shared:/root/.lotus-local-net
- lotus-shared:/root/.lotus-shared - lotus-shared:/root/.lotus-shared
# healthcheck:
# test: ["CMD", "nc", "-v", "localhost", "8545"]
# interval: 30s
# timeout: 10s
# retries: 10
# start_period: 3s
depends_on: depends_on:
lotus-miner: lotus-miner:
condition: service_healthy condition: service_healthy
entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-node.sh"] entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-node.sh"]
# entrypoint: ["lotus", "--version"]
ports: ports:
- "1234" - "1234"
- "2345" - "2345"
- "3456" - "3456"
- "1777" - "1777"
volumes: volumes:
lotus-shared: lotus-shared:

View File

@ -1,9 +1,26 @@
#!/bin/bash #!/bin/bash
lotus --version lotus --version
#lotus daemon --genesis=/devgen.car --profile=bootstrapper --bootstrap=false > /var/log/lotus.log 2>&1
#lotus daemon --genesis=/devgen.car --bootstrap=false
nohup lotus daemon --genesis=/devgen.car --profile=bootstrapper --bootstrap=false > /var/log/lotus.log 2>&1 & nohup lotus daemon --genesis=/devgen.car --profile=bootstrapper --bootstrap=false > /var/log/lotus.log 2>&1 &
# initialization check here # 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 not already initialized
if [ ! -f /root/.lotus-shared/miner.addr ]; then
# initialize miner
lotus wallet import --as-default ~/.genesis-sectors/pre-seal-t01000.key
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
# publish miner address to shared volume
lotus net listen | awk 'NR==1{print}' > /root/.lotus-shared/miner.addr
fi
nohup lotus-miner run --nosync &
tail -f /dev/null

View File

@ -1,4 +1,24 @@
#!/bin/bash #!/bin/bash
lotus --version lotus --version
lotus daemon --genesis=/devgen.car
##TODO: paths can use values from lotus-env.env file
# if not already initialized
if [ ! -f /root/.lotus-local-net/config.toml ]; then
# init node config
mkdir $HOME/.lotus-local-net
lotus config default > $HOME/.lotus-local-net/config.toml
# add bootstrap peer info if available
if [ -f /root/.lotus-shared/miner.addr ]; then
MINER_ADDR=\"$(cat /root/.lotus-shared/miner.addr)\"
# add bootstrap peer id to config file
sed -i "/^\[Libp2p\]/a \ \ BootstrapPeers = [$MINER_ADDR]" $HOME/.lotus-local-net/config.toml
else
echo "Bootstrap peer info not found, unable to configure. Manual peering will be required."
fi
fi
# start node
lotus daemon --genesis=/devgen.car

View File

@ -1,2 +1,2 @@
# This file should be re-generated running: scripts/create_build_tag_file.sh script # This file should be re-generated running: scripts/create_build_tag_file.sh script
1.1.0-882374a-202305060108 1.1.0-a6a1399-202305092241

View File

@ -10,15 +10,14 @@ services:
- ../config/fixturenet-lotus/setup-miner.sh:/docker-entrypoint-scripts.d/setup-miner.sh - ../config/fixturenet-lotus/setup-miner.sh:/docker-entrypoint-scripts.d/setup-miner.sh
- ../config/fixturenet-lotus/genesis/devgen.car:/devgen.car - ../config/fixturenet-lotus/genesis/devgen.car:/devgen.car
- $HOME/stack-orchestrator/app/data/config/fixturenet-lotus/genesis/.genesis-sectors:/root/.genesis-sectors - $HOME/stack-orchestrator/app/data/config/fixturenet-lotus/genesis/.genesis-sectors:/root/.genesis-sectors
# - lotus-local-net-shared:/root/.lotus-local-net - lotus-shared:/root/.lotus-shared
# healthcheck: healthcheck:
# test: ["CMD-SHELL", "grep 'started ChainNotify channel' /var/log/lotus.log"] # test: ["CMD-SHELL", "grep 'started ChainNotify channel' /var/log/lotus.log"]
# interval: 10s test: ["CMD-SHELL", "[ -f /root/.lotus-shared/miner.addr ]"]
# timeout: 10s interval: 10s
# retries: 5 timeout: 10s
# start_period: 30s retries: 10
# depends_on: start_period: 60s
# - fixturenet-lotus-bootnode
entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-miner.sh"] entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-miner.sh"]
ports: ports:
- "1234" - "1234"
@ -34,20 +33,11 @@ services:
volumes: volumes:
- ../config/fixturenet-lotus/setup-node.sh:/docker-entrypoint-scripts.d/setup-node.sh - ../config/fixturenet-lotus/setup-node.sh:/docker-entrypoint-scripts.d/setup-node.sh
- ../config/fixturenet-lotus/genesis/devgen.car:/devgen.car - ../config/fixturenet-lotus/genesis/devgen.car:/devgen.car
- ../config/fixturenet-lotus/genesis/.genesis-sectors:/root/.genesis-sectors - lotus-shared:/root/.lotus-shared
# - ./myscripts/pre-seal-t01000.key:/root/.genesis-sectors/pre-seal-t01000.key depends_on:
# - ./myscripts/pre-seal-t01000.json:/root/.genesis-sectors/pre-seal-t01000.json lotus-miner:
# - lotus-local-net-shared:/root/.lotus-local-net condition: service_healthy
# healthcheck:
# test: ["CMD", "nc", "-v", "localhost", "8545"]
# interval: 30s
# timeout: 10s
# retries: 10
# start_period: 3s
# depends_on:
# - fixturenet-lotus-1
entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-node.sh"] entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-node.sh"]
# entrypoint: ["lotus", "--version"]
ports: ports:
- "1234" - "1234"
- "2345" - "2345"
@ -62,22 +52,16 @@ services:
volumes: volumes:
- ../config/fixturenet-lotus/setup-node.sh:/docker-entrypoint-scripts.d/setup-node.sh - ../config/fixturenet-lotus/setup-node.sh:/docker-entrypoint-scripts.d/setup-node.sh
- ../config/fixturenet-lotus/genesis/devgen.car:/devgen.car - ../config/fixturenet-lotus/genesis/devgen.car:/devgen.car
- ../config/fixturenet-lotus/genesis/.genesis-sectors:/root/.genesis-sectors - lotus-shared:/root/.lotus-shared
# - ./myscripts/pre-seal-t01000.key:/root/.genesis-sectors/pre-seal-t01000.key depends_on:
# - ./myscripts/pre-seal-t01000.json:/root/.genesis-sectors/pre-seal-t01000.json lotus-miner:
# - lotus-local-net-shared:/root/.lotus-local-net condition: service_healthy
# healthcheck:
# test: ["CMD", "nc", "-v", "localhost", "8545"]
# interval: 30s
# timeout: 10s
# retries: 10
# start_period: 3s
# depends_on:
# - fixturenet-lotus-1
entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-node.sh"] entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-node.sh"]
# entrypoint: ["lotus", "--version"]
ports: ports:
- "1234" - "1234"
- "2345" - "2345"
- "3456" - "3456"
- "1777" - "1777"
volumes:
lotus-shared:

View File

@ -1,5 +1,26 @@
#!/bin/bash #!/bin/bash
lotus --version lotus --version
#lotus daemon --genesis=/devgen.car --profile=bootstrapper --bootstrap=false > /var/log/lotus.log 2>&1
lotus daemon --genesis=/devgen.car --bootstrap=false nohup lotus daemon --genesis=/devgen.car --profile=bootstrapper --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 not already initialized
if [ ! -f /root/.lotus-shared/miner.addr ]; then
# initialize miner
lotus wallet import --as-default ~/.genesis-sectors/pre-seal-t01000.key
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
# publish miner address to shared volume
lotus net listen | awk 'NR==1{print}' > /root/.lotus-shared/miner.addr
fi
nohup lotus-miner run --nosync &
tail -f /dev/null

View File

@ -1,4 +1,24 @@
#!/bin/bash #!/bin/bash
lotus --version lotus --version
lotus daemon --genesis=/devgen.car
##TODO: paths can use values from lotus-env.env file
# if not already initialized
if [ ! -f /root/.lotus-local-net/config.toml ]; then
# init node config
mkdir $HOME/.lotus-local-net
lotus config default > $HOME/.lotus-local-net/config.toml
# add bootstrap peer info if available
if [ -f /root/.lotus-shared/miner.addr ]; then
MINER_ADDR=\"$(cat /root/.lotus-shared/miner.addr)\"
# add bootstrap peer id to config file
sed -i "/^\[Libp2p\]/a \ \ BootstrapPeers = [$MINER_ADDR]" $HOME/.lotus-local-net/config.toml
else
echo "Bootstrap peer info not found, unable to configure. Manual peering will be required."
fi
fi
# start node
lotus daemon --genesis=/devgen.car