Use mounted volumes for data in lighthouse nodes

This commit is contained in:
Prathamesh Musale 2023-04-14 13:06:54 +05:30
parent 76bf5a3c5d
commit 71cce4233c
3 changed files with 23 additions and 6 deletions

View File

@ -63,6 +63,8 @@ services:
environment:
RUN_BOOTNODE: "true"
image: cerc/fixturenet-eth-lighthouse:local
volumes:
- fixturenet_eth_bootnode_data:/opt/testnet/build/cl/bootnode
fixturenet-eth-lighthouse-1:
hostname: fixturenet-eth-lighthouse-1
@ -79,6 +81,8 @@ services:
ETH1_ENDPOINT: "http://fixturenet-eth-geth-1:8545"
EXECUTION_ENDPOINT: "http://fixturenet-eth-geth-1:8551"
image: cerc/fixturenet-eth-lighthouse:local
volumes:
- fixturenet_eth_lighthouse_1_data:/opt/testnet/build/cl/node_1
depends_on:
fixturenet-eth-bootnode-lighthouse:
condition: service_started
@ -103,6 +107,8 @@ services:
EXECUTION_ENDPOINT: "http://fixturenet-eth-geth-2:8551"
LIGHTHOUSE_GENESIS_STATE_URL: "http://fixturenet-eth-lighthouse-1:8001/eth/v2/debug/beacon/states/0"
image: cerc/fixturenet-eth-lighthouse:local
volumes:
- fixturenet_eth_lighthouse_2_data:/opt/testnet/build/cl/node_2
depends_on:
fixturenet-eth-bootnode-lighthouse:
condition: service_started
@ -114,3 +120,6 @@ volumes:
bootnode_geth_data:
fixturenet_eth_geth_1_data:
fixturenet_eth_geth_2_data:
fixturenet_eth_bootnode_data:
fixturenet_eth_lighthouse_1_data:
fixturenet_eth_lighthouse_2_data:

View File

@ -21,14 +21,21 @@ if [ ! -f "$DATADIR/bootnode/enr.dat" ]; then
--udp-port $BOOTNODE_PORT \
--tcp-port $BOOTNODE_PORT \
--genesis-fork-version $GENESIS_FORK_VERSION \
--output-dir $DATADIR/bootnode
--output-dir $DATADIR/bootnode-temp
bootnode_enr=`cat $DATADIR/bootnode/enr.dat`
echo "- $bootnode_enr" > $TESTNET_DIR/boot_enr.yaml
echo "Generated bootnode enr and written to $TESTNET_DIR/boot_enr.yaml"
# Output ENR to a temp dir and mv as "lcli generate-bootnode-enr" will not overwrite an empty dir (mounted volume)
mv $DATADIR/bootnode-temp/* $DATADIR/bootnode
rm -r $DATADIR/bootnode-temp
echo "Generated bootnode enr"
else
echo "Found existing bootnode enr"
fi
bootnode_enr=`cat $DATADIR/bootnode/enr.dat`
echo "- $bootnode_enr" > $TESTNET_DIR/boot_enr.yaml
echo "Written bootnode enr to $TESTNET_DIR/boot_enr.yaml"
exec lighthouse boot_node \
--testnet-dir $TESTNET_DIR \
--port $BOOTNODE_PORT \

View File

@ -1,6 +1,6 @@
#!/bin/bash
if [ "true" == "$RUN_BOOTNODE" ]; then
if [ "true" == "$RUN_BOOTNODE" ]; then
cd /opt/testnet/build/cl
python3 -m http.server 3000 &
@ -25,6 +25,7 @@ else
cd /opt/testnet/cl
if [ -z "$LIGHTHOUSE_GENESIS_STATE_URL" ]; then
# TODO Avoid on a restart
./reset_genesis_time.sh
else
while [ 1 -eq 1 ]; do