From 67b607a08c9261bb0a92336933baaf59a38a9ee6 Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Fri, 13 Dec 2024 14:08:25 +0400 Subject: [PATCH] Simpler EC setup in docker-compose.yml --- local-network/configs/besu/besu.conf | 3 +-- local-network/configs/besu/besu.yml | 2 +- local-network/configs/besu/run-besu.sh | 4 +++- local-network/configs/geth/geth.yml | 2 +- local-network/configs/geth/run-geth.sh | 6 +++--- local-network/docker-compose.yml | 7 ++++--- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/local-network/configs/besu/besu.conf b/local-network/configs/besu/besu.conf index 65846933..a86d6232 100644 --- a/local-network/configs/besu/besu.conf +++ b/local-network/configs/besu/besu.conf @@ -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 = ["*"] diff --git a/local-network/configs/besu/besu.yml b/local-network/configs/besu/besu.yml index e683f057..5d822ccc 100644 --- a/local-network/configs/besu/besu.yml +++ b/local-network/configs/besu/besu.yml @@ -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: diff --git a/local-network/configs/besu/run-besu.sh b/local-network/configs/besu/run-besu.sh index 36c69169..03076d5f 100755 --- a/local-network/configs/besu/run-besu.sh +++ b/local-network/configs/besu/run-besu.sh @@ -6,7 +6,9 @@ tee /opt/besu/logs/besu.log <&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}') @@ -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}" \ diff --git a/local-network/docker-compose.yml b/local-network/docker-compose.yml index ca880fbe..b6d34c49 100644 --- a/local-network/docker-compose.yml +++ b/local-network/docker-compose.yml @@ -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: @@ -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: