-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7e996c
commit 2701c9c
Showing
4 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Docker compose file to run a local devnet. | ||
# The devnet consists of a: | ||
# - Lotus node (2k build), | ||
# - Lotus miner (2k build), | ||
# - Forest node. | ||
|
||
version: "3.7" | ||
|
||
services: | ||
lotus_init: | ||
build: | ||
context: . | ||
dockerfile: lotus.dockerfile | ||
volumes: | ||
- filecoin-proofs:/var/tmp/filecoin-proof-parameters | ||
- lotus-data:/lotus_data | ||
env_file: | ||
- lotus.env | ||
entrypoint: ["/bin/bash", "-c" ] | ||
command: | ||
- | | ||
lotus fetch-params 2048 | ||
if [ ! -f /lotus_data/NODE_INITIALISED ]; then | ||
lotus-seed --sector-dir /lotus_data/genesis-sectors pre-seal --sector-size 2KiB --num-sectors 2 | ||
lotus-seed --sector-dir /lotus_data/genesis-sectors genesis new /lotus_data/localnet.json | ||
lotus-seed --sector-dir /lotus_data/genesis-sectors genesis add-miner /lotus_data/localnet.json /lotus_data/genesis-sectors/pre-seal-t01000.json | ||
touch /lotus_data/NODE_INITIALISED | ||
fi | ||
lotus_node: | ||
depends_on: | ||
lotus_init: | ||
condition: service_completed_successfully | ||
build: | ||
context: . | ||
dockerfile: lotus.dockerfile | ||
container_name: lotus | ||
networks: | ||
- devnet | ||
volumes: | ||
- filecoin-proofs:/var/tmp/filecoin-proof-parameters | ||
- lotus-data:/lotus_data | ||
entrypoint: ["/bin/bash", "-c" ] | ||
ports: | ||
- 1234:1234 | ||
- 9090:9090 | ||
env_file: | ||
- lotus.env | ||
command: | ||
- | | ||
lotus daemon --lotus-make-genesis=/lotus_data/devgen.car --genesis-template=/lotus_data/localnet.json --bootstrap=false | ||
lotus_miner: | ||
depends_on: | ||
lotus_init: | ||
condition: service_completed_successfully | ||
build: | ||
context: . | ||
dockerfile: lotus.dockerfile | ||
container_name: lotus-miner | ||
networks: | ||
- devnet | ||
volumes: | ||
- filecoin-proofs:/var/tmp/filecoin-proof-parameters | ||
- lotus-data:/lotus_data | ||
entrypoint: ["/bin/bash", "-c" ] | ||
ports: | ||
- 2345:2345 | ||
env_file: | ||
- lotus-miner.env | ||
restart: on-failure # lotus node might not be ready | ||
command: | ||
- | | ||
if [ ! -f /lotus_data/MINER_INITIALISED ]; then | ||
lotus wallet import --as-default /lotus_data/genesis-sectors/pre-seal-t01000.key | ||
lotus-miner init --genesis-miner --actor=t01000 --sector-size=2KiB --pre-sealed-sectors=/lotus_data/genesis-sectors --pre-sealed-metadata=/lotus_data/genesis-sectors/pre-seal-t01000.json --nosync | ||
touch /lotus_data/MINER_INITIALISED | ||
fi | ||
lotus-miner run --nosync | ||
volumes: | ||
filecoin-proofs: | ||
lotus-data: | ||
|
||
networks: | ||
devnet: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
LOTUS_PATH=/lotus_data/lotus-local-net | ||
LOTUS_MINER_PATH=/lotus_data/lotus-miner-local-net | ||
LOTUS_SKIP_GENESIS_CHECK=_yes_ | ||
CGO_CFLAGS_ALLOW="-D__BLST_PORTABLE__" | ||
CGO_CFLAGS="-D__BLST_PORTABLE__" | ||
LOTUS_API_LISTENADDRESS=/dns/lotus/tcp/2345/http | ||
LOTUS_API_LISTENADDRESS=/dns/lotus-miner/tcp/2345/http |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Lotus binaries image, to be used in the local devnet with Forest. | ||
FROM golang:1.19.7-buster AS lotus-builder | ||
|
||
ARG LOTUS_TAG=v1.23.0 | ||
|
||
RUN apt-get update && apt-get install -y ca-certificates build-essential clang ocl-icd-opencl-dev ocl-icd-libopencl1 jq libhwloc-dev | ||
|
||
WORKDIR /lotus | ||
RUN git clone --depth 1 --branch ${LOTUS_TAG} https://github.com/filecoin-project/lotus.git . && make 2k | ||
|
||
FROM ubuntu:22.04 | ||
|
||
# Need to copy the relevant shared libraries from the builder image. | ||
# See https://github.com/filecoin-project/lotus/blob/master/Dockerfile | ||
COPY --from=lotus-builder /etc/ssl/certs /etc/ssl/certs | ||
COPY --from=lotus-builder /lib/*/libdl.so.2 /lib/ | ||
COPY --from=lotus-builder /lib/*/librt.so.1 /lib/ | ||
COPY --from=lotus-builder /lib/*/libgcc_s.so.1 /lib/ | ||
COPY --from=lotus-builder /lib/*/libutil.so.1 /lib/ | ||
COPY --from=lotus-builder /usr/lib/*/libltdl.so.7 /lib/ | ||
COPY --from=lotus-builder /usr/lib/*/libnuma.so.1 /lib/ | ||
COPY --from=lotus-builder /usr/lib/*/libhwloc.so.5 /lib/ | ||
COPY --from=lotus-builder /usr/lib/*/libOpenCL.so.1 /lib/ | ||
|
||
# Copy only the binaries relevant for the devnet | ||
COPY --from=lotus-builder /lotus/lotus /lotus/lotus-miner /lotus/lotus-seed /usr/local/bin/ | ||
|
||
WORKDIR /lotus | ||
|
||
CMD ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
LOTUS_PATH=/lotus_data/lotus-local-net | ||
LOTUS_MINER_PATH=/lotus_data/lotus-miner-local-net | ||
LOTUS_SKIP_GENESIS_CHECK=_yes_ | ||
CGO_CFLAGS_ALLOW="-D__BLST_PORTABLE__" | ||
CGO_CFLAGS="-D__BLST_PORTABLE__" | ||
LOTUS_API_LISTENADDRESS=/dns/lotus/tcp/1234/http |