Lotus #392

Merged
iskay merged 11 commits from lotus into main 2023-05-17 21:11:56 +00:00
7 changed files with 54 additions and 51 deletions
Showing only changes of commit 5aedda97fe - Show all commits

View File

@ -13,7 +13,8 @@ services:
- lotus-shared:/root/.lotus-shared
healthcheck:
# test: ["CMD-SHELL", "grep 'started ChainNotify channel' /var/log/lotus.log"]
test: ["CMD-SHELL", "[ -f /root/.lotus-shared/miner.addr ]"]
# test: ["CMD-SHELL", "[ -f /root/.lotus-shared/miner.addr ]"]
test: ["CMD-SHELL", "[ -d /root/.lotus-miner-local-net ]"]
interval: 10s
timeout: 10s
retries: 10

View File

@ -2,6 +2,10 @@
lotus --version
# # remove old bootnode peer info if present
# [ -f /root/.lotus-shared/miner.addr ] && rm /root/.lotus-shared/miner.addr
# start daemon
nohup lotus daemon --genesis=/devgen.car --profile=bootstrapper --bootstrap=false > /var/log/lotus.log 2>&1 &
# Loop until the daemon is started
@ -11,16 +15,17 @@ while ! grep -q "started ChainNotify channel" /var/log/lotus.log ; do
done
echo "Daemon started."
# if not already initialized
if [ ! -f /root/.lotus-shared/miner.addr ]; then
# publish bootnode peer info to shared volume
lotus net listen | awk 'NR==1{print}' > /root/.lotus-shared/miner.addr
# if miner not already initialized
if [ ! -d /root/.lotus-miner-local-net ]; 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
# start miner
nohup lotus-miner run --nosync &
tail -f /dev/null

View File

@ -14,44 +14,15 @@ $ laconic-so --stack fixturenet-lotus build-containers
```
$ laconic-so --stack fixturenet-lotus deploy up
```
Correct operation should be verified by checking the laconicd container's logs with:
Correct operation should be verified by checking the container logs with:
```
$ laconic-so --stack fixturenet-lotus deploy logs
$ laconic-so --stack fixturenet-lotus deploy logs lotus-miner
$ laconic-so --stack fixturenet-lotus deploy logs lotus-node-1
$ laconic-so --stack fixturenet-lotus deploy logs lotus-node-2
```
## 4. Get the multiaddress of miner node
The full nodes will need the multiaddress of the miner node to form a peer connection. Find the miner's multiaddress with:
```
$ laconic-so --stack fixturenet-lotus deploy exec lotus-miner "lotus net listen"
/ip4/192.168.160.4/tcp/44523/p2p/12D3KooWQiLfXiyQQY79Bn4Yhuti2PwekBc6cccp1rFpCo5WssLC
/ip4/127.0.0.1/tcp/44523/p2p/12D3KooWQiLfXiyQQY79Bn4Yhuti2PwekBc6cccp1rFpCo5WssLC
```
(Your node id will be different) Note the multiaddress and save it for a later step.
## 5. Start the miner
Import the key:
```
$ laconic-so --stack fixturenet-lotus deploy exec lotus-miner "lotus wallet import --as-default ~/.genesis-sectors/pre-seal-t01000.key"
imported key t3spusn5ia57qezc3fwpe3n2lhb4y4xt67xoflqbqy2muliparw2uktevletuv7gl4qakjpafgcl7jk2s2er3q successfully!
```
Init the miner (this will take several minutes):
```
$ laconic-so --stack fixturenet-lotus deploy exec lotus-miner "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"
...
...
2023-05-08T15:48:32.660Z INFO main lotus-miner/init.go:282 Miner successfully created, you can now start it with 'lotus-miner run'
```
Start the miner:
```
$ laconic-so --stack fixturenet-lotus deploy exec lotus-miner "lotus-miner run --nosync"
```
## 6. Connect the nodes
Connect each full node to the miner using the multiaddress from step 4.
```
$ laconic-so --stack fixturenet-lotus deploy exec lotus-node-1 "lotus net connect <MULTIADDRESS_OF_MINER>"
connect 12D3KooWQiLfXiyQQY79Bn4Yhuti2PwekBc6cccp1rFpCo5WssLC: success
$ laconic-so --stack fixturenet-lotus deploy exec lotus-node-2 "lotus net connect <MULTIADDRESS_OF_MINER>"
connect 12D3KooWQiLfXiyQQY79Bn4Yhuti2PwekBc6cccp1rFpCo5WssLC: success
or by checking the chain status on each node:
```
$ laconic-so --stack fixturenet-lotus deploy exec lotus-miner "lotus status"
$ laconic-so --stack fixturenet-lotus deploy exec lotus-node-1 "lotus status"
$ laconic-so --stack fixturenet-lotus deploy exec lotus-node-2 "lotus status"
```

View File

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

View File

@ -13,7 +13,8 @@ services:
- lotus-shared:/root/.lotus-shared
healthcheck:
# test: ["CMD-SHELL", "grep 'started ChainNotify channel' /var/log/lotus.log"]
test: ["CMD-SHELL", "[ -f /root/.lotus-shared/miner.addr ]"]
# test: ["CMD-SHELL", "[ -f /root/.lotus-shared/miner.addr ]"]
test: ["CMD-SHELL", "[ -d /root/.lotus-miner-local-net ]"]
interval: 10s
timeout: 10s
retries: 10

View File

@ -2,6 +2,10 @@
lotus --version
# # remove old bootnode peer info if present
# [ -f /root/.lotus-shared/miner.addr ] && rm /root/.lotus-shared/miner.addr
# start daemon
nohup lotus daemon --genesis=/devgen.car --profile=bootstrapper --bootstrap=false > /var/log/lotus.log 2>&1 &
# Loop until the daemon is started
@ -11,16 +15,17 @@ while ! grep -q "started ChainNotify channel" /var/log/lotus.log ; do
done
echo "Daemon started."
# if not already initialized
if [ ! -f /root/.lotus-shared/miner.addr ]; then
# publish bootnode peer info to shared volume
lotus net listen | awk 'NR==1{print}' > /root/.lotus-shared/miner.addr
# if miner not already initialized
if [ ! -d /root/.lotus-miner-local-net ]; 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
# start miner
nohup lotus-miner run --nosync &
tail -f /dev/null

View File

@ -1,2 +1,22 @@
# Lotus Fixturenet
Instructions for deploying a local Lotus (Filecoin) chain for development and testing purposes using laconic-stack-orchestrator.
## 1. Clone required repositories
```
$ laconic-so --stack fixturenet-lotus setup-repositories
```
## 2. Build the stack's packages and containers
```
$ laconic-so --stack fixturenet-lotus build-containers
```
## 3. Deploy the stack
```
$ laconic-so --stack fixturenet-lotus deploy up
```
Correct operation should be verified by checking the container logs with:
```
$ laconic-so --stack fixturenet-lotus deploy logs lotus-miner
$ laconic-so --stack fixturenet-lotus deploy logs lotus-node-1
$ laconic-so --stack fixturenet-lotus deploy logs lotus-node-2
```