Skip to content

Commit

Permalink
Add builder Dockerfile (#1305)
Browse files Browse the repository at this point in the history
add builder Dockerfile

  * Update docker-compose and friends
  * add builder to local scripts
  * Add --ignore-environment to `nix` invocation

---------

Co-authored-by: tbro <[email protected]>
Co-authored-by: Jeremy <[email protected]>
  • Loading branch information
3 people authored Apr 9, 2024
1 parent 1cb507e commit d811243
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ ESPRESSO_STATE_SIGNATURE_WEIGHT_THRESHOLD=3
ESPRESSO_PROVER_SERVICE_PORT=60001
ESPRESSO_STATE_PROVER_UPDATE_INTERVAL=10m

# Builder service
ESPRESSO_BUILDER_SERVER_PORT=60003
BUILDER_CHANNEL_CAPACITY=1024

# Load generator
ESPRESSO_SUBMIT_TRANSACTIONS_DELAY=1s
ESPRESSO_SUBMIT_TRANSACTIONS_PORT=44010
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ jobs:
target/release/reset-storage
target/release/deploy
target/release/keygen
target/release/permissionless-builder
target/release/nasty-client
build-arm:
Expand Down Expand Up @@ -115,6 +116,7 @@ jobs:
target/release/reset-storage
target/release/deploy
target/release/keygen
target/release/permissionless-builder
target/release/nasty-client
build-dockers:
Expand All @@ -129,6 +131,7 @@ jobs:
commitment-task-tag: ${{ steps.commitment-task.outputs.tags }}
submit-transactions-tag: ${{ steps.submit-transactions.outputs.tags }}
deploy-tag: ${{ steps.deploy.outputs.tags }}
builder-tag: ${{ steps.builder.outputs.tags }}
nasty-client-tag: ${{ steps.nasty-client.outputs.tags }}
steps:
- name: Checkout Repository
Expand Down Expand Up @@ -293,6 +296,16 @@ jobs:
tags: ${{ steps.deploy.outputs.tags }}
labels: ${{ steps.deploy.outputs.labels }}

- name: Build and push builder docker
uses: docker/build-push-action@v5
with:
context: ./
file: ./docker/permissionless-builder.Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.builder.outputs.tags }}
labels: ${{ steps.builder.outputs.labels }}

- name: Build and push nasty-client docker
uses: docker/build-push-action@v5
with:
Expand Down Expand Up @@ -326,6 +339,7 @@ jobs:
docker pull ${{ needs.build-dockers.outputs.commitment-task-tag }}
docker pull ${{ needs.build-dockers.outputs.submit-transactions-tag }}
docker pull ${{ needs.build-dockers.outputs.deploy-tag }}
docker pull ${{ needs.build-dockers.outputs.builder-tag }}
docker pull ${{ needs.build-dockers.outputs.nasty-client-tag }}
- name: Tag new docker images
run: |
Expand Down
21 changes: 21 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,27 @@ services:
sequencer0:
condition: service_healthy

permissionless-builder:
image: ghcr.io/espressosystems/espresso-sequencer/permissionless-builder:main
ports:
- "$ESPRESSO_BUILDER_SERVER_PORT:$ESPRESSO_BUILDER_SERVER_PORT"
environment:
- ESPRESSO_SEQUENCER_URL
- ESPRESSO_SEQUENCER_DA_SERVER_URL
- ESPRESSO_BUILDER_KEY_FILE
- ESPRESSO_BUILDER_ETH_MNEMONIC
- ESPRESSO_BUILDER_ETH_ACCOUNT_INDEX
- ESPRESSO_BUILDER_L1_PROVIDER
- BUILDER_SERVER_PORT=$ESPRESSO_BUILDER_SERVER_PORT
- BUILDER_ADDRESS
- BUILDER_CHANNEL_CAPACITY=$BUILDER_CHANNEL_CAPACITY
- RUST_LOG
- RUST_LOG_FORMAT
- ASYNC_STD_THREAD_COUNT
depends_on:
sequencer0:
condition: service_healthy

nasty-client:
image: ghcr.io/espressosystems/espresso-sequencer/nasty-client:main
ports:
Expand Down
15 changes: 15 additions & 0 deletions docker/permissionless-builder.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM ubuntu:jammy

ARG TARGETARCH

RUN apt-get update \
&& apt-get install -y curl libcurl4 wait-for-it tini \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["tini", "--"]

COPY target/$TARGETARCH/release/permissionless-builder /bin/permissionless-builder
RUN chmod +x /bin/permissionless-builder

ENV BUILDER_SERVER_PORT=60003

CMD [ "/bin/permisisonless-builder"]
7 changes: 7 additions & 0 deletions process-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,13 @@ processes:
path: /healthcheck
failure_threshold: 100

permissionless-builder:
command: permissionless-builder
depends_on:
sequencer0:
condition: process_healthy
da_server:

nasty-client:
command: nasty-client
depends_on:
Expand Down
7 changes: 4 additions & 3 deletions scripts/build-docker-images
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
set -euxo pipefail

nix develop .#crossShell --command cargo build --release
nix develop .#armCrossShell --command cargo build --release
nix develop .#crossShell --ignore-environment --command cargo build --release
nix develop .#armCrossShell --ignore-environment --command cargo build --release

# The rest of the script doesn't run in a nix shell but we need to know where
# the binaries are.
Expand Down Expand Up @@ -32,7 +32,7 @@ for ARCH in "amd64" "arm64"; do
;;
esac
mkdir -p ${WORKDIR}/target/$ARCH/release
for binary in "orchestrator" "web-server" "sequencer" "commitment-task" "submit-transactions" "reset-storage" "state-relay-server" "state-prover" "deploy" "keygen" "nasty-client"; do
for binary in "orchestrator" "web-server" "sequencer" "commitment-task" "submit-transactions" "reset-storage" "state-relay-server" "state-prover" "deploy" "keygen" "permissionless-builder" "nasty-client"; do
cp -v "${CARGO_TARGET_DIR}/${TARGET}/release/$binary" ${WORKDIR}/target/$ARCH/release
done
done
Expand All @@ -46,4 +46,5 @@ docker build -t ghcr.io/espressosystems/espresso-sequencer/sequencer:main -f doc
docker build -t ghcr.io/espressosystems/espresso-sequencer/commitment-task:main -f docker/commitment-task.Dockerfile ${WORKDIR}
docker build -t ghcr.io/espressosystems/espresso-sequencer/submit-transactions:main -f docker/submit-transactions.Dockerfile ${WORKDIR}
docker build -t ghcr.io/espressosystems/espresso-sequencer/deploy:main -f docker/deploy.Dockerfile ${WORKDIR}
docker build -t ghcr.io/espressosystems/espresso-sequencer/permissionless-builder:main -f docker/permissionless-builder.Dockerfile ${WORKDIR}
docker build -t ghcr.io/espressosystems/espresso-sequencer/nasty-client:main -f docker/nasty-client.Dockerfile ${WORKDIR}
3 changes: 2 additions & 1 deletion scripts/build-docker-images-native
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ cleanup(){
}

mkdir -p ${WORKDIR}/target/$ARCH/release
for binary in "orchestrator" "web-server" "sequencer" "commitment-task" "submit-transactions" "reset-storage" "state-relay-server" "state-prover" "deploy" "keygen" "nasty-client"; do
for binary in "orchestrator" "web-server" "sequencer" "commitment-task" "submit-transactions" "reset-storage" "state-relay-server" "state-prover" "deploy" "keygen" "permissionless-builder" "nasty-client"; do
cp -v "${CARGO_TARGET_DIR}/release/$binary" ${WORKDIR}/target/$ARCH/release
# Patch the interpreter for running without nix inside the ubuntu based docker image.
if [ $KERNEL == "linux" ]; then
Expand All @@ -89,4 +89,5 @@ docker build --platform $PLATFORM -t ghcr.io/espressosystems/espresso-sequencer/
docker build --platform $PLATFORM -t ghcr.io/espressosystems/espresso-sequencer/commitment-task:main -f docker/commitment-task.Dockerfile ${WORKDIR}
docker build --platform $PLATFORM -t ghcr.io/espressosystems/espresso-sequencer/submit-transactions:main -f docker/submit-transactions.Dockerfile ${WORKDIR}
docker build --platform $PLATFORM -t ghcr.io/espressosystems/espresso-sequencer/deploy:main -f docker/deploy.Dockerfile ${WORKDIR}
docker build -t ghcr.io/espressosystems/espresso-sequencer/permissionless-builder:main -f docker/permissionless-builder.Dockerfile ${WORKDIR}
docker build --platform $PLATFORM -t ghcr.io/espressosystems/espresso-sequencer/nasty-client:main -f docker/nasty-client.Dockerfile ${WORKDIR}

0 comments on commit d811243

Please sign in to comment.