From efb07bd8ce3a5bd4dd5702c3d748ce50cd7caa4d Mon Sep 17 00:00:00 2001 From: "jonathan@vulcanize.io" Date: Fri, 19 Apr 2024 15:18:27 +0000 Subject: [PATCH] lotus fixturenet --- .../docker-compose-fixturenet-lotus.yml | 6 +- .../cerc-lotus-fixturenet/Dockerfile | 141 ++++++++++++++++++ .../cerc-lotus-fixturenet/build.sh | 12 ++ .../container-build/cerc-lotus/Dockerfile | 5 +- .../data/container-image-list.txt | 1 + .../data/stacks/fixturenet-lotus/stack.yml | 4 +- 6 files changed, 161 insertions(+), 8 deletions(-) create mode 100644 stack_orchestrator/data/container-build/cerc-lotus-fixturenet/Dockerfile create mode 100755 stack_orchestrator/data/container-build/cerc-lotus-fixturenet/build.sh diff --git a/stack_orchestrator/data/compose/docker-compose-fixturenet-lotus.yml b/stack_orchestrator/data/compose/docker-compose-fixturenet-lotus.yml index 4eb27039..4ae8a770 100644 --- a/stack_orchestrator/data/compose/docker-compose-fixturenet-lotus.yml +++ b/stack_orchestrator/data/compose/docker-compose-fixturenet-lotus.yml @@ -5,7 +5,7 @@ services: hostname: lotus-miner env_file: - ../config/fixturenet-lotus/lotus-env.env - image: cerc/lotus:local + image: cerc/lotus-fixturenet:local volumes: - ../config/fixturenet-lotus/setup-miner.sh:/docker-entrypoint-scripts.d/setup-miner.sh - ../config/fixturenet-lotus/fund-account.sh:/fund-account.sh @@ -26,7 +26,7 @@ services: environment: # Use 0.0.0.0 so that calls can be made from outside the container - LOTUS_API_LISTENADDRESS=/ip4/0.0.0.0/tcp/1234/http - image: cerc/lotus:local + image: cerc/lotus-fixturenet:local volumes: - ../config/fixturenet-lotus/setup-node.sh:/docker-entrypoint-scripts.d/setup-node.sh - lotus_node_1_params:/var/tmp/filecoin-proof-parameters @@ -54,7 +54,7 @@ services: environment: # Use 0.0.0.0 so that calls can be made from outside the container - LOTUS_API_LISTENADDRESS=/ip4/0.0.0.0/tcp/1234/http - image: cerc/lotus:local + image: cerc/lotus-fixturenet:local volumes: - ../config/fixturenet-lotus/setup-node.sh:/docker-entrypoint-scripts.d/setup-node.sh - lotus_node_2_params:/var/tmp/filecoin-proof-parameters diff --git a/stack_orchestrator/data/container-build/cerc-lotus-fixturenet/Dockerfile b/stack_orchestrator/data/container-build/cerc-lotus-fixturenet/Dockerfile new file mode 100644 index 00000000..8a17c982 --- /dev/null +++ b/stack_orchestrator/data/container-build/cerc-lotus-fixturenet/Dockerfile @@ -0,0 +1,141 @@ +##################################### +FROM golang:1.21.7-bullseye AS lotus-builder +MAINTAINER Lotus Development Team + +RUN apt-get update && apt-get install -y ca-certificates build-essential clang ocl-icd-opencl-dev ocl-icd-libopencl1 jq libhwloc-dev + +ENV XDG_CACHE_HOME="/tmp" + +### taken from https://github.com/rust-lang/docker-rust/blob/master/1.63.0/buster/Dockerfile +ENV RUSTUP_HOME=/usr/local/rustup \ + CARGO_HOME=/usr/local/cargo \ + PATH=/usr/local/cargo/bin:$PATH \ + RUST_VERSION=1.63.0 + +RUN set -eux; \ + dpkgArch="$(dpkg --print-architecture)"; \ + case "${dpkgArch##*-}" in \ + amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='5cc9ffd1026e82e7fb2eec2121ad71f4b0f044e88bca39207b3f6b769aaa799c' ;; \ + arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='e189948e396d47254103a49c987e7fb0e5dd8e34b200aa4481ecc4b8e41fb929' ;; \ + *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ + esac; \ + url="https://static.rust-lang.org/rustup/archive/1.25.1/${rustArch}/rustup-init"; \ + wget "$url"; \ + echo "${rustupSha256} *rustup-init" | sha256sum -c -; \ + chmod +x rustup-init; \ + ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \ + rm rustup-init; \ + chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \ + rustup --version; \ + cargo --version; \ + rustc --version; + +COPY ./ /opt/filecoin +WORKDIR /opt/filecoin + +RUN scripts/docker-git-state-check.sh + +### make configurable filecoin-ffi build +ARG FFI_BUILD_FROM_SOURCE=0 +ENV FFI_BUILD_FROM_SOURCE=${FFI_BUILD_FROM_SOURCE} + +RUN make clean deps + +ARG RUSTFLAGS="" +ARG GOFLAGS="" + +#RUN make lotus +RUN make 2k + +##################################### +FROM ubuntu:20.04 AS lotus-base +MAINTAINER Lotus Development Team + +# Base resources +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.* /lib/ +COPY --from=lotus-builder /usr/lib/*/libOpenCL.so.1 /lib/ + +RUN useradd -r -u 532 -U fc \ + && mkdir -p /etc/OpenCL/vendors \ + && echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd + +##################################### +FROM lotus-base AS lotus +MAINTAINER Lotus Development Team + +COPY --from=lotus-builder /opt/filecoin/lotus /usr/local/bin/ +COPY --from=lotus-builder /opt/filecoin/lotus-shed /usr/local/bin/ +#COPY scripts/docker-lotus-entrypoint.sh / +#COPY myscripts/setup-node.sh /docker-entrypoint-scripts.d/setup-node.sh + +ARG DOCKER_LOTUS_IMPORT_SNAPSHOT https://forest-archive.chainsafe.dev/latest/mainnet/ +ENV DOCKER_LOTUS_IMPORT_SNAPSHOT ${DOCKER_LOTUS_IMPORT_SNAPSHOT} +ENV FILECOIN_PARAMETER_CACHE /var/tmp/filecoin-proof-parameters +ENV LOTUS_PATH /var/lib/lotus +ENV DOCKER_LOTUS_IMPORT_WALLET "" + +RUN mkdir /var/lib/lotus /var/tmp/filecoin-proof-parameters +RUN chown fc: /var/lib/lotus /var/tmp/filecoin-proof-parameters + +VOLUME /var/lib/lotus +VOLUME /var/tmp/filecoin-proof-parameters + +USER fc + +EXPOSE 1234 + +ENTRYPOINT ["/docker-lotus-entrypoint.sh"] + +CMD ["-help"] + +##################################### +FROM lotus-base AS lotus-all-in-one + +# Install netcat for healthcheck +RUN apt-get update && apt-get install -y netcat && apt-get install -y iproute2 + +ENV FILECOIN_PARAMETER_CACHE /var/tmp/filecoin-proof-parameters +ENV LOTUS_MINER_PATH /var/lib/lotus-miner +ENV LOTUS_PATH /var/lib/lotus +ENV LOTUS_WORKER_PATH /var/lib/lotus-worker +ENV WALLET_PATH /var/lib/lotus-wallet + +COPY --from=lotus-builder /opt/filecoin/lotus /usr/local/bin/ +COPY --from=lotus-builder /opt/filecoin/lotus-seed /usr/local/bin/ +COPY --from=lotus-builder /opt/filecoin/lotus-shed /usr/local/bin/ +#COPY --from=lotus-builder /opt/filecoin/lotus-wallet /usr/local/bin/ +#COPY --from=lotus-builder /opt/filecoin/lotus-gateway /usr/local/bin/ +COPY --from=lotus-builder /opt/filecoin/lotus-miner /usr/local/bin/ +COPY --from=lotus-builder /opt/filecoin/lotus-worker /usr/local/bin/ +#COPY --from=lotus-builder /opt/filecoin/lotus-stats /usr/local/bin/ +#COPY --from=lotus-builder /opt/filecoin/lotus-fountain /usr/local/bin/ + +RUN mkdir /var/tmp/filecoin-proof-parameters +RUN mkdir /var/lib/lotus +RUN mkdir /var/lib/lotus-miner +RUN mkdir /var/lib/lotus-worker +RUN mkdir /var/lib/lotus-wallet +RUN chown fc: /var/tmp/filecoin-proof-parameters +RUN chown fc: /var/lib/lotus +RUN chown fc: /var/lib/lotus-miner +RUN chown fc: /var/lib/lotus-worker +RUN chown fc: /var/lib/lotus-wallet + + +#VOLUME /var/tmp/filecoin-proof-parameters +#VOLUME /var/lib/lotus +#VOLUME /var/lib/lotus-miner +#VOLUME /var/lib/lotus-worker +#VOLUME /var/lib/lotus-wallet + +EXPOSE 1234 +EXPOSE 2345 +EXPOSE 3456 +EXPOSE 1777 diff --git a/stack_orchestrator/data/container-build/cerc-lotus-fixturenet/build.sh b/stack_orchestrator/data/container-build/cerc-lotus-fixturenet/build.sh new file mode 100755 index 00000000..5c9df69e --- /dev/null +++ b/stack_orchestrator/data/container-build/cerc-lotus-fixturenet/build.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# Build cerc/lotus-fixturenet +source ${CERC_CONTAINER_BASE_DIR}/build-base.sh +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +# Use a release version tag to match the modified Dockerfile replaced in next step +git -C ${CERC_REPO_BASE_DIR}/lotus checkout v1.23.3 + +# Replace repo's Dockerfile with modified one +cp ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/lotus/Dockerfile +docker build -t cerc/lotus-fixturenet:local ${build_command_args} ${CERC_REPO_BASE_DIR}/lotus + diff --git a/stack_orchestrator/data/container-build/cerc-lotus/Dockerfile b/stack_orchestrator/data/container-build/cerc-lotus/Dockerfile index ed4f0be2..b8e104f7 100644 --- a/stack_orchestrator/data/container-build/cerc-lotus/Dockerfile +++ b/stack_orchestrator/data/container-build/cerc-lotus/Dockerfile @@ -33,7 +33,7 @@ RUN set -eux; \ COPY ./ /opt/filecoin WORKDIR /opt/filecoin -#RUN scripts/docker-git-state-check.sh +RUN scripts/docker-git-state-check.sh ### make configurable filecoin-ffi build ARG FFI_BUILD_FROM_SOURCE=0 @@ -44,8 +44,7 @@ RUN make clean deps ARG RUSTFLAGS="" ARG GOFLAGS="" -RUN make buildall -#RUN make 2k +RUN make lotus ##################################### FROM ubuntu:20.04 AS lotus-base diff --git a/stack_orchestrator/data/container-image-list.txt b/stack_orchestrator/data/container-image-list.txt index fd295be5..dad842f2 100644 --- a/stack_orchestrator/data/container-image-list.txt +++ b/stack_orchestrator/data/container-image-list.txt @@ -42,6 +42,7 @@ cerc/watcher-azimuth cerc/ipld-eth-state-snapshot cerc/watcher-gelato cerc/lotus +cerc/lotus-fixturenet cerc/go-opera cerc/lasso cerc/reth diff --git a/stack_orchestrator/data/stacks/fixturenet-lotus/stack.yml b/stack_orchestrator/data/stacks/fixturenet-lotus/stack.yml index 25f0f9d8..ec950dcf 100644 --- a/stack_orchestrator/data/stacks/fixturenet-lotus/stack.yml +++ b/stack_orchestrator/data/stacks/fixturenet-lotus/stack.yml @@ -2,8 +2,8 @@ version: "1.0" name: fixturenet-lotus description: "A lotus fixturenet" repos: - - github.com/filecoin-project/lotus + - git.vdb.to/cerc-io/lotus containers: - - cerc/lotus + - cerc/lotus-fixturenet pods: - fixturenet-lotus