From 61499004022acf09313592ebcb84df9edddad8f9 Mon Sep 17 00:00:00 2001 From: Nabarun Date: Thu, 10 Aug 2023 13:38:15 +0530 Subject: [PATCH] Use release version and add healthcheck in Lotus stack --- app/data/compose/docker-compose-fixturenet-lotus.yml | 12 ++++++++++++ app/data/config/fixturenet-lotus/setup-miner.sh | 3 ++- app/data/container-build/cerc-lotus/Dockerfile | 7 +++++-- app/data/container-build/cerc-lotus/build.sh | 4 ++-- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/app/data/compose/docker-compose-fixturenet-lotus.yml b/app/data/compose/docker-compose-fixturenet-lotus.yml index 43578682..a1d2d290 100644 --- a/app/data/compose/docker-compose-fixturenet-lotus.yml +++ b/app/data/compose/docker-compose-fixturenet-lotus.yml @@ -30,6 +30,12 @@ services: - ../config/fixturenet-lotus/setup-node.sh:/docker-entrypoint-scripts.d/setup-node.sh - lotus_node_1_params:/var/tmp/filecoin-proof-parameters - lotus-shared:/root/.lotus-shared + healthcheck: + test: ["CMD", "nc", "-vz", "localhost", "1234"] + interval: 30s + timeout: 10s + retries: 10 + start_period: 3s depends_on: - lotus-miner entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-node.sh"] @@ -51,6 +57,12 @@ services: - ../config/fixturenet-lotus/setup-node.sh:/docker-entrypoint-scripts.d/setup-node.sh - lotus_node_2_params:/var/tmp/filecoin-proof-parameters - lotus-shared:/root/.lotus-shared + healthcheck: + test: ["CMD", "nc", "-vz", "localhost", "1234"] + interval: 30s + timeout: 10s + retries: 10 + start_period: 3s depends_on: - lotus-miner entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-node.sh"] diff --git a/app/data/config/fixturenet-lotus/setup-miner.sh b/app/data/config/fixturenet-lotus/setup-miner.sh index 68dd5f57..6c065b52 100644 --- a/app/data/config/fixturenet-lotus/setup-miner.sh +++ b/app/data/config/fixturenet-lotus/setup-miner.sh @@ -33,7 +33,8 @@ echo "Daemon started." cp /devgen.car /root/.lotus-shared # publish bootnode peer info to shared volume -lotus net listen | awk 'NR==2{print}' > /root/.lotus-shared/miner.addr +# TODO: Improve exporting public address to shared volume +lotus net listen | awk 'NR==4{print}' > /root/.lotus-shared/miner.addr # if miner not already initialized if [ ! -d $LOTUS_MINER_PATH ]; then diff --git a/app/data/container-build/cerc-lotus/Dockerfile b/app/data/container-build/cerc-lotus/Dockerfile index 963de704..0d43077a 100644 --- a/app/data/container-build/cerc-lotus/Dockerfile +++ b/app/data/container-build/cerc-lotus/Dockerfile @@ -1,5 +1,5 @@ ##################################### -FROM golang:1.19.7-buster AS lotus-builder +FROM golang:1.19.12-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 @@ -59,7 +59,7 @@ 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/*/libhwloc.so.* /lib/ COPY --from=lotus-builder /usr/lib/*/libOpenCL.so.1 /lib/ RUN useradd -r -u 532 -U fc \ @@ -98,6 +98,9 @@ CMD ["-help"] ##################################### FROM lotus-base AS lotus-all-in-one +# Install netcat for healthcheck +RUN apt-get update && apt-get install -y netcat + ENV FILECOIN_PARAMETER_CACHE /var/tmp/filecoin-proof-parameters ENV LOTUS_MINER_PATH /var/lib/lotus-miner ENV LOTUS_PATH /var/lib/lotus diff --git a/app/data/container-build/cerc-lotus/build.sh b/app/data/container-build/cerc-lotus/build.sh index 10bbf42c..b9520699 100755 --- a/app/data/container-build/cerc-lotus/build.sh +++ b/app/data/container-build/cerc-lotus/build.sh @@ -3,8 +3,8 @@ source ${CERC_CONTAINER_BASE_DIR}/build-base.sh SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -# Per lotus docs, 'releases' branch always contains latest stable release -git -C ${CERC_REPO_BASE_DIR}/lotus checkout releases +# 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