From 2bd5c729dceb6535801f5feca643ccdbbfef1dd8 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Fri, 14 Oct 2022 13:48:54 -0500 Subject: [PATCH] Use config/ --- compose/docker-compose-fixturenet-eth.yml | 25 ++++++++----------- config/fixturenet-eth/fixturenet-eth.env | 11 ++++++++ .../cerc-fixturenet-eth-geth/run-el.sh | 7 ++++-- 3 files changed, 26 insertions(+), 17 deletions(-) create mode 100644 config/fixturenet-eth/fixturenet-eth.env diff --git a/compose/docker-compose-fixturenet-eth.yml b/compose/docker-compose-fixturenet-eth.yml index d1c957ea..94c573de 100644 --- a/compose/docker-compose-fixturenet-eth.yml +++ b/compose/docker-compose-fixturenet-eth.yml @@ -3,9 +3,10 @@ version: '3.7' services: fixturenet-eth-bootnode-geth: hostname: fixturenet-eth-bootnode-geth + env_file: + - ../config/fixturenet-eth/fixturenet-eth.env environment: RUN_BOOTNODE: "true" - NETWORK_ID: "1212" image: cerc/fixturenet-eth-geth:local networks: fixturenet-eth-net: @@ -13,12 +14,8 @@ services: fixturenet-eth-geth-1: hostname: fixturenet-eth-geth-1 - environment: - NETWORK_ID: "1212" - ACCOUNT_PASSWORD: "secret1212" - ETHERBASE: "0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F" - ENODE: "enode://af22c29c316ad069cf48a09a4ad5cf04a251b411e45098888d114c6dd7f489a13786620d5953738762afa13711d4ffb3b19aa5de772d8af72f851f7e9c5b164a@fixturenet-eth-bootnode-geth:30303" - JWT: "0x6cdcac3501046a08e186730dd8bd136cfaf0fdc1fc955f6e15ad3068c0ff2af0" + env_file: + - ../config/fixturenet-eth/fixturenet-eth.env image: cerc/fixturenet-eth-geth:local depends_on: - fixturenet-eth-bootnode-geth @@ -29,12 +26,8 @@ services: fixturenet-eth-geth-2: hostname: fixturenet-eth-geth-2 - environment: - NETWORK_ID: "1212" - ACCOUNT_PASSWORD: "secret1212" - ETHERBASE: "0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F" - ENODE: "enode://af22c29c316ad069cf48a09a4ad5cf04a251b411e45098888d114c6dd7f489a13786620d5953738762afa13711d4ffb3b19aa5de772d8af72f851f7e9c5b164a@fixturenet-eth-bootnode-geth:30303" - JWT: "0x6cdcac3501046a08e186730dd8bd136cfaf0fdc1fc955f6e15ad3068c0ff2af0" + env_file: + - ../config/fixturenet-eth/fixturenet-eth.env image: cerc/fixturenet-eth-geth:local depends_on: - fixturenet-eth-bootnode-geth @@ -52,9 +45,10 @@ services: fixturenet-eth-lighthouse-1: hostname: fixturenet-eth-lighthouse-1 + env_file: + - ../config/fixturenet-eth/fixturenet-eth.env environment: NODE_NUMBER: "1" - JWT: "0x6cdcac3501046a08e186730dd8bd136cfaf0fdc1fc955f6e15ad3068c0ff2af0" ETH1_ENDPOINT: "http://fixturenet-eth-geth-1:8545" EXECUTION_ENDPOINT: "http://fixturenet-eth-geth-1:8551" image: cerc/fixturenet-eth-lighthouse:local @@ -68,9 +62,10 @@ services: fixturenet-eth-lighthouse-2: hostname: fixturenet-eth-lighthouse-2 + env_file: + - ../config/fixturenet-eth/fixturenet-eth.env environment: NODE_NUMBER: "2" - JWT: "0x6cdcac3501046a08e186730dd8bd136cfaf0fdc1fc955f6e15ad3068c0ff2af0" ETH1_ENDPOINT: "http://fixturenet-eth-geth-2:8545" EXECUTION_ENDPOINT: "http://fixturenet-eth-geth-2:8551" LIGHTHOUSE_GENESIS_STATE_URL: "http://fixturenet-eth-lighthouse-1:8001/eth/v2/debug/beacon/states/0" diff --git a/config/fixturenet-eth/fixturenet-eth.env b/config/fixturenet-eth/fixturenet-eth.env new file mode 100644 index 00000000..c4088e69 --- /dev/null +++ b/config/fixturenet-eth/fixturenet-eth.env @@ -0,0 +1,11 @@ +# The password used to access test accounts (eg, via personal_unlockAccount). The password is the same for all accounts. +ACCOUNT_PASSWORD=secret1212 + +# ENODE of the geth bootnode. +ENODE="enode://af22c29c316ad069cf48a09a4ad5cf04a251b411e45098888d114c6dd7f489a13786620d5953738762afa13711d4ffb3b19aa5de772d8af72f851f7e9c5b164a@fixturenet-eth-bootnode-geth:30303" + +# JWT shared by geth and lighthouse for authentication. +JWT="0x6cdcac3501046a08e186730dd8bd136cfaf0fdc1fc955f6e15ad3068c0ff2af0" + +# Should match the definition of fixturenet-eth-net. +NETRESTRICT="172.16.254.0/28" diff --git a/container-build/cerc-fixturenet-eth-geth/run-el.sh b/container-build/cerc-fixturenet-eth-geth/run-el.sh index 857ca2e0..657dd719 100755 --- a/container-build/cerc-fixturenet-eth-geth/run-el.sh +++ b/container-build/cerc-fixturenet-eth-geth/run-el.sh @@ -1,12 +1,15 @@ #!/bin/bash +ETHERBASE=`cat /opt/testnet/accounts/accounts.csv | head -1 | cut -d',' -f2` +NETWORK_ID=`cat /opt/testnet/el/el-config.yaml | grep 'chain_id' | awk '{ print $2 }'` + if [ "true" == "$RUN_BOOTNODE" ]; then geth \ --nodekeyhex="b0ac22adcad37213c7c565810a50f1772291e7b0ce53fb73e7ec2a3c75bc13b5" \ --nodiscover \ --ipcdisable \ --networkid=${NETWORK_ID} \ - --netrestrict="172.16.254.0/28" 2>&1 | tee /var/log/geth_bootnode.log + --netrestrict="${NETRESTRICT}" 2>&1 | tee /var/log/geth_bootnode.log else cd /opt/testnet/accounts ./import_keys.sh @@ -25,7 +28,7 @@ else --authrpc.vhosts="*" \ --authrpc.jwtsecret="/opt/testnet/build/el/jwtsecret" \ --networkid=${NETWORK_ID} \ - --netrestrict="172.16.254.0/28" \ + --netrestrict="${NETRESTRICT}" \ --syncmode=full \ --mine \ --miner.threads=1 \