Skip to content

Commit d28ee2c

Browse files
committed
refactor: simplify node-reth setup with upstream images
Remove custom Dockerfiles in favor of building from GitHub/local paths via justfile. Split docker-compose into separate execution (node-reth) and consensus (op-node) services using official op-node image. Add OP Node configuration to .env.example with comprehensive settings for consensus layer integration.
1 parent 9232868 commit d28ee2c

File tree

5 files changed

+117
-83
lines changed

5 files changed

+117
-83
lines changed

.env.example

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,30 @@ TIPS_UI_S3_CONFIG_TYPE=manual
3333
TIPS_UI_S3_ENDPOINT=http://localhost:7000
3434
TIPS_UI_S3_ACCESS_KEY_ID=minioadmin
3535
TIPS_UI_S3_SECRET_ACCESS_KEY=minioadmin
36+
37+
# OP Node (Consensus Layer) - Configuration for node-reth-consensus
38+
OP_NODE_NETWORK=
39+
OP_NODE_ROLLUP_CONFIG=/data/rollup.json
40+
OP_NODE_ROLLUP_LOAD_PROTOCOL_VERSIONS=true
41+
OP_NODE_SYNCMODE=consensus-layer
42+
OP_NODE_L1_ETH_RPC=http://host.docker.internal:8545
43+
OP_NODE_L1_BEACON=http://host.docker.internal:3500
44+
OP_NODE_L1_RPC_KIND=debug_geth
45+
OP_NODE_L1_TRUST_RPC=false
46+
OP_NODE_L2_ENGINE_KIND=reth
47+
OP_NODE_L2_ENGINE_AUTH=/data/jwtsecret
48+
OP_NODE_P2P_LISTEN_IP=0.0.0.0
49+
OP_NODE_P2P_LISTEN_TCP_PORT=9222
50+
OP_NODE_P2P_LISTEN_UDP_PORT=9222
51+
OP_NODE_P2P_INTERNAL_IP=true
52+
OP_NODE_P2P_ADVERTISE_IP=host.docker.internal
53+
OP_NODE_P2P_NO_DISCOVERY=true
54+
OP_NODE_RPC_ADDR=0.0.0.0
55+
OP_NODE_RPC_PORT=8545
56+
OP_NODE_LOG_LEVEL=debug
57+
OP_NODE_LOG_FORMAT=json
58+
OP_NODE_SNAPSHOT_LOG=/tmp/op-node-snapshot-log
59+
OP_NODE_METRICS_ENABLED=true
60+
OP_NODE_METRICS_ADDR=0.0.0.0
61+
OP_NODE_METRICS_PORT=7300
62+
STATSD_ADDRESS=172.17.0.1

Dockerfile.node-reth

Lines changed: 0 additions & 29 deletions
This file was deleted.

Dockerfile.node-reth.local

Lines changed: 0 additions & 24 deletions
This file was deleted.

docker-compose.yml

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -73,36 +73,55 @@ services:
7373
exit 0;
7474
"
7575
76-
node-reth:
77-
build:
78-
context: ${NODE_RETH_LOCAL_PATH:-.}
79-
dockerfile: ${NODE_RETH_DOCKERFILE:-Dockerfile.node-reth}
80-
args:
81-
NODE_RETH_REF: ${NODE_RETH_REF:-tips}
76+
# Ethereum Nodes in TIPS
77+
# ======================
78+
#
79+
# ┌─────────────────────┬──────────────────────────────────┬─────────────────────────────────────┐
80+
# │ Component │ Production │ Local Development │
81+
# ├─────────────────────┼──────────────────────────────────┼─────────────────────────────────────┤
82+
# │ Sequencer │ │ │
83+
# │ - Consensus Layer │ "consensus" container running │ builder-playground op-node │
84+
# │ │ op-node │ (runs separately within Docker) │
85+
# │ - Execution Layer │ "execution" container running │ builder-playground op-geth │
86+
# │ │ base/node-reth │ (runs separately within Docker) │
87+
# │ - Builder │ "builder" container running │ op-rbuilder │
88+
# │ │ op-rbuilder │ (runs on host machine) │
89+
# ├─────────────────────┼──────────────────────────────────┼─────────────────────────────────────┤
90+
# │ RPC Node │ │ │
91+
# │ - Consensus Layer │ "consensus" container running │ node-reth-consensus (container) │
92+
# │ │ op-node │ │
93+
# │ - Execution Layer │ "execution" container running │ node-reth-execution (container) │
94+
# │ │ base/node-reth │ │
95+
# ├─────────────────────┼──────────────────────────────────┼─────────────────────────────────────┤
96+
# │ L1 Dependencies │ Externally hosted L1 node │ builder-playground el + beacon │
97+
# │ │ │ (el: 8545, beacon: 3500) │
98+
# └─────────────────────┴──────────────────────────────────┴─────────────────────────────────────┘
99+
100+
node-reth-execution:
82101
image: node-reth:latest
83-
container_name: tips-node-reth
84-
ports:
85-
- "2222:8545"
86-
- "2223:8546"
87-
- "1115:1115"
88-
- "30303:30303"
102+
container_name: tips-node-reth-execution
89103
volumes:
90-
- ./data/node-reth:/data
91-
command: >
92-
node
93-
--datadir /data
94-
--chain base-sepolia
95-
--http
96-
--http.addr 0.0.0.0
97-
--http.port 8545
98-
--http.api eth,net,web3,txpool,base
99-
--ws
100-
--ws.addr 0.0.0.0
101-
--ws.port 8546
102-
--ws.api eth,net,web3,txpool,base
104+
- ~/.playground/devnet/jwtsecret:/data/jwtsecret:ro
105+
- ~/.playground/devnet/rollup.json:/data/rollup.json:ro
106+
- ~/.playground/devnet:/playground
107+
command: ["node", "--datadir", "/playground/tips-node-reth"]
103108
restart: unless-stopped
104109
healthcheck:
105110
test: ["CMD-SHELL", "curl -sf http://localhost:8545 -X POST -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":1}' || exit 1"]
106111
interval: 10s
107112
timeout: 5s
108-
retries: 10
113+
retries: 10
114+
115+
node-reth-consensus:
116+
image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-node:v1.13.7
117+
container_name: tips-node-reth-consensus
118+
depends_on:
119+
node-reth-execution:
120+
condition: service_healthy
121+
volumes:
122+
- ~/.playground/devnet/jwtsecret:/data/jwtsecret:ro
123+
- ~/.playground/devnet/rollup.json:/data/rollup.json:ro
124+
env_file:
125+
- .env.docker
126+
environment:
127+
OP_NODE_L2_ENGINE_RPC: http://node-reth-execution:8551

justfile

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ stop-all:
3838
export COMPOSE_FILE=docker-compose.yml:docker-compose.tips.yml && docker compose down && docker compose rm && rm -rf data/
3939

4040
# Start every service running in docker, useful for demos
41-
start-all: stop-all
41+
start-all: stop-all ensure-node-reth-image
4242
export COMPOSE_FILE=docker-compose.yml:docker-compose.tips.yml && mkdir -p data/kafka data/minio data/node-reth && docker compose build && docker compose up -d
4343

4444
# Start every service in docker, except the one you're currently working on. e.g. just start-except ui ingress-rpc
45-
start-except programs: stop-all
45+
start-except programs: stop-all ensure-node-reth-image
4646
#!/bin/bash
47-
all_services=(kafka kafka-setup minio minio-setup node-reth ingress-rpc audit ui)
47+
all_services=(kafka kafka-setup minio minio-setup node-reth-execution node-reth-consensus ingress-rpc audit ui)
4848
exclude_services=({{ programs }})
4949

5050
# Create result array with services not in exclude list
@@ -84,4 +84,45 @@ ingress-writer:
8484
cargo run --bin tips-ingress-writer
8585

8686
ui:
87-
cd ui && yarn dev
87+
cd ui && yarn dev
88+
89+
# Build node-reth Docker image
90+
# Args:
91+
# ref: Git ref to build from GitHub (default: "main")
92+
# local: Local path to build from (default: "" = use GitHub)
93+
# Examples:
94+
# just build-node-reth # Build from GitHub main branch
95+
# just build-node-reth ref=v1.2.3 # Build from GitHub tag v1.2.3
96+
# just build-node-reth local=../node-reth # Build from local checkout
97+
# Tags created: node-reth:latest and node-reth:<commit-hash> (adds -dirty suffix if local working tree has changes)
98+
build-node-reth ref="main" local="":
99+
#!/bin/bash
100+
if [ -z "{{ local }}" ]; then
101+
echo "Building node-reth from GitHub ref: {{ ref }}"
102+
# Get the commit hash for the ref
103+
COMMIT_HASH=$(git ls-remote https://github.com/base/node-reth.git {{ ref }} | cut -f1 | cut -c1-8)
104+
echo "Commit hash: $COMMIT_HASH"
105+
docker build -t node-reth:latest -t node-reth:$COMMIT_HASH \
106+
-f https://raw.githubusercontent.com/base/node-reth/{{ ref }}/Dockerfile \
107+
https://github.com/base/node-reth.git#{{ ref }}
108+
else
109+
echo "Building node-reth from local path: {{ local }}"
110+
# Get the commit hash from local repo
111+
cd {{ local }}
112+
COMMIT_HASH=$(git rev-parse --short=8 HEAD)
113+
# Check if working tree is dirty
114+
if ! git diff-index --quiet HEAD --; then
115+
COMMIT_HASH="${COMMIT_HASH}-dirty"
116+
fi
117+
echo "Commit hash: $COMMIT_HASH"
118+
docker build -t node-reth:latest -t node-reth:$COMMIT_HASH -f {{ local }}/Dockerfile {{ local }}
119+
fi
120+
121+
ensure-node-reth-image:
122+
#!/bin/bash
123+
if ! docker image inspect node-reth:latest >/dev/null 2>&1; then
124+
echo "node-reth:latest image not found, building..."
125+
just build-node-reth
126+
else
127+
echo "node-reth:latest image already exists"
128+
fi

0 commit comments

Comments
 (0)