diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 96baf2490b..f425f4ebc4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -112,3 +112,73 @@ jobs: target/debug/examples/web-server target/debug/examples/web-server-da-orchestrator target/debug/examples/web-server-da-validator + + build-dockers: + strategy: + matrix: + just_variants: + - async_std + - tokio + runs-on: ubuntu-latest + needs: [build, build-arm] + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Setup Docker BuildKit (buildx) + uses: docker/setup-buildx-action@v3 + + - name: Login to Github Container Repo + uses: docker/login-action@v3 + if: github.event_name != 'pull_request' + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Download executables AMD + uses: actions/download-artifact@v3 + with: + name: binaries-amd64-${{ matrix.just_variants }} + path: target/amd64/debug + + - name: Download executables ARM + uses: actions/download-artifact@v3 + with: + name: binaries-aarch64-${{ matrix.just_variants }} + path: target/arm64/debug + + - name: Generate webserver docker metadata + uses: docker/metadata-action@v5 + id: webserver + with: + images: ghcr.io/espressosystems/hotshot/webserver + flavor: suffix=-${{ matrix.just_variants }} + + - name: Generate libp2p metadata + uses: docker/metadata-action@v5 + id: libp2p + with: + images: ghcr.io/espressosystems/hotshot/libp2p + flavor: suffix=-${{ matrix.just_variants }} + + - name: Build and push webserver docker + uses: docker/build-push-action@v5 + with: + context: ./ + file: ./docker/validator-webserver.Dockerfile + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.webserver.outputs.tags }} + labels: ${{ steps.webserver.outputs.labels }} + + - name: Build and push web-server docker + uses: docker/build-push-action@v5 + with: + context: ./ + file: ./docker/validator-libp2p.Dockerfile + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.libp2p.outputs.tags }} + labels: ${{ steps.libp2p.outputs.labels }} + diff --git a/deploy/Dockerfile b/deploy/Dockerfile deleted file mode 100644 index 5c6897e22f..0000000000 --- a/deploy/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -# NOTE run from parent directory -FROM ubuntu:jammy - -# assuming this is built already -COPY target/release-lto/examples/multi-machine-libp2p /bin/multi-machine-libp2p - -# total number of nodes: regular + bootstrap -ENV NUM_NODES="20" - -# number of bootstrap -ENV NUM_BOOTSTRAP="7" - -# number of transactions each round -ENV NUM_TXN_PER_ROUND="10" - -# the index of the node -ENV NODE_IDX="0" - -# how long to run for before dying -# in minutes -ENV ONLINE_TIME="60" - -# the seed to generate phaselock keys with -ENV SEED="1234" - -# logging -ENV RUST_LOG="warn" - -# log format. JSON no ansi -ENV RUST_LOG_FORMAT="json" - -ENV PORT="9000" - -# mesh params -ENV BOOTSTRAP_MESH_N_HIGH="50" -ENV BOOTSTRAP_MESH_N_LOW="10" -ENV BOOTSTRAP_MESH_OUTBOUND_MIN="5" -ENV BOOTSTRAP_MESH_N="15" -ENV MESH_N_HIGH="15" -ENV MESH_N_LOW="8" -ENV MESH_OUTBOUND_MIN="4" -ENV MESH_N="12" - -# in seconds -ENV NEXT_VIEW_TIMEOUT="30" - -# in seconds -ENV PROPOSE_MIN_ROUND_TIME="1" - -# in seconds -ENV PROPOSE_MAX_ROUND_TIME="10" - -EXPOSE 9000 - -CMD ["sh", "-c", "NUM_NODES=${NUM_NODES} NUM_BOOTSTRAP=${NUM_BOOTSTRAP} NUM_TXN_PER_ROUND=${NUM_TXN_PER_ROUND} NODE_IDX=${NODE_IDX} ONLINE_TIME=${ONLINE_TIME} SEED=${SEED} RUST_LOG=${RUST_LOG} BOUND_ADDR=0.0.0.0:${PORT} SEED=${SEED} BOOTSTRAP_MESH_N_HIGH=${BOOTSTRAP_MESH_N_HIGH} BOOTSTRAP_MESH_N_LOW=${BOOTSTRAP_MESH_N_LOW} BOOTSTRAP_MESH_OUTBOUND_MIN=${BOOTSTRAP_MESH_OUTBOUND_MIN} BOOTSTRAP_MESH_N=${BOOTSTRAP_MESH_N} MESH_N_HIGH=${MESH_N_HIGH} MESH_N_LOW=${MESH_N_LOW} MESH_OUTBOUND_MIN=${MESH_OUTBOUND_MIN} MESH_N=${MESH_N} NEXT_VIEW_TIMEOUT=${NEXT_VIEW_TIMEOUT} PROPOSE_MIN_ROUND_TIME=${PROPOSE_MIN_ROUND_TIME} PROPOSE_MAX_ROUND_TIME=${PROPOSE_MAX_ROUND_TIME} /bin/multi-machine-libp2p"] diff --git a/deploy/Dockerfile-Static b/deploy/Dockerfile-Static deleted file mode 100644 index 247693090e..0000000000 --- a/deploy/Dockerfile-Static +++ /dev/null @@ -1,57 +0,0 @@ -# NOTE run from parent directory -FROM ubuntu:jammy - -# assuming this is built already -# to build: -# `nix develop .#staticShell -c bash -c "cargo build --features=async-std-executor --workspace --profile=release-lto --examples"` -COPY target/x86_64-unknown-linux-musl/release-lto/examples/multi-machine-libp2p /bin/multi-machine-libp2p - -# total number of nodes: regular + bootstrap -ENV NUM_NODES="20" - -# number of bootstrap -ENV NUM_BOOTSTRAP="7" - -# number of transactions each round -ENV NUM_TXN_PER_ROUND="10" - -# the index of the node -ENV NODE_IDX="0" - -# how long to run for before dying -# in minutes -ENV ONLINE_TIME="60" - -# the seed to generate phaselock keys with -ENV SEED="1234" - -# logging -ENV RUST_LOG="warn" - -# log format. JSON no ansi -ENV RUST_LOG_FORMAT="json" - -ENV PORT="9000" - -# mesh params -ENV BOOTSTRAP_MESH_N_HIGH="50" -ENV BOOTSTRAP_MESH_N_LOW="10" -ENV BOOTSTRAP_MESH_OUTBOUND_MIN="5" -ENV BOOTSTRAP_MESH_N="15" -ENV MESH_N_HIGH="15" -ENV MESH_N_LOW="8" -ENV MESH_OUTBOUND_MIN="4" -ENV MESH_N="12" - -# in seconds -ENV NEXT_VIEW_TIMEOUT="30" - -# in seconds -ENV PROPOSE_MIN_ROUND_TIME="1" - -# in seconds -ENV PROPOSE_MAX_ROUND_TIME="10" - -EXPOSE 9000 - -CMD ["sh", "-c", "NUM_NODES=${NUM_NODES} NUM_BOOTSTRAP=${NUM_BOOTSTRAP} NUM_TXN_PER_ROUND=${NUM_TXN_PER_ROUND} NODE_IDX=${NODE_IDX} ONLINE_TIME=${ONLINE_TIME} SEED=${SEED} RUST_LOG=${RUST_LOG} BOUND_ADDR=0.0.0.0:${PORT} SEED=${SEED} BOOTSTRAP_MESH_N_HIGH=${BOOTSTRAP_MESH_N_HIGH} BOOTSTRAP_MESH_N_LOW=${BOOTSTRAP_MESH_N_LOW} BOOTSTRAP_MESH_OUTBOUND_MIN=${BOOTSTRAP_MESH_OUTBOUND_MIN} BOOTSTRAP_MESH_N=${BOOTSTRAP_MESH_N} MESH_N_HIGH=${MESH_N_HIGH} MESH_N_LOW=${MESH_N_LOW} MESH_OUTBOUND_MIN=${MESH_OUTBOUND_MIN} MESH_N=${MESH_N} NEXT_VIEW_TIMEOUT=${NEXT_VIEW_TIMEOUT} PROPOSE_MIN_ROUND_TIME=${PROPOSE_MIN_ROUND_TIME} PROPOSE_MAX_ROUND_TIME=${PROPOSE_MAX_ROUND_TIME} /bin/multi-machine-libp2p"] diff --git a/deploy/centralized_server_benchmark_client.Dockerfile b/deploy/centralized_server_benchmark_client.Dockerfile deleted file mode 100644 index 7650f2b694..0000000000 --- a/deploy/centralized_server_benchmark_client.Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -# NOTE run from parent directory -FROM ubuntu:jammy - -# assuming this is built already -COPY target/release-lto/benchmark_client /bin/benchmark_client - -# logging -ENV RUST_LOG="warn" - -# log format. JSON no ansi -ENV RUST_LOG_FORMAT="json" - -ENV HOST="0.us-east-2.cluster.aws.espresso.network" -ENV PORT="2345" - -CMD ["sh", "-c", "RUST_LOG_FORMAT=${RUST_LOG_FORMAT} RUST_LOG=${RUST_LOG} /bin/benchmark_client ${HOST}:${PORT}"] diff --git a/deploy/multi-machine-centralized.Dockerfile b/deploy/multi-machine-centralized.Dockerfile deleted file mode 100644 index 6cef0be8a8..0000000000 --- a/deploy/multi-machine-centralized.Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -# NOTE run from parent directory -FROM ubuntu:jammy - -# assuming this is built already -COPY target/release-lto/examples/multi-machine-centralized /bin/multi-machine-centralized - -# the host to connect to. Must be an IP address -ENV HOST="0.0.0.0" - -# the port to connect to -ENV PORT="2345" - -# logging -ENV RUST_LOG="warn" - -# log format. JSON no ansi -ENV RUST_LOG_FORMAT="json" - -CMD ["sh", "-c", "/bin/multi-machine-centralized $HOST $PORT"] diff --git a/deploy/multi-machine-vrf-centralized.Dockerfile b/deploy/multi-machine-vrf-centralized.Dockerfile deleted file mode 100644 index 41b63aa748..0000000000 --- a/deploy/multi-machine-vrf-centralized.Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -# NOTE run from parent directory -FROM ubuntu:jammy - -# assuming this is built already -COPY target/release-lto/examples/multi-machine-vrf-centralized /bin/multi-machine-vrf-centralized - -# the host to connect to. Must be an IP address -ENV HOST="0.0.0.0" - -# the port to connect to -ENV PORT="2345" - -# logging -ENV RUST_LOG="error" - -# log format. JSON no ansi -ENV RUST_LOG_FORMAT="json" - -CMD ["sh", "-c", "/bin/multi-machine-vrf-centralized $HOST $PORT"] \ No newline at end of file diff --git a/deploy/multi-machine-web.Dockerfile b/deploy/multi-machine-web.Dockerfile deleted file mode 100644 index 1802a4029e..0000000000 --- a/deploy/multi-machine-web.Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -# NOTE run from parent directory -FROM ubuntu:jammy - -# assuming this is built already -COPY target/release-lto/examples/web-server-da-validator /bin/web-server-da-validator - -# the host to connect to. Must be an IP address -ENV HOST="0.0.0.0" - -# the port to connect to -ENV PORT="2345" - -# logging -ENV RUST_LOG="warn" - -# log format. JSON no ansi -ENV RUST_LOG_FORMAT="json" - -CMD ["sh", "-c", "/bin/web-server-da-validator $HOST $PORT"] diff --git a/deploy/validator-libp2p.Dockerfile b/deploy/validator-libp2p.Dockerfile new file mode 100644 index 0000000000..36aa59f3bb --- /dev/null +++ b/deploy/validator-libp2p.Dockerfile @@ -0,0 +1,13 @@ +FROM ubuntu:jammy + +ARG TARGETARCH + +COPY ./target/$TARGETARCH/debug/examples/validator-libp2p /usr/local/bin/validator-libp2p + +# logging +ENV RUST_LOG="warn" + +# log format. JSON no ansi +ENV RUST_LOG_FORMAT="json" + +ENTRYPOINT ["validator-libp2p"] diff --git a/deploy/validator-webserver.Dockerfile b/deploy/validator-webserver.Dockerfile new file mode 100644 index 0000000000..10b7b5257c --- /dev/null +++ b/deploy/validator-webserver.Dockerfile @@ -0,0 +1,13 @@ +FROM ubuntu:jammy + +ARG TARGETARCH + +COPY ./target/$TARGETARCH/debug/examples/validator-webserver /usr/local/bin/validator-webserver + +# logging +ENV RUST_LOG="warn" + +# log format. JSON no ansi +ENV RUST_LOG_FORMAT="json" + +ENTRYPOINT ["validator-webserver"] diff --git a/deploy/web-server.Dockerfile b/deploy/web-server.Dockerfile deleted file mode 100644 index c980d25bb1..0000000000 --- a/deploy/web-server.Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -# NOTE run from parent directory -FROM ubuntu:jammy - -COPY target/release-lto/examples/web-server /bin/web-server - -EXPOSE 9000 - -CMD ["web-server"]