Skip to content

Commit 2e0d3da

Browse files
niranwlawt
authored andcommitted
feat: automate builder-playground P2P configuration
The playground-env target extracts the builder-playground host IP and op-node peer ID from logs, eliminating manual configuration. Running 'just sync-env' now automatically generates the correct P2P static peer configuration for connecting to builder-playground.
1 parent 73f5c7a commit 2e0d3da

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.env.example

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ TIPS_UI_S3_SECRET_ACCESS_KEY=minioadmin
3333
OP_NODE_NETWORK=
3434
OP_NODE_ROLLUP_CONFIG=/data/rollup.json
3535
OP_NODE_ROLLUP_LOAD_PROTOCOL_VERSIONS=true
36-
OP_NODE_SYNCMODE=consensus-layer
3736
OP_NODE_L1_ETH_RPC=http://host.docker.internal:8545
3837
OP_NODE_L1_BEACON=http://host.docker.internal:3500
39-
OP_NODE_L1_RPC_KIND=debug_geth
38+
OP_NODE_L1_RPC_KIND=basic
4039
OP_NODE_L1_TRUST_RPC=false
4140
OP_NODE_L2_ENGINE_KIND=reth
4241
OP_NODE_L2_ENGINE_AUTH=/data/jwtsecret
@@ -45,7 +44,7 @@ OP_NODE_P2P_LISTEN_TCP_PORT=9222
4544
OP_NODE_P2P_LISTEN_UDP_PORT=9222
4645
OP_NODE_P2P_INTERNAL_IP=true
4746
OP_NODE_P2P_ADVERTISE_IP=host.docker.internal
48-
OP_NODE_P2P_NO_DISCOVERY=true
47+
OP_NODE_P2P_NO_DISCOVERY=false
4948
OP_NODE_RPC_ADDR=0.0.0.0
5049
OP_NODE_RPC_PORT=8545
5150
OP_NODE_LOG_LEVEL=debug

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Thumbs.db
1919
# Environment variables
2020
.env
2121
.env.docker
22+
.env.playground
2223
/ui/.env
2324

2425
# Claude

justfile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,25 @@ sync: deps-reset
2222
### REFORMAT ###
2323
just fix
2424

25-
sync-env:
25+
playground-env:
26+
#!/bin/bash
27+
HOST_IP=$(docker run --rm alpine nslookup host.docker.internal | awk '/Address: / && $2 !~ /:/ {print $2; exit}')
28+
PEER_ID=$(grep 'started p2p host' ~/.playground/devnet/logs/op-node.log | sed -n 's/.*peerID=\([^ ]*\).*/\1/p' | head -1)
29+
echo "BUILDER_PLAYGROUND_HOST_IP=$HOST_IP" > .env.playground
30+
echo "BUILDER_PLAYGROUND_PEER_ID=$PEER_ID" >> .env.playground
31+
echo "OP_NODE_P2P_STATIC=/ip4/$HOST_IP/tcp/9003/p2p/$PEER_ID" >> .env.playground
32+
cat .env.playground
33+
34+
sync-env: playground-env
2635
cp .env.example .env
2736
cp .env.example ./ui/.env
2837
cp .env.example .env.docker
2938
# Change kafka ports
3039
sed -i '' 's/localhost:9092/host.docker.internal:9094/g' ./.env.docker
3140
# Change other dependencies
3241
sed -i '' 's/localhost/host.docker.internal/g' ./.env.docker
42+
# Append playground-specific P2P config
43+
cat .env.playground >> .env.docker
3344

3445
stop-all:
3546
export COMPOSE_FILE=docker-compose.yml:docker-compose.tips.yml && docker compose down && docker compose rm && rm -rf data/

0 commit comments

Comments
 (0)