diff --git a/stack-orchestrator/compose/docker-compose-lotus-node.yml b/stack-orchestrator/compose/docker-compose-lotus-node.yml index 29b7b43..f017d2b 100644 --- a/stack-orchestrator/compose/docker-compose-lotus-node.yml +++ b/stack-orchestrator/compose/docker-compose-lotus-node.yml @@ -10,7 +10,7 @@ services: - LOTUS_FEVM_ENABLEETHRPC=true - LOTUS_API_LISTENADDRESS=/ip4/0.0.0.0/tcp/1234/http - LOTUS_LIBP2P_LISTENADDRESSES=/ip4/0.0.0.0/tcp/1235,/ip6/::/tcp/1235,/ip4/0.0.0.0/udp/1235/quic-v1,/ip6/::/udp/1235/quic-v1,/ip4/0.0.0.0/udp/1235/quic-v1/webtransport,/ip6/::/udp/1235/quic-v1/webtransport - image: cerc/lotus-mainnet:local + image: cerc/lotus-node:local volumes: - ${CERC_LOTUS_SNAPSHOT_PATH}:/var/lotus-snapshots/snapshot - parameters:/var/tmp/filecoin-proof-parameters diff --git a/stack-orchestrator/container-build/cerc-lotus-node/build.sh b/stack-orchestrator/container-build/cerc-lotus-node/build.sh index 54edd1a..42c490a 100755 --- a/stack-orchestrator/container-build/cerc-lotus-node/build.sh +++ b/stack-orchestrator/container-build/cerc-lotus-node/build.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Build cerc/mainnet-lotus +# Build cerc/lotus-node source ${CERC_CONTAINER_BASE_DIR}/build-base.sh SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) @@ -9,4 +9,4 @@ git stash # Replace repo's Dockerfile with modified one cp ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/lotus/Dockerfile -docker build -t cerc/lotus-mainnet:local ${build_command_args} ${CERC_REPO_BASE_DIR}/lotus +docker build -t cerc/lotus-node:local ${build_command_args} ${CERC_REPO_BASE_DIR}/lotus diff --git a/stack-orchestrator/stacks/lotus-node/README.md b/stack-orchestrator/stacks/lotus-node/README.md index 62d0e26..5b88281 100644 --- a/stack-orchestrator/stacks/lotus-node/README.md +++ b/stack-orchestrator/stacks/lotus-node/README.md @@ -6,10 +6,10 @@ Instructions for deploying a Lotus snap-synced node (for both mainnet and calibn Downloaded chain snapshot ```bash -aria2c -o mainnet-snapshot -x5 https://forest-archive.chainsafe.dev/latest/mainnet/ +aria2c -o snapshot -x5 https://forest-archive.chainsafe.dev/latest/mainnet/ # or using wget -wget -O mainnet-snapshot https://forest-archive.chainsafe.dev/latest/mainnet/ +wget -O snapshot https://forest-archive.chainsafe.dev/latest/mainnet/ ``` ## Clone the stack repo @@ -30,11 +30,6 @@ $ laconic-so --stack ~/cerc/lotus-stack/stack-orchestrator/stacks/lotus-node set $ laconic-so --stack ~/cerc/lotus-stack/stack-orchestrator/stacks/lotus-node build-containers ``` - -```bash -laconic-so --stack ~/cerc/lotus-stack/stack-orchestrator/stacks/lotus-node deploy up -``` - ## Create a deployment ```bash @@ -44,12 +39,12 @@ $ laconic-so --stack ~/cerc/lotus-stack/stack-orchestrator/stacks/lotus-node dep ## Setup config -Set filepath of downloaded mainnet snapshot in config.env +Set filepath of downloaded snapshot in config.env Inside deployment directory, open the `config.env` file and set following env variables: ```bash -# Filepath of downloaded mainnet snapshot -CERC_LOTUS_SNAPSHOT_PATH=/path-to-file/mainnet-snapshot +# Filepath of downloaded snapshot +CERC_LOTUS_SNAPSHOT_PATH=/path-to-file/snapshot ``` ## Start the container @@ -60,7 +55,36 @@ $ laconic-so deployment --dir lotus-node-deployment up ## Check status - +- Check if container is healthy + ``` + docker ps | grep lotus + ``` + NOTE: Starting node for the first time takes time (~20 mins) as it downloads latest snapshot and imports it + +- Get latest block using CURL + ``` + curl -X POST \ + -H "Content-Type: application/json" \ + --data '{ + "jsonrpc": "2.0", + "method": "eth_getBlockByNumber", + "params": ["latest", false], + "id": 1 + }' \ + http://localhost:1234/rpc/v1 + ``` + +- To check whether Lotus node has synced till head + ```bash + laconic-so deployment --dir lotus-node-deployment exec lotus "lotus sync wait" + + # lotus sync wait + # Worker: 78534; Base: 2403099; Target: 2403099 (diff: 0) + # State: message sync; Current Epoch: 2403099; Todo: 0 + + # Done! + ``` + When the lotus sync wait command shows done you are fully synced with the chain ## Clean up @@ -70,6 +94,12 @@ Stop all services running in the background: $ laconic-so deployment --dir lotus-node-deployment down ``` -Clear volumes created by this stack: +To stop all services and also delete data: - +```bash +# Stop the docker containers +$ laconic-so deployment --dir lotus-node-deployment down --delete-volumes + +# Remove deployment directory (deployment will have to be recreated for a re-run) +$ rm -r lotus-node-deployment +```