Skip to content

Commit

Permalink
Simpler EC setup in docker-compose.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
vsuharnikov committed Dec 13, 2024
1 parent 9deadcc commit 67b607a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
3 changes: 1 addition & 2 deletions local-network/configs/besu/besu.conf
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# /opt/besu belongs to besu user: https://github.com/hyperledger/besu/blob/main/docker/openjdk-17/Dockerfile
# so it is the only writable path
data-path = "/opt/besu/data"
genesis-file = "/genesis.json"
node-private-key-file = "/etc/secrets/p2p-key"
genesis-file = "/etc/secrets/genesis.json"

sync-mode = "FULL"
host-allowlist = ["*"]
Expand Down
2 changes: 1 addition & 1 deletion local-network/configs/besu/besu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ services:
besu:
image: hyperledger/besu:latest
volumes:
- ../ec-common/genesis.json:/genesis.json:ro
- ../ec-common/:/etc/secrets/:ro
- .:/config:ro
- ./run-besu.sh:/tmp/run.sh:ro
env_file:
Expand Down
4 changes: 3 additions & 1 deletion local-network/configs/besu/run-besu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ tee /opt/besu/logs/besu.log <<EOF
IP: $IP
EOF

# https://besu.hyperledger.org/public-networks/reference/cli/options
# --p2p-host="ec-1" # Doesn't work: https://github.com/hyperledger/besu/issues/4380
besu \
--config-file=/config/besu.conf \
--p2p-host=${IP}
--p2p-host=${IP} \
--node-private-key-file="/etc/secrets/p2p-key-${NODE_NUMBER}.hex"
2 changes: 1 addition & 1 deletion local-network/configs/geth/geth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
stop_grace_period: 10s
entrypoint: /tmp/run.sh
volumes:
- ../ec-common/genesis.json:/tmp/genesis.json:ro
- ../ec-common/:/etc/secrets/:ro
- ./run-geth.sh:/tmp/run.sh:ro
env_file:
- ../ec-common/peers.env
Expand Down
6 changes: 3 additions & 3 deletions local-network/configs/geth/run-geth.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env sh

if [ ! -d /root/.ethereum/geth ] ; then
geth init /tmp/genesis.json 2>&1 | tee /root/logs/init.log
geth init /etc/secrets/genesis.json 2>&1 | tee /root/logs/init.log
fi

IP_RAW=$(ip -4 addr show dev eth0 | awk '/inet / {print $2}')
Expand Down Expand Up @@ -29,8 +29,8 @@ geth \
--ws.origins=* \
--authrpc.addr=0.0.0.0 \
--authrpc.vhosts=* \
--authrpc.jwtsecret=/etc/secrets/jwtsecret \
--nodekey=/etc/secrets/p2p-key \
--authrpc.jwtsecret="/etc/secrets/jwt-secret-${NODE_NUMBER}.hex" \
--nodekey="/etc/secrets/p2p-key-${NODE_NUMBER}.hex" \
--nat="extip:${IP}" \
--netrestrict="${NETWORK}/${PREFIX}" \
--bootnodes="${BESU_BOOTNODES}" \
Expand Down
7 changes: 4 additions & 3 deletions local-network/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ services:
extends:
file: ./configs/besu/besu.yml
service: besu
environment:
NODE_NUMBER: 1
ports:
- "127.0.0.1:18551:8551" # Engine port - doesn't have all APIs
- "127.0.0.1:18545:8545" # RPC port, for Metamask e.g.
- "127.0.0.1:18546:8546" # WebSocket
volumes:
- ./configs/ec-common/p2p-key-1.hex:/etc/secrets/p2p-key:ro
- ./logs/ec-1:/opt/besu/logs

ec-2:
Expand All @@ -25,9 +26,9 @@ services:
ports:
- "127.0.0.1:28551:8551" # Engine port
- "127.0.0.1:28545:8545" # RPC port
environment:
NODE_NUMBER: 2
volumes:
- ./configs/ec-common/p2p-key-2.hex:/etc/secrets/p2p-key:ro
- ./configs/ec-common/jwt-secret-2.hex:/etc/secrets/jwtsecret:ro
- ./logs/ec-2:/root/logs

wavesnode-1:
Expand Down

0 comments on commit 67b607a

Please sign in to comment.