Add restart policies to fixturenet-eth and fixturenet-opimism stacks #396

Merged
prathamesh0 merged 3 commits from pm-restart-policy into main 2023-05-19 08:16:40 +00:00
4 changed files with 31 additions and 14 deletions

View File

@ -2,6 +2,7 @@ version: '3.7'
services: services:
fixturenet-eth-bootnode-geth: fixturenet-eth-bootnode-geth:
restart: always
hostname: fixturenet-eth-bootnode-geth hostname: fixturenet-eth-bootnode-geth
env_file: env_file:
- ../config/fixturenet-eth/fixturenet-eth.env - ../config/fixturenet-eth/fixturenet-eth.env
@ -15,6 +16,7 @@ services:
- "30303" - "30303"
fixturenet-eth-geth-1: fixturenet-eth-geth-1:
restart: always
hostname: fixturenet-eth-geth-1 hostname: fixturenet-eth-geth-1
cap_add: cap_add:
- SYS_PTRACE - SYS_PTRACE
@ -42,6 +44,7 @@ services:
- "6060" - "6060"
fixturenet-eth-geth-2: fixturenet-eth-geth-2:
restart: always
hostname: fixturenet-eth-geth-2 hostname: fixturenet-eth-geth-2
healthcheck: healthcheck:
test: ["CMD", "nc", "-v", "localhost", "8545"] test: ["CMD", "nc", "-v", "localhost", "8545"]
@ -60,12 +63,14 @@ services:
- fixturenet_eth_geth_2_data:/root/ethdata - fixturenet_eth_geth_2_data:/root/ethdata
fixturenet-eth-bootnode-lighthouse: fixturenet-eth-bootnode-lighthouse:
restart: always
hostname: fixturenet-eth-bootnode-lighthouse hostname: fixturenet-eth-bootnode-lighthouse
environment: environment:
RUN_BOOTNODE: "true" RUN_BOOTNODE: "true"
image: cerc/fixturenet-eth-lighthouse:local image: cerc/fixturenet-eth-lighthouse:local
fixturenet-eth-lighthouse-1: fixturenet-eth-lighthouse-1:
restart: always
hostname: fixturenet-eth-lighthouse-1 hostname: fixturenet-eth-lighthouse-1
healthcheck: healthcheck:
test: ["CMD", "wget", "--tries=1", "--connect-timeout=1", "--quiet", "-O", "-", "http://localhost:8001/eth/v2/beacon/blocks/head"] test: ["CMD", "wget", "--tries=1", "--connect-timeout=1", "--quiet", "-O", "-", "http://localhost:8001/eth/v2/beacon/blocks/head"]
@ -91,6 +96,7 @@ services:
- "8001" - "8001"
fixturenet-eth-lighthouse-2: fixturenet-eth-lighthouse-2:
restart: always
hostname: fixturenet-eth-lighthouse-2 hostname: fixturenet-eth-lighthouse-2
healthcheck: healthcheck:
test: ["CMD", "wget", "--tries=1", "--connect-timeout=1", "--quiet", "-O", "-", "http://localhost:8001/eth/v2/beacon/blocks/head"] test: ["CMD", "wget", "--tries=1", "--connect-timeout=1", "--quiet", "-O", "-", "http://localhost:8001/eth/v2/beacon/blocks/head"]

View File

@ -5,6 +5,7 @@ services:
# Creates / updates the configuration for L1 contracts deployment # Creates / updates the configuration for L1 contracts deployment
# Deploys the L1 smart contracts (outputs to volume l1_deployment) # Deploys the L1 smart contracts (outputs to volume l1_deployment)
fixturenet-optimism-contracts: fixturenet-optimism-contracts:
restart: on-failure
hostname: fixturenet-optimism-contracts hostname: fixturenet-optimism-contracts
image: cerc/optimism-contracts:local image: cerc/optimism-contracts:local
env_file: env_file:
@ -35,6 +36,7 @@ services:
# Generates the config files required for L2 (outputs to volume l2_config) # Generates the config files required for L2 (outputs to volume l2_config)
op-node-l2-config-gen: op-node-l2-config-gen:
restart: on-failure
image: cerc/optimism-op-node:local image: cerc/optimism-op-node:local
depends_on: depends_on:
fixturenet-optimism-contracts: fixturenet-optimism-contracts:
@ -54,6 +56,7 @@ services:
# Initializes and runs the L2 execution client (outputs to volume l2_geth_data) # Initializes and runs the L2 execution client (outputs to volume l2_geth_data)
op-geth: op-geth:
restart: always
image: cerc/optimism-l2geth:local image: cerc/optimism-l2geth:local
depends_on: depends_on:
op-node-l2-config-gen: op-node-l2-config-gen:
@ -76,6 +79,7 @@ services:
# Runs the L2 consensus client (Sequencer node) # Runs the L2 consensus client (Sequencer node)
op-node: op-node:
restart: always
image: cerc/optimism-op-node:local image: cerc/optimism-op-node:local
depends_on: depends_on:
op-geth: op-geth:
@ -103,6 +107,7 @@ services:
# Runs the batcher (takes transactions from the Sequencer and publishes them to L1) # Runs the batcher (takes transactions from the Sequencer and publishes them to L1)
op-batcher: op-batcher:
restart: always
image: cerc/optimism-op-batcher:local image: cerc/optimism-op-batcher:local
depends_on: depends_on:
op-node: op-node:
@ -129,6 +134,7 @@ services:
# Runs the proposer (periodically submits new state roots to L1) # Runs the proposer (periodically submits new state roots to L1)
op-proposer: op-proposer:
restart: always
image: cerc/optimism-op-proposer:local image: cerc/optimism-op-proposer:local
depends_on: depends_on:
op-node: op-node:

View File

@ -1,6 +1,7 @@
# Add-on pod to include foundry tooling within a fixturenet # Add-on pod to include foundry tooling within a fixturenet
services: services:
foundry: foundry:
restart: always
image: cerc/foundry:local image: cerc/foundry:local
command: ["while :; do sleep 600; done"] command: ["while :; do sleep 600; done"]
volumes: volumes:

View File

@ -13,22 +13,26 @@ DEBUG_LEVEL=${1:-info}
echo "Starting bootnode" echo "Starting bootnode"
if [ ! -f "$DATADIR/bootnode/enr.dat" ]; then # Clean up existing ENR dir to avoid node connectivity issues on a restart
echo "Generating bootnode enr" if [ -d "$DATADIR/bootnode" ]; then
lcli \ echo "Removing existing bootnode enr directory"
generate-bootnode-enr \ rm -r "$DATADIR/bootnode"
--ip $ENR_IP \
--udp-port $BOOTNODE_PORT \
--tcp-port $BOOTNODE_PORT \
--genesis-fork-version $GENESIS_FORK_VERSION \
--output-dir $DATADIR/bootnode
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"
fi fi
echo "Generating bootnode enr"
lcli \
generate-bootnode-enr \
--ip $ENR_IP \
--udp-port $BOOTNODE_PORT \
--tcp-port $BOOTNODE_PORT \
--genesis-fork-version $GENESIS_FORK_VERSION \
--output-dir $DATADIR/bootnode
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"
exec lighthouse boot_node \ exec lighthouse boot_node \
--testnet-dir $TESTNET_DIR \ --testnet-dir $TESTNET_DIR \
--port $BOOTNODE_PORT \ --port $BOOTNODE_PORT \