From 57fea0f0a16246d7bb9fc1cdd771a45d8b913e2d Mon Sep 17 00:00:00 2001 From: Hamza Hamud <53880692+hhamud@users.noreply.github.com> Date: Fri, 26 Dec 2025 21:19:22 +0000 Subject: [PATCH] fix: comments --- docker/Dockerfile.conntest.source | 189 --------------------------- docker/Dockerfile.vdf.source | 141 -------------------- docker/Dockerfile.vdf.sourceavx512 | 143 -------------------- docker/Dockerfile.vdf.sourcezen3 | 143 -------------------- docker/Dockerfile.vdf.sourcezen4 | 143 -------------------- docker/README.md | 202 +---------------------------- 6 files changed, 6 insertions(+), 955 deletions(-) delete mode 100644 docker/Dockerfile.conntest.source delete mode 100644 docker/Dockerfile.vdf.source delete mode 100644 docker/Dockerfile.vdf.sourceavx512 delete mode 100644 docker/Dockerfile.vdf.sourcezen3 delete mode 100644 docker/Dockerfile.vdf.sourcezen4 diff --git a/docker/Dockerfile.conntest.source b/docker/Dockerfile.conntest.source deleted file mode 100644 index d79e0f6..0000000 --- a/docker/Dockerfile.conntest.source +++ /dev/null @@ -1,189 +0,0 @@ -# syntax=docker.io/docker/dockerfile:1.7-labs -FROM --platform=${TARGETPLATFORM} ubuntu:24.04 AS base - -ENV PATH="${PATH}:/root/.cargo/bin/" - -ARG TARGETOS -ARG TARGETARCH - -# Install GMP 6.2 (6.3 which MacOS is using only available on Debian unstable) -RUN apt-get update && apt-get install -y \ - build-essential \ - curl \ - git \ - cmake \ - libgmp-dev \ - libmpfr-dev \ - libmpfr6 \ - wget \ - m4 \ - pkg-config \ - gcc \ - g++ \ - make \ - autoconf \ - automake \ - libtool \ - libssl-dev \ - python3 \ - python-is-python3 \ - && rm -rf /var/lib/apt/lists/* - -ARG GO_VERSION=1.23.5 -RUN apt update && apt install -y wget && \ - ARCH=$(dpkg --print-architecture) && \ - case ${ARCH} in \ - amd64) GOARCH=amd64 ;; \ - arm64) GOARCH=arm64 ;; \ - *) echo "Unsupported architecture: ${ARCH}" && exit 1 ;; \ - esac && \ - wget https://go.dev/dl/go${GO_VERSION}.linux-${GOARCH}.tar.gz && \ - rm -rf /usr/local/go && \ - tar -C /usr/local -xzf go${GO_VERSION}.linux-${GOARCH}.tar.gz && \ - rm go${GO_VERSION}.linux-${GOARCH}.tar.gz - -ENV PATH=$PATH:/usr/local/go/bin - -RUN git clone https://github.com/flintlib/flint.git && \ - cd flint && \ - git checkout flint-3.0 && \ - ./bootstrap.sh && \ - ./configure \ - --prefix=/usr/local \ - --with-gmp=/usr/local \ - --with-mpfr=/usr/local \ - --enable-static \ - --disable-shared \ - CFLAGS="-O3" && \ - make && \ - make install && \ - cd .. && \ - rm -rf flint - -COPY docker/rustup-init.sh /opt/rustup-init.sh - -RUN /opt/rustup-init.sh -y --profile minimal - -# Install uniffi-bindgen-go -RUN cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0 - -FROM base AS build - -ENV GOEXPERIMENT=arenas -ENV QUILIBRIUM_SIGNATURE_CHECK=false - -# Install grpcurl before building the node and client -# as to avoid needing to redo it on rebuilds -RUN go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest - -WORKDIR /opt/ceremonyclient - -# Copy everything except node and client so as to avoid -# invalidating the cache at this point on client or node rebuilds - -COPY --exclude=client \ - --exclude=conntest \ - --exclude=sidecar . . - -RUN bash install-emp.sh - - -RUN cd emp-tool && sed -i 's/add_library(${NAME} SHARED ${sources})/add_library(${NAME} STATIC ${sources})/g' CMakeLists.txt && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local && cd .. && make && make install && cd .. - -RUN cd emp-ot && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local && cd .. && make && make install && cd .. - -RUN go mod download - -## Generate Rust bindings for channel -WORKDIR /opt/ceremonyclient/channel - -RUN go mod download - -RUN ./generate.sh - - -## Generate Rust bindings for VDF -WORKDIR /opt/ceremonyclient/vdf - -RUN go mod download - -RUN ./generate.sh - - -## Generate Rust bindings for Ferret -WORKDIR /opt/ceremonyclient/ferret - -RUN go mod download - -RUN ./generate.sh - -## Generate Rust bindings for BLS48581 -WORKDIR /opt/ceremonyclient/bls48581 - -RUN go mod download - -RUN ./generate.sh - -## Generate Rust bindings for RPM -WORKDIR /opt/ceremonyclient/rpm - -RUN go mod download - -RUN ./generate.sh - -## Generate Rust bindings for VerEnc -WORKDIR /opt/ceremonyclient/verenc - -RUN go mod download - -RUN ./generate.sh - -## Generate Rust bindings for Bulletproofs -WORKDIR /opt/ceremonyclient/bulletproofs - -RUN go mod download - -RUN ./generate.sh - -FROM build AS build-conntest - -# Build and install conntest -COPY ./conntest /opt/ceremonyclient/conntest -WORKDIR /opt/ceremonyclient/conntest - -ENV GOPROXY=direct -RUN ./build.sh && cp conntest /usr/bin - -# Allows exporting single binary -FROM scratch AS conntest -COPY --from=build-conntest /usr/bin/conntest /conntest -ENTRYPOINT [ "/conntest" ] - -FROM ubuntu:24.04 - -RUN apt-get update && apt-get install libflint-dev -y - -ARG NODE_VERSION -ARG GIT_REPO -ARG GIT_BRANCH -ARG GIT_COMMIT - -ENV GOEXPERIMENT=arenas - -LABEL org.opencontainers.image.title="Quilibrium Network Node connection test" -LABEL org.opencontainers.image.description="Quilibrium is a decentralized alternative to platform as a service providers." -LABEL org.opencontainers.image.version=$NODE_VERSION -LABEL org.opencontainers.image.vendor=Quilibrium -LABEL org.opencontainers.image.url=https://quilibrium.com/ -LABEL org.opencontainers.image.documentation=https://quilibrium.com/docs -LABEL org.opencontainers.image.source=$GIT_REPO -LABEL org.opencontainers.image.ref.name=$GIT_BRANCH -LABEL org.opencontainers.image.revision=$GIT_COMMIT - -RUN apt-get update && apt-get install -y ca-certificates - -COPY --from=build-conntest /usr/bin/conntest /usr/local/bin - -WORKDIR /root - -ENTRYPOINT ["conntest"] diff --git a/docker/Dockerfile.vdf.source b/docker/Dockerfile.vdf.source deleted file mode 100644 index 54870f6..0000000 --- a/docker/Dockerfile.vdf.source +++ /dev/null @@ -1,141 +0,0 @@ -# syntax=docker.io/docker/dockerfile:1.7-labs -FROM --platform=${TARGETPLATFORM} ubuntu:24.04 AS base - -ENV PATH="${PATH}:/root/.cargo/bin/" - -ARG TARGETOS -ARG TARGETARCH - -# Install GMP 6.2 (6.3 which MacOS is using only available on Debian unstable) -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - apt-get update && apt-get install -y \ - build-essential \ - curl \ - git \ - cmake \ - libgmp-dev \ - libmpfr-dev \ - libmpfr6 \ - wget \ - m4 \ - pkg-config \ - gcc \ - g++ \ - make \ - autoconf \ - automake \ - libtool \ - libssl-dev \ - python3 \ - python-is-python3 \ - && rm -rf /var/lib/apt/lists/* - -ARG GO_VERSION=1.23.5 -RUN --mount=type=cache,target=/usr/local,id=usr-local-${TARGETOS}-${TARGETARCH} \ - apt update && apt install -y wget && \ - ARCH=$(dpkg --print-architecture) && \ - case ${ARCH} in \ - amd64) GOARCH=amd64 ;; \ - arm64) GOARCH=arm64 ;; \ - *) echo "Unsupported architecture: ${ARCH}" && exit 1 ;; \ - esac && \ - wget https://go.dev/dl/go${GO_VERSION}.linux-${GOARCH}.tar.gz && \ - rm -rf /usr/local/go && \ - tar -C /usr/local -xzf go${GO_VERSION}.linux-${GOARCH}.tar.gz && \ - rm go${GO_VERSION}.linux-${GOARCH}.tar.gz - -ENV PATH=$PATH:/usr/local/go/bin - -RUN --mount=type=cache,target=/usr/local,id=usr-local-${TARGETOS}-${TARGETARCH} \ - git clone https://github.com/flintlib/flint.git && \ - cd flint && \ - git checkout flint-3.0 && \ - ./bootstrap.sh && \ - ./configure \ - --prefix=/usr/local \ - --with-gmp=/usr/local \ - --with-mpfr=/usr/local \ - --enable-static \ - --disable-shared \ - CFLAGS="-O3" && \ - make && \ - make install && \ - cd .. && \ - rm -rf flint - -COPY docker/rustup-init.sh /opt/rustup-init.sh - -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH} \ - /opt/rustup-init.sh -y --profile minimal - -# Install uniffi-bindgen-go -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH} \ - cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0 - -FROM base AS build - -ENV QUILIBRIUM_SIGNATURE_CHECK=false - -WORKDIR /opt/ceremonyclient - -# Copy everything except node and client so as to avoid -# invalidating the cache at this point on client or node rebuilds - -COPY --exclude=node \ - --exclude=client \ - --exclude=sidecar . . - -## Generate Rust bindings for VDF -WORKDIR /opt/ceremonyclient/vdf - -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH} \ - go mod download - -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH} \ - ./generate.sh - - -FROM build AS build-node - -WORKDIR /opt/ceremonyclient/vdf - -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH} \ - ./build-test.sh -o vdf-test perftest/main.go && cp vdf-test /usr/bin - -# Allows exporting single binary -FROM scratch AS vdf -COPY --from=build-node /usr/bin/vdf-test /vdf-test -ENTRYPOINT [ "/vdf-test" ] - -LABEL org.opencontainers.image.title="Quilibrium Network Node" -LABEL org.opencontainers.image.description="Quilibrium is a decentralized alternative to platform as a service providers." -LABEL org.opencontainers.image.version=$NODE_VERSION -LABEL org.opencontainers.image.vendor=Quilibrium -LABEL org.opencontainers.image.url=https://quilibrium.com/ -LABEL org.opencontainers.image.documentation=https://quilibrium.com/docs -LABEL org.opencontainers.image.source=$GIT_REPO -LABEL org.opencontainers.image.ref.name=$GIT_BRANCH -LABEL org.opencontainers.image.revision=$GIT_COMMIT - -COPY --from=build-node /usr/bin/vdf-test /usr/local/vdf-test - -WORKDIR /root - -ENTRYPOINT ["vdf-test"] diff --git a/docker/Dockerfile.vdf.sourceavx512 b/docker/Dockerfile.vdf.sourceavx512 deleted file mode 100644 index 8dc4e1a..0000000 --- a/docker/Dockerfile.vdf.sourceavx512 +++ /dev/null @@ -1,143 +0,0 @@ -# syntax=docker.io/docker/dockerfile:1.7-labs -FROM --platform=${TARGETPLATFORM} ubuntu:24.04 AS base-avx512 - -ENV PATH="${PATH}:/root/.cargo/bin/" - -ARG TARGETOS -ARG TARGETARCH - -# Install GMP 6.2 (6.3 which MacOS is using only available on Debian unstable) -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - apt-get update && apt-get install -y \ - build-essential \ - curl \ - git \ - cmake \ - libgmp-dev \ - libmpfr-dev \ - libmpfr6 \ - wget \ - m4 \ - pkg-config \ - gcc \ - g++ \ - make \ - autoconf \ - automake \ - libtool \ - libssl-dev \ - python3 \ - python-is-python3 \ - && rm -rf /var/lib/apt/lists/* - -ARG GO_VERSION=1.23.5 -RUN --mount=type=cache,target=/usr/local,id=usr-local-${TARGETOS}-${TARGETARCH}-avx512 \ - apt update && apt install -y wget && \ - ARCH=$(dpkg --print-architecture) && \ - case ${ARCH} in \ - amd64) GOARCH=amd64 ;; \ - arm64) GOARCH=arm64 ;; \ - *) echo "Unsupported architecture: ${ARCH}" && exit 1 ;; \ - esac && \ - wget https://go.dev/dl/go${GO_VERSION}.linux-${GOARCH}.tar.gz && \ - rm -rf /usr/local/go && \ - tar -C /usr/local -xzf go${GO_VERSION}.linux-${GOARCH}.tar.gz && \ - rm go${GO_VERSION}.linux-${GOARCH}.tar.gz - -ENV PATH=$PATH:/usr/local/go/bin - -# Build FLINT from source with AVX-512 -RUN --mount=type=cache,target=/usr/local,id=usr-local-${TARGETOS}-${TARGETARCH}-avx512 \ - git clone https://github.com/flintlib/flint.git && \ - cd flint && \ - git checkout flint-3.0 && \ - ./bootstrap.sh && \ - ./configure \ - --prefix=/usr/local \ - --with-gmp=/usr/local \ - --with-mpfr=/usr/local \ - --enable-avx512 \ - --enable-static \ - --disable-shared \ - CFLAGS="-march=skylake-avx512 -mtune=skylake-avx512 -O3" && \ - make -j$(nproc) && \ - make install && \ - cd .. && \ - rm -rf flint - -COPY docker/rustup-init.sh /opt/rustup-init.sh - -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-avx512 \ - /opt/rustup-init.sh -y --profile minimal - -# Install uniffi-bindgen-go -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-avx512 \ - cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0 - -FROM base-avx512 AS build-avx512 - -ENV QUILIBRIUM_SIGNATURE_CHECK=false - -WORKDIR /opt/ceremonyclient - -# Copy everything except node and client so as to avoid -# invalidating the cache at this point on client or node rebuilds - -COPY --exclude=node \ - --exclude=client \ - --exclude=sidecar . . - -## Generate Rust bindings for VDF -WORKDIR /opt/ceremonyclient/vdf - -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH}-avx512 \ - go mod download - -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH}-avx512 \ - ./generate.sh - - -FROM build-avx512 AS build-node-avx512 - -WORKDIR /opt/ceremonyclient/vdf - -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH}-avx512 \ - ./build-test.sh -o vdf-test perftest/main.go && cp vdf-test /usr/bin - -# Allows exporting single binary -FROM scratch AS vdf-avx512 -COPY --from=build-node-avx512 /usr/bin/vdf-test /vdf-test -ENTRYPOINT [ "/vdf-test" ] - -LABEL org.opencontainers.image.title="Quilibrium Network Node" -LABEL org.opencontainers.image.description="Quilibrium is a decentralized alternative to platform as a service providers." -LABEL org.opencontainers.image.version=$NODE_VERSION -LABEL org.opencontainers.image.vendor=Quilibrium -LABEL org.opencontainers.image.url=https://quilibrium.com/ -LABEL org.opencontainers.image.documentation=https://quilibrium.com/docs -LABEL org.opencontainers.image.source=$GIT_REPO -LABEL org.opencontainers.image.ref.name=$GIT_BRANCH -LABEL org.opencontainers.image.revision=$GIT_COMMIT - -COPY --from=build-node-avx512 /usr/bin/vdf-test /usr/local/vdf-test - -WORKDIR /root - -ENTRYPOINT ["vdf-test"] \ No newline at end of file diff --git a/docker/Dockerfile.vdf.sourcezen3 b/docker/Dockerfile.vdf.sourcezen3 deleted file mode 100644 index a3d6a51..0000000 --- a/docker/Dockerfile.vdf.sourcezen3 +++ /dev/null @@ -1,143 +0,0 @@ -# syntax=docker.io/docker/dockerfile:1.7-labs -FROM --platform=${TARGETPLATFORM} ubuntu:24.04 AS base-zen3 - -ENV PATH="${PATH}:/root/.cargo/bin/" - -ARG TARGETOS -ARG TARGETARCH - -# Install GMP 6.2 (6.3 which MacOS is using only available on Debian unstable) -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - apt-get update && apt-get install -y \ - build-essential \ - curl \ - git \ - cmake \ - libgmp-dev \ - libmpfr-dev \ - libmpfr6 \ - wget \ - m4 \ - pkg-config \ - gcc \ - g++ \ - make \ - autoconf \ - automake \ - libtool \ - libssl-dev \ - python3 \ - python-is-python3 \ - && rm -rf /var/lib/apt/lists/* - -ARG GO_VERSION=1.23.5 -RUN --mount=type=cache,target=/usr/local,id=usr-local-${TARGETOS}-${TARGETARCH}-zen3 \ - apt update && apt install -y wget && \ - ARCH=$(dpkg --print-architecture) && \ - case ${ARCH} in \ - amd64) GOARCH=amd64 ;; \ - arm64) GOARCH=arm64 ;; \ - *) echo "Unsupported architecture: ${ARCH}" && exit 1 ;; \ - esac && \ - wget https://go.dev/dl/go${GO_VERSION}.linux-${GOARCH}.tar.gz && \ - rm -rf /usr/local/go && \ - tar -C /usr/local -xzf go${GO_VERSION}.linux-${GOARCH}.tar.gz && \ - rm go${GO_VERSION}.linux-${GOARCH}.tar.gz - -ENV PATH=$PATH:/usr/local/go/bin - -# Build FLINT from source with AVX-512 -RUN --mount=type=cache,target=/usr/local,id=usr-local-${TARGETOS}-${TARGETARCH}-zen3 \ - git clone https://github.com/flintlib/flint.git && \ - cd flint && \ - git checkout flint-3.0 && \ - ./bootstrap.sh && \ - ./configure \ - --prefix=/usr/local \ - --with-gmp=/usr/local \ - --with-mpfr=/usr/local \ - --enable-avx2 \ - --enable-static \ - --disable-shared \ - CFLAGS="-march=znver3 -mtune=znver3 -O3" && \ - make -j$(nproc) && \ - make install && \ - cd .. && \ - rm -rf flint - -COPY docker/rustup-init.sh /opt/rustup-init.sh - -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-zen3 \ - /opt/rustup-init.sh -y --profile minimal - -# Install uniffi-bindgen-go -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-zen3 \ - cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0 - -FROM base-zen3 AS build-zen3 - -ENV QUILIBRIUM_SIGNATURE_CHECK=false - -WORKDIR /opt/ceremonyclient - -# Copy everything except node and client so as to avoid -# invalidating the cache at this point on client or node rebuilds - -COPY --exclude=node \ - --exclude=client \ - --exclude=sidecar . . - -## Generate Rust bindings for VDF -WORKDIR /opt/ceremonyclient/vdf - -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH}-zen3 \ - go mod download - -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH}-zen3 \ - ./generate.sh - - -FROM build-zen3 AS build-node-zen3 - -WORKDIR /opt/ceremonyclient/vdf - -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH}-zen3 \ - ./build-test.sh -o vdf-test perftest/main.go && cp vdf-test /usr/bin - -# Allows exporting single binary -FROM scratch AS vdf-zen3 -COPY --from=build-node-zen3 /usr/bin/vdf-test /vdf-test -ENTRYPOINT [ "/vdf-test" ] - -LABEL org.opencontainers.image.title="Quilibrium Network Node" -LABEL org.opencontainers.image.description="Quilibrium is a decentralized alternative to platform as a service providers." -LABEL org.opencontainers.image.version=$NODE_VERSION -LABEL org.opencontainers.image.vendor=Quilibrium -LABEL org.opencontainers.image.url=https://quilibrium.com/ -LABEL org.opencontainers.image.documentation=https://quilibrium.com/docs -LABEL org.opencontainers.image.source=$GIT_REPO -LABEL org.opencontainers.image.ref.name=$GIT_BRANCH -LABEL org.opencontainers.image.revision=$GIT_COMMIT - -COPY --from=build-node-zen3 /usr/bin/vdf-test /usr/local/vdf-test - -WORKDIR /root - -ENTRYPOINT ["vdf-test"] diff --git a/docker/Dockerfile.vdf.sourcezen4 b/docker/Dockerfile.vdf.sourcezen4 deleted file mode 100644 index 808165f..0000000 --- a/docker/Dockerfile.vdf.sourcezen4 +++ /dev/null @@ -1,143 +0,0 @@ -# syntax=docker.io/docker/dockerfile:1.7-labs -FROM --platform=${TARGETPLATFORM} ubuntu:24.04 AS base-zen4 - -ENV PATH="${PATH}:/root/.cargo/bin/" - -ARG TARGETOS -ARG TARGETARCH - -# Install GMP 6.2 (6.3 which MacOS is using only available on Debian unstable) -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - apt-get update && apt-get install -y \ - build-essential \ - curl \ - git \ - cmake \ - libgmp-dev \ - libmpfr-dev \ - libmpfr6 \ - wget \ - m4 \ - pkg-config \ - gcc \ - g++ \ - make \ - autoconf \ - automake \ - libtool \ - libssl-dev \ - python3 \ - python-is-python3 \ - && rm -rf /var/lib/apt/lists/* - -ARG GO_VERSION=1.23.5 -RUN --mount=type=cache,target=/usr/local,id=usr-local-${TARGETOS}-${TARGETARCH}-zen4 \ - apt update && apt install -y wget && \ - ARCH=$(dpkg --print-architecture) && \ - case ${ARCH} in \ - amd64) GOARCH=amd64 ;; \ - arm64) GOARCH=arm64 ;; \ - *) echo "Unsupported architecture: ${ARCH}" && exit 1 ;; \ - esac && \ - wget https://go.dev/dl/go${GO_VERSION}.linux-${GOARCH}.tar.gz && \ - rm -rf /usr/local/go && \ - tar -C /usr/local -xzf go${GO_VERSION}.linux-${GOARCH}.tar.gz && \ - rm go${GO_VERSION}.linux-${GOARCH}.tar.gz - -ENV PATH=$PATH:/usr/local/go/bin - -# Build FLINT from source with AVX-512 -RUN --mount=type=cache,target=/usr/local,id=usr-local-${TARGETOS}-${TARGETARCH}-zen4 \ - git clone https://github.com/flintlib/flint.git && \ - cd flint && \ - git checkout flint-3.0 && \ - ./bootstrap.sh && \ - ./configure \ - --prefix=/usr/local \ - --with-gmp=/usr/local \ - --with-mpfr=/usr/local \ - --enable-avx2 \ - --enable-static \ - --disable-shared \ - CFLAGS="-march=znver4 -mtune=znver4 -O3" && \ - make -j$(nproc) && \ - make install && \ - cd .. && \ - rm -rf flint - -COPY docker/rustup-init.sh /opt/rustup-init.sh - -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-zen4 \ - /opt/rustup-init.sh -y --profile minimal - -# Install uniffi-bindgen-go -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-zen4 \ - cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0 - -FROM base-zen4 AS build-zen4 - -ENV QUILIBRIUM_SIGNATURE_CHECK=false - -WORKDIR /opt/ceremonyclient - -# Copy everything except node and client so as to avoid -# invalidating the cache at this point on client or node rebuilds - -COPY --exclude=node \ - --exclude=client \ - --exclude=sidecar . . - -## Generate Rust bindings for VDF -WORKDIR /opt/ceremonyclient/vdf - -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH}-zen4 \ - go mod download - -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH}-zen4 \ - ./generate.sh - - -FROM build-zen4 AS build-node-zen4 - -WORKDIR /opt/ceremonyclient/vdf - -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH}-zen4 \ - ./build-test.sh -o vdf-test perftest/main.go && cp vdf-test /usr/bin - -# Allows exporting single binary -FROM scratch AS vdf-zen4 -COPY --from=build-node-zen4 /usr/bin/vdf-test /vdf-test -ENTRYPOINT [ "/vdf-test" ] - -LABEL org.opencontainers.image.title="Quilibrium Network Node" -LABEL org.opencontainers.image.description="Quilibrium is a decentralized alternative to platform as a service providers." -LABEL org.opencontainers.image.version=$NODE_VERSION -LABEL org.opencontainers.image.vendor=Quilibrium -LABEL org.opencontainers.image.url=https://quilibrium.com/ -LABEL org.opencontainers.image.documentation=https://quilibrium.com/docs -LABEL org.opencontainers.image.source=$GIT_REPO -LABEL org.opencontainers.image.ref.name=$GIT_BRANCH -LABEL org.opencontainers.image.revision=$GIT_COMMIT - -COPY --from=build-node-zen4 /usr/bin/vdf-test /usr/local/vdf-test - -WORKDIR /root - -ENTRYPOINT ["vdf-test"] diff --git a/docker/README.md b/docker/README.md index d0a9532..adae191 100644 --- a/docker/README.md +++ b/docker/README.md @@ -2,148 +2,15 @@ This folder contains all the necessary files to build and run Quilibrium nodes using Docker. -## Prerequisites - -### Required Tools -- **Docker** (v20.10+) with BuildKit support -- **Docker Compose** (v2.0+) -- **Task** (optional but recommended) - [taskfile.dev](https://taskfile.dev) - -### Install Task -```bash -# macOS -brew install go-task - -# Linux (script) -sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin - -# Or via Go -go install github.com/go-task/task/v3/cmd/task@latest -``` - -### Docker Version Check -```bash -docker --version # Should be 20.10+ -docker compose version # Should be v2.0+ -``` ## 1. System Preparation -Before building or running, optimize the host network stack. Quilibrium relies on the QUIC protocol (UDP), which requires larger buffer sizes than the Linux default. +For system preparation follow this [guide](https://docs.quilibrium.com/). -### Increase UDP Buffer Sizes -```bash -sudo sysctl -w net.core.rmem_max=7500000 -sudo sysctl -w net.core.wmem_max=7500000 -``` -To make these changes permanent, add them to `/etc/sysctl.conf`. +If you have issues with connecting to others consider opening up additonal ports 50000+ and 60000+ -### Configure Firewall (UFW) -Open the ports required for P2P, gRPC, REST, and worker communication: -```bash -sudo ufw allow 22/tcp -sudo ufw allow 443/tcp -sudo ufw allow 8336:8338/udp -sudo ufw allow 8340/udp -sudo ufw allow 50000:50010/tcp -sudo ufw allow 50000:50010/udp -sudo ufw reload -``` - -## 2. File Structure - -| File | Purpose | -| --- | --- | -| `Dockerfile.source` | Main multi-stage build for node + qclient | -| `Dockerfile.sourceavx512` | Optimized build with AVX-512 instructions | -| `Dockerfile.release` | Build from pre-compiled release binaries | -| `Dockerfile.conntest.source` | Connection test utility build | -| `Dockerfile.vdf.*` | VDF performance analysis builds (various CPU optimizations) | -| `docker-compose.yml` | Container orchestration config | -| `Taskfile.yaml` | Task automation commands | -| `.env.example` | Environment variable template | -| `rustup-init.sh` | Rust installer for build stages | - -## 3. Dockerfile Variants - -### Production Dockerfiles - -| Dockerfile | Use Case | Target Stages | -| --- | --- | --- | -| `Dockerfile.source` | Standard build from source | `node-only`, `node`, `qclient`, `final` | -| `Dockerfile.sourceavx512` | AVX-512 optimized (Intel Xeon, AMD Zen4+) | Same as above | -| `Dockerfile.release` | Build from release binaries (faster) | Single stage | - -### Specialized Dockerfiles - -| Dockerfile | Use Case | -| --- | --- | -| `Dockerfile.conntest.source` | Network connectivity testing | -| `Dockerfile.vdf.source` | VDF performance benchmarking | -| `Dockerfile.vdf.sourceavx512` | VDF with AVX-512 optimizations | -| `Dockerfile.vdf.sourcezen3` | VDF optimized for AMD Zen3 | -| `Dockerfile.vdf.sourcezen4` | VDF optimized for AMD Zen4 | - -## 4. Build Targets & Cross-Compilation - -### Available Build Tasks - -| Task | Platform | Output | -| --- | --- | --- | -| `build_node_arm64_linux` | Linux ARM64 | `../node/build/arm64_linux/` | -| `build_node_amd64_linux` | Linux AMD64 | `../node/build/amd64_linux/` | -| `build_node_amd64_avx512_linux` | Linux AMD64 (AVX-512) | `../node/build/amd64_avx512_linux/` | -| `build_node_arm64_macos` | macOS ARM64 | `../node/build/arm64_macos/` | -| `build_qclient_arm64_linux` | Linux ARM64 | `../client/build/arm64_linux/` | -| `build_qclient_amd64_linux` | Linux AMD64 | `../client/build/amd64_linux/` | -| `build_qclient_amd64_avx512_linux` | Linux AMD64 (AVX-512) | `../client/build/amd64_avx512_linux/` | -| `build_qclient_arm64_macos` | macOS ARM64 | `../client/build/arm64_macos/` | - -### Cross-Compilation Examples - -**Build Linux ARM64 binary from any platform:** -```bash -task build_node_arm64_linux -``` - -**Build Linux AMD64 with AVX-512 optimizations:** -```bash -task build_node_amd64_avx512_linux -``` - -**Manual cross-compilation with Docker:** -```bash -# Build for ARM64 -docker build --platform linux/arm64 -f Dockerfile.source --output ../node/build/arm64_linux --target=node .. - -# Build for AMD64 -docker build --platform linux/amd64 -f Dockerfile.source --output ../node/build/amd64_linux --target=node .. -``` - -## 5. Docker Images - -### Build Images - -```bash -# Full image (node + qclient) -task build:source - -# Node-only optimized image -task build:node:source - -# From release binaries (faster) -task build:release -``` - -### Image Tags - -After building, images are tagged as: -- `quilibrium:2.1.0-source` / `quilibrium:source` -- `quilibrium:2.1.0-node-only` / `quilibrium:node-only` -- `quilibrium:2.1.0-release` / `quilibrium:release` - -## 6. Configuration +## 2. Configuration ### Configuration Directory By default, the Docker configuration uses the `.config` directory at the **root of the repository** (`../.config`). This allows you to share configuration between native and containerized builds. @@ -154,32 +21,18 @@ task config:gen ``` This will generate the configuration in `../.config`. -## 7. Running a Node +## 3. Running a Node ### Quick Start (Docker Compose) ```bash task up ``` Or: + ```bash docker compose up -d ``` -### Host Networking (Recommended for Servers) -For servers with dedicated public IPs, host networking eliminates Docker NAT overhead: - -```bash -task deploy:node -``` -Or: -```bash -docker run -d --name q-node \ - --network host \ - --restart unless-stopped \ - -v $(pwd)/../.config:/root/.config \ - quilibrium:node-only -signature-check=false -``` - ### New Instance If you are starting a brand new node, a `.config/` folder will be created at the repository root. @@ -190,51 +43,8 @@ If you are starting a brand new node, a `.config/` folder will be created at the 1. Ensure your `config.yml` and `keys.yml` are in the `.config/` folder at the repository root. 2. Start the node: `task up` -## 8. gRPC & REST API Access -The node exposes two APIs for programmatic access: - -| API | Port | Protocol | Binding | -| --- | --- | --- | --- | -| **gRPC** | 8337 | TCP | `127.0.0.1` (localhost only) | -| **REST** | 8338 | TCP | `127.0.0.1` (localhost only) | - -### Using grpcurl -The container includes `grpcurl` for gRPC interaction: - -```bash -# List available services -docker compose exec node grpcurl -plaintext localhost:8337 list - -# Get node info -docker compose exec node grpcurl -plaintext localhost:8337 quilibrium.node.node.pb.NodeService/GetNodeInfo - -# Get token balance -docker compose exec node grpcurl -plaintext localhost:8337 quilibrium.node.node.pb.NodeService/GetTokenInfo -``` - -### Using qclient (inside container) -```bash -docker compose exec node qclient help -docker compose exec node qclient token balance -docker compose exec node qclient token info -``` - -### Exposing APIs Externally -By default, APIs are bound to localhost for security. To expose externally, modify `docker-compose.override.yml`: - -```yaml -services: - node: - ports: - - '0.0.0.0:8337:8337/tcp' # gRPC (use with caution) - - '0.0.0.0:8338:8338/tcp' # REST (use with caution) -``` - -> [!WARNING] -> Exposing gRPC/REST externally can be a security risk. Use a reverse proxy with authentication if needed. - -## 9. Management Commands +## 4. Management Commands | Action | Task Command | Docker Command | | --- | --- | --- |