forked from flashbots/builder
-
Notifications
You must be signed in to change notification settings - Fork 0
Dind updates WIP. #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
333d014
tested dind
OlegJakushkin 8a3d7e8
Started finetuning fore public ports on eth package
OlegJakushkin 9ef02d2
Merge remote-tracking branch 'origin/main' into dind
OlegJakushkin 475e6c7
clean up dind docs
OlegJakushkin b3cb7c0
added wip disclamer
OlegJakushkin 02fea33
fix diff with main
OlegJakushkin cc3f7bb
fix distance to main
OlegJakushkin d32645f
Update scripts/README.md
piwonskp c824177
Update scripts/README.md
piwonskp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,28 @@ | ||
| FROM mcr.microsoft.com/devcontainers/base:bullseye | ||
| FROM docker:dind | ||
|
|
||
| # Get Go | ||
| RUN apt install git curl tar && \ | ||
| curl https://dl.google.com/go/go1.21.3.linux-amd64.tar.gz -o go.tar.gz && \ | ||
| # Create the /etc/machine-id file | ||
| RUN apk add --no-cache dbus && \ | ||
| dbus-uuidgen > /etc/machine-id | ||
|
|
||
| # Install required packages | ||
| RUN apk add --no-cache git curl tar | ||
|
|
||
| # Download and install Go | ||
| RUN curl https://dl.google.com/go/go1.21.3.linux-amd64.tar.gz -o go.tar.gz && \ | ||
| tar -C /usr/local -xzf go.tar.gz && \ | ||
| rm go.tar.gz | ||
|
|
||
| # Set up Go environment variables | ||
| ENV GOPATH /go | ||
| ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH | ||
| RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" | ||
| RUN mkdir -p "${GOPATH}/src" "${GOPATH}/bin" && chmod -R 777 "${GOPATH}" | ||
|
|
||
| # Download and install Kurtosis CLI | ||
| RUN curl -L "https://github.com/kurtosis-tech/kurtosis-cli-release-artifacts/releases/download/0.85.3/kurtosis-cli_0.85.3_linux_amd64.tar.gz" -o kurtosis-cli.tar.gz && \ | ||
| tar -xzvf kurtosis-cli.tar.gz -C /usr/local/bin && \ | ||
| rm kurtosis-cli.tar.gz | ||
|
|
||
| # Install Kurtosis | ||
| RUN echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | tee /etc/apt/sources.list.d/kurtosis.list | ||
| RUN sudo apt update && \ | ||
| sudo apt install kurtosis-cli | ||
| ADD . /go-ethereum | ||
| WORKDIR /go-ethereum/scripts/ | ||
|
|
||
| WORKDIR /geth | ||
| COPY ../ . | ||
| ENV DOCKER_HOST=unix:///var/run/docker.sock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # Emulate Network Using Docker-in-Docker (DinD) | ||
|
|
||
| This documentation details the use of Docker-in-Docker (DinD) to emulate network environments for testing builder performance. This method provides an isolated environment, removing the need for Go or Kurtosis installations on the host system. | ||
|
|
||
| ## Introduction | ||
|
|
||
| Utilizing a DinD setup allows developers to create a contained environment where Docker images can be built and Kurtosis enclaves can be managed. This is particularly useful for simulating network conditions in a clean state without affecting the host's setup. | ||
|
|
||
| ## Running in a DinD Environment | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - **Docker**: Ensure Docker is installed and running on your system. The DinD process will be running as a Docker container. | ||
|
|
||
| ### Setup and Execution | ||
|
|
||
| 1. **Create the DinD Environment**: | ||
| - Run a DinD container for an isolated build environment named `builder-dind-container` assuming you are currently in this folder: | ||
| ```shell | ||
| docker build -f ./Dockerfile.kurtosis_dind -t builder-dind-image ../../ | ||
| docker run -dit --privileged --name builder-dind-container builder-dind-image | ||
| ``` | ||
| ***note:*** privileged mode that is not needed when using local hosting in your docker described [here](../) | ||
|
|
||
| 2. **Build the Builder Image**: | ||
| - Execute the build command within the DinD environment: | ||
| ```shell | ||
| docker exec builder-dind-container go run emulate_network.go build -t=custom-builder-tag | ||
| ``` | ||
|
|
||
| 3. **Start the Enclave**: | ||
| - Start an enclave with the specified builder image: | ||
| ```shell | ||
| docker exec builder-dind-container go run emulate_network.go run -n=builder-enclave -t=custom-builder-tag | ||
| ``` | ||
|
|
||
| 4. **Stop the Enclave**: | ||
| - To stop a running enclave, use the following command: | ||
| ```shell | ||
| docker exec builder-dind-container go run emulate_network.go stop -n=builder-enclave | ||
| ``` | ||
|
|
||
| 5. **Cleanup**: | ||
| - To stop and remove the DinD container, execute: | ||
| ```shell | ||
| docker stop builder-dind-container | ||
| docker rm builder-dind-container | ||
| ``` | ||
|
|
||
| **Note**: Replace `builder-dind-container` with a descriptive name relevant to your project, and `builder-dind-image` with the image name you've prepared for the DinD environment. The `custom-builder-tag` should be replaced with the actual tag name you wish to assign to your builder image. | ||
|
|
||
| ## Known Issues and Solutions | ||
| Ports control is missing in ethereum-package. | ||
|
|
||
| By following these instructions, developers can leverage a Docker-in-Docker approach to emulate networks and test builder performance in a controlled and isolated manner. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.