Skip to content

Commit

Permalink
chore: add reth configuration & cleanup configs (#271)
Browse files Browse the repository at this point in the history
* Add Reth Node Configuration

* Parameterize features

* update images to use alpine / static versions

* Restructure client files into separate directories

* Allow images to work w/ devnets

* bump reth commit

* fix the image name to include base-org

* Allow overriding via env var
  • Loading branch information
danyalprout authored Jun 14, 2024
1 parent b63b798 commit acc4e30
Show file tree
Hide file tree
Showing 18 changed files with 204 additions and 29,832 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
GETH_HOST_DATA_DIR=./geth-data
CLIENT=${CLIENT:-geth}
HOST_DATA_DIR=./${CLIENT}-data
8 changes: 4 additions & 4 deletions .env.mainnet
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
RETH_CHAIN=base
RETH_SEQUENCER_HTTP=https://mainnet-sequencer.base.org

OP_GETH_GENESIS_FILE_PATH=mainnet/genesis-l2.json
OP_GETH_SEQUENCER_HTTP=https://mainnet-sequencer.base.org

# [optional] used to enable geth stats:
# OP_GETH_ETH_STATS=nodename:secret@host:port

Expand All @@ -13,9 +15,8 @@ OP_NODE_L1_BEACON=https://your.mainnet.beacon.node/endpoint-here
# auth secret used by op-geth engine API:
OP_NODE_L2_ENGINE_AUTH_RAW=688f5d737bad920bdfb2fc2f488d6b6209eebda1dae949a8de91398d932c517a

OP_NODE_BETA_EXTRA_NETWORKS=true
OP_NODE_L2_ENGINE_AUTH=/tmp/engine-auth-jwt
OP_NODE_L2_ENGINE_RPC=ws://geth:8551
OP_NODE_L2_ENGINE_RPC=ws://execution:8551
OP_NODE_LOG_LEVEL=info
OP_NODE_METRICS_ADDR=0.0.0.0
OP_NODE_METRICS_ENABLED=true
Expand All @@ -26,7 +27,6 @@ OP_NODE_P2P_BOOTNODES=enr:-J24QNz9lbrKbN4iSmmjtnr7SjUMk4zB7f1krHZcTZx-JRKZd0kA2g
OP_NODE_P2P_LISTEN_IP=0.0.0.0
OP_NODE_P2P_LISTEN_TCP_PORT=9222
OP_NODE_P2P_LISTEN_UDP_PORT=9222
OP_NODE_ROLLUP_CONFIG=mainnet/rollup.json
OP_NODE_RPC_ADDR=0.0.0.0
OP_NODE_RPC_PORT=8545
OP_NODE_SNAPSHOT_LOG=/tmp/op-node-snapshot-log
Expand Down
7 changes: 4 additions & 3 deletions .env.sepolia
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
RETH_CHAIN=base-sepolia
RETH_SEQUENCER_HTTP=https://sepolia-sequencer.base.org

OP_GETH_GENESIS_FILE_PATH=sepolia/genesis-l2.json
OP_GETH_SEQUENCER_HTTP=https://sepolia-sequencer.base.org

Expand All @@ -13,9 +16,8 @@ OP_NODE_L1_BEACON=https://your.sepolia.beacon.node/endpoint-here
# auth secret used by op-geth engine API:
OP_NODE_L2_ENGINE_AUTH_RAW=688f5d737bad920bdfb2fc2f488d6b6209eebda1dae949a8de91398d932c517a

OP_NODE_BETA_EXTRA_NETWORKS=true
OP_NODE_L2_ENGINE_AUTH=/tmp/engine-auth-jwt
OP_NODE_L2_ENGINE_RPC=ws://geth:8551
OP_NODE_L2_ENGINE_RPC=ws://execution:8551
OP_NODE_LOG_LEVEL=info
OP_NODE_METRICS_ADDR=0.0.0.0
OP_NODE_METRICS_ENABLED=true
Expand All @@ -26,7 +28,6 @@ OP_NODE_P2P_BOOTNODES=enr:-J64QBwRIWAco7lv6jImSOjPU_W266lHXzpAS5YOh7WmgTyBZkgLgO
OP_NODE_P2P_LISTEN_IP=0.0.0.0
OP_NODE_P2P_LISTEN_TCP_PORT=9222
OP_NODE_P2P_LISTEN_UDP_PORT=9222
OP_NODE_ROLLUP_CONFIG=sepolia/rollup.json
OP_NODE_RPC_ADDR=0.0.0.0
OP_NODE_RPC_PORT=8545
OP_NODE_SNAPSHOT_LOG=/tmp/op-node-snapshot-log
Expand Down
53 changes: 50 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ on:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
NAMESPACE: ghcr.io/base-org
GETH_DEPRECATED_IMAGE_NAME: node
GETH_IMAGE_NAME: node-geth
RETH_IMAGE_NAME: node-reth

jobs:
build:
geth:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -29,7 +32,9 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: |
${{ env.NAMESPACE }}/${{ env.GETH_DEPRECATED_IMAGE_NAME }}
${{ env.NAMESPACE }}/${{ env.GETH_IMAGE_NAME }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -38,7 +43,49 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
file: geth/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
reth:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: linux/amd64
features: jemalloc,asm-keccak,optimism
- arch: linux/arm64
features: jemalloc,optimism
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Log into the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for the Docker image
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ env.NAMESPACE }}/${{ env.RETH_IMAGE_NAME }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push the Docker image
uses: docker/build-push-action@v4
with:
context: .
file: reth/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
FEATURES=${{ matrix.features }}
platforms: ${{ matrix.arch }}
28 changes: 27 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:

jobs:
build:
geth:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -20,5 +20,31 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
file: geth/Dockerfile
push: false
platforms: ${{ matrix.arch }}
reth:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: linux/amd64
features: jemalloc,asm-keccak,optimism
- arch: linux/arm64
features: jemalloc,optimism
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build the Docker image
uses: docker/build-push-action@v4
with:
context: .
file: reth/Dockerfile
push: false
build-args: |
FEATURES=${{ matrix.features }}
platforms: ${{ matrix.arch }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/.idea/
/geth-data/
/geth-data/
/reth-data/
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ If you encounter problems with your node, please open a [GitHub issue](https://g

### Supported networks

| Ethereum Network | Status |
| ---------------- | ------ |
| Sepolia testnet ||
| Mainnet ||
| Base Network | Status |
|-------------------| ------ |
| Testnet (Sepolia) ||
| Mainnet ||

### Usage

Expand Down
36 changes: 18 additions & 18 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
version: '3.8'

services:
geth: # this is Optimism's geth client
build: .
execution:
build:
context: .
dockerfile: ${CLIENT}/Dockerfile
ports:
- 8545:8545 # RPC
- 8546:8546 # websocket
- 30303:30303 # P2P TCP (currently unused)
- 30303:30303/udp # P2P UDP (currently unused)
- 7301:6060 # metrics
command: [ "bash", "./geth-entrypoint" ]
- "8545:8545" # RPC
- "8546:8546" # websocket
- "7301:6060" # metrics
command: [ "bash", "./execution-entrypoint" ]
volumes:
- ${GETH_HOST_DATA_DIR}:/data
- ${HOST_DATA_DIR}:/data
env_file:
# select your network here:
# - .env.sepolia
# - .env.mainnet
node:
build: .
build:
context: .
dockerfile: ${CLIENT}/Dockerfile
depends_on:
- geth
- execution
ports:
- 7545:8545 # RPC
- 9222:9222 # P2P TCP
- 9222:9222/udp # P2P UDP
- 7300:7300 # metrics
- 6060:6060 # pprof
- "7545:8545" # RPC
- "9222:9222" # P2P TCP
- "9222:9222/udp" # P2P UDP
- "7300:7300" # metrics
- "6060:6060" # pprof
command: [ "bash", "./op-node-entrypoint" ]
env_file:
# select your network here:
Expand Down
6 changes: 2 additions & 4 deletions Dockerfile → geth/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ RUN git clone $REPO --branch $VERSION --single-branch . && \

RUN go run build/ci.go install -static ./cmd/geth

FROM golang:1.21
FROM ubuntu:22.04

RUN apt-get update && \
apt-get install -y jq curl supervisor && \
Expand All @@ -42,9 +42,7 @@ WORKDIR /app
COPY --from=op /app/op-node/bin/op-node ./
COPY --from=geth /app/build/bin/geth ./
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY geth-entrypoint .
COPY geth/geth-entrypoint ./execution-entrypoint
COPY op-node-entrypoint .
COPY sepolia ./sepolia
COPY mainnet ./mainnet

CMD ["/usr/bin/supervisord"]
File renamed without changes.
Loading

0 comments on commit acc4e30

Please sign in to comment.