Skip to content

Commit 9c9ae73

Browse files
committed
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 4fc3d46 commit 9c9ae73

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
@@ -31,10 +31,9 @@ TIPS_UI_S3_SECRET_ACCESS_KEY=minioadmin
3131
OP_NODE_NETWORK=
3232
OP_NODE_ROLLUP_CONFIG=/data/rollup.json
3333
OP_NODE_ROLLUP_LOAD_PROTOCOL_VERSIONS=true
34-
OP_NODE_SYNCMODE=consensus-layer
3534
OP_NODE_L1_ETH_RPC=http://host.docker.internal:8545
3635
OP_NODE_L1_BEACON=http://host.docker.internal:3500
37-
OP_NODE_L1_RPC_KIND=debug_geth
36+
OP_NODE_L1_RPC_KIND=basic
3837
OP_NODE_L1_TRUST_RPC=false
3938
OP_NODE_L2_ENGINE_KIND=reth
4039
OP_NODE_L2_ENGINE_AUTH=/data/jwtsecret
@@ -43,7 +42,7 @@ OP_NODE_P2P_LISTEN_TCP_PORT=9222
4342
OP_NODE_P2P_LISTEN_UDP_PORT=9222
4443
OP_NODE_P2P_INTERNAL_IP=true
4544
OP_NODE_P2P_ADVERTISE_IP=host.docker.internal
46-
OP_NODE_P2P_NO_DISCOVERY=true
45+
OP_NODE_P2P_NO_DISCOVERY=false
4746
OP_NODE_RPC_ADDR=0.0.0.0
4847
OP_NODE_RPC_PORT=8545
4948
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
@@ -25,14 +25,25 @@ sync: deps-reset
2525
### REFORMAT ###
2626
just fix
2727

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

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

0 commit comments

Comments
 (0)