Add support for running node in calibration network

This commit is contained in:
Nabarun 2024-05-24 09:46:29 +05:30
parent e75c36ab1d
commit 78b0a695cc
5 changed files with 70 additions and 12 deletions

View File

@ -7,6 +7,7 @@ services:
lotus: lotus:
environment: environment:
- DOCKER_LOTUS_IMPORT_SNAPSHOT=/var/lotus-snapshots/snapshot - DOCKER_LOTUS_IMPORT_SNAPSHOT=/var/lotus-snapshots/snapshot
- LOTUS_NETWORK=${CERC_LOTUS_NETWORK}
- LOTUS_FEVM_ENABLEETHRPC=true - LOTUS_FEVM_ENABLEETHRPC=true
- LOTUS_API_LISTENADDRESS=/ip4/0.0.0.0/tcp/1234/http - 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 - 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
@ -16,6 +17,7 @@ services:
- parameters:/var/tmp/filecoin-proof-parameters - parameters:/var/tmp/filecoin-proof-parameters
- lotus-repo:/var/lib/lotus - lotus-repo:/var/lib/lotus
- lotus_shared:/root/.lotus - lotus_shared:/root/.lotus
- ../config/lotus-node/docker-lotus-entrypoint.sh:/docker-lotus-entrypoint.sh
ports: ports:
- "1234" - "1234"
- "1235" - "1235"

View File

@ -0,0 +1,28 @@
#!/usr/bin/env bash
TARGET_LOTUS="/usr/local/bin/lotus"
TARGET_LOTUS_SHED="/usr/local/bin/lotus-shed"
if [ "$LOTUS_NETWORK" = "calibration" ]; then
echo "Using Calibration Lotus binary"
TARGET_LOTUS="/usr/local/bin/lotus-calibnet"
TARGET_LOTUS_SHED="/usr/local/bin/lotus-calibnet-shed"
fi
if [ ! -z $DOCKER_LOTUS_IMPORT_SNAPSHOT ]; then
GATE="$LOTUS_PATH"/date_initialized
# Don't init if already initialized.
if [ ! -f "$GATE" ]; then
echo importing minimal snapshot
echo "yes" | $TARGET_LOTUS daemon --import-snapshot "$DOCKER_LOTUS_IMPORT_SNAPSHOT" --halt-after-import
# Block future inits
date > "$GATE"
fi
fi
# import wallet, if provided
if [ ! -z $DOCKER_LOTUS_IMPORT_WALLET ]; then
$TARGET_LOTUS_SHED keyinfo import "$DOCKER_LOTUS_IMPORT_WALLET"
fi
exec $TARGET_LOTUS daemon $@

View File

@ -47,6 +47,11 @@ RUN make clean deps && \
install -C ./lotus-shed /usr/local/bin/lotus-shed && \ install -C ./lotus-shed /usr/local/bin/lotus-shed && \
install -C ./lotus-stats /usr/local/bin/lotus-stats install -C ./lotus-stats /usr/local/bin/lotus-stats
RUN make clean deps && \
make calibnet && \
install -C ./lotus /usr/local/bin/lotus-calibnet && \
install -C ./lotus-shed /usr/local/bin/lotus-calibnet-shed
##################################### #####################################
FROM ubuntu:20.04 AS lotus-base FROM ubuntu:20.04 AS lotus-base
MAINTAINER Lotus Development Team MAINTAINER Lotus Development Team
@ -73,6 +78,8 @@ MAINTAINER Lotus Development Team
COPY --from=lotus-builder \ COPY --from=lotus-builder \
/usr/local/bin/lotus \ /usr/local/bin/lotus \
/usr/local/bin/lotus-shed \ /usr/local/bin/lotus-shed \
/usr/local/bin/lotus-calibnet \
/usr/local/bin/lotus-calibnet-shed \
/usr/local/bin/ /usr/local/bin/
ENV FILECOIN_PARAMETER_CACHE /var/tmp/filecoin-proof-parameters ENV FILECOIN_PARAMETER_CACHE /var/tmp/filecoin-proof-parameters
@ -107,6 +114,8 @@ ENV DOCKER_LOTUS_IMPORT_SNAPSHOT=${DOCKER_LOTUS_IMPORT_SNAPSHOT}
COPY --from=lotus-builder /opt/filecoin/lotus /usr/local/bin/ COPY --from=lotus-builder /opt/filecoin/lotus /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-shed /usr/local/bin/ COPY --from=lotus-builder /opt/filecoin/lotus-shed /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-stats /usr/local/bin/ COPY --from=lotus-builder /opt/filecoin/lotus-stats /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-calibnet /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-calibnet-shed /usr/local/bin/
COPY scripts/docker-lotus-entrypoint.sh /docker-lotus-entrypoint.sh COPY scripts/docker-lotus-entrypoint.sh /docker-lotus-entrypoint.sh
RUN chmod +x /docker-lotus-entrypoint.sh RUN chmod +x /docker-lotus-entrypoint.sh

View File

@ -5,12 +5,22 @@ Instructions for deploying a Lotus snap-synced node (for both mainnet and calibn
## Prerequisite ## Prerequisite
Downloaded chain snapshot Downloaded chain snapshot
```bash
aria2c -o snapshot -x5 https://forest-archive.chainsafe.dev/latest/mainnet/
# or using wget - For Mainnet
wget -O snapshot https://forest-archive.chainsafe.dev/latest/mainnet/ ```bash
``` aria2c -o mainnet-snapshot.car.zst -x5 https://forest-archive.chainsafe.dev/latest/mainnet/
# or using wget
wget -O mainnet-snapshot.car.zst https://forest-archive.chainsafe.dev/latest/mainnet/
```
- For Calibration Testnet
```
aria2c -o calibnet-snapshot.car.zst -x5 https://forest-archive.chainsafe.dev/latest/calibnet/
# or using wget
wget -O calibnet-snapshot.car.zst https://forest-archive.chainsafe.dev/latest/calibnet/
```
## Clone the stack repo ## Clone the stack repo
@ -39,13 +49,23 @@ $ laconic-so --stack ~/cerc/lotus-stack/stack-orchestrator/stacks/lotus-node dep
## Setup config ## Setup config
Set file path of downloaded snapshot in config.env
Inside deployment directory, open the `config.env` file and set following env variables: Inside deployment directory, open the `config.env` file and set following env variables:
```bash - For Mainnet
# File path of downloaded snapshot ```bash
CERC_LOTUS_SNAPSHOT_PATH=/path-to-file/snapshot CERC_LOTUS_NETWORK=mainnet
```
# File path of downloaded snapshot
CERC_LOTUS_SNAPSHOT_PATH=/path-to-file/mainnet-snapshot.car.zst
```
- For Calibration
```bash
CERC_LOTUS_NETWORK=calibration
# File path of downloaded snapshot
CERC_LOTUS_SNAPSHOT_PATH=/path-to-file/calibnet-snapshot.car.zst
```
## Start the container ## Start the container

View File

@ -2,8 +2,7 @@ version: "1.0"
name: lotus-node name: lotus-node
description: "Lotus node stack" description: "Lotus node stack"
repos: repos:
# TODO: Use a release version tag - git.vdb.to/cerc-io/lotus@v1.27.0-rc3-interal-0.0.1
- git.vdb.to/cerc-io/lotus
containers: containers:
- cerc/lotus-node - cerc/lotus-node
pods: pods: