Fixes to fixturenet-eth

Former-commit-id: e4229e4ceb
This commit is contained in:
David Boreham 2023-01-26 16:47:06 -07:00
parent 96a83422e7
commit f02bbee3bf
8 changed files with 40 additions and 8 deletions

View File

@ -20,6 +20,7 @@ services:
CERC_REMOTE_DEBUG: "true"
CERC_RUN_STATEDIFF: "detect"
CERC_STATEDIFF_DB_NODE_ID: 1
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
env_file:
- ../config/fixturenet-eth/fixturenet-eth.env
image: cerc/fixturenet-eth-geth:local

View File

@ -1,5 +1,9 @@
#!/bin/bash
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
ETHERBASE=`cat /opt/testnet/build/el/accounts.csv | head -1 | cut -d',' -f2`
NETWORK_ID=`cat /opt/testnet/el/el-config.yaml | grep 'chain_id' | awk '{ print $2 }'`
NETRESTRICT=`ip addr | grep inet | grep -v '127.0' | awk '{print $2}'`
@ -28,7 +32,9 @@ else
echo -n "$JWT" > /opt/testnet/build/el/jwtsecret
if [ "$CERC_RUN_STATEDIFF" == "detect" ] && [ -n "$CERC_STATEDIFF_DB_HOST" ]; then
if [ -n "$(dig $CERC_STATEDIFF_DB_HOST +short)" ]; then
dig_result=$(dig $CERC_STATEDIFF_DB_HOST +short)
dig_status_code=$?
if [[ $dig_status_code = 0 && -n $dig_result ]]; then
echo "Statediff DB at $CERC_STATEDIFF_DB_HOST"
CERC_RUN_STATEDIFF="true"
else

View File

@ -27,4 +27,8 @@ RUN cd /opt/testnet && make genesis-cl
# Work around some bugs in lcli where the default path is always used.
RUN mkdir -p /root/.lighthouse && cd /root/.lighthouse && ln -s /opt/testnet/build/cl/testnet
RUN mkdir -p /scripts
COPY scripts/status-internal.sh /scripts
COPY scripts/status.sh /scripts
ENTRYPOINT ["/opt/testnet/run.sh"]

View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
# Wrapper to facilitate using status.sh inside the container
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
export LIGHTHOUSE_BASE_URL="http://fixturenet-eth-lighthouse-1:8001"
export GETH_BASE_URL="http://fixturenet-eth-geth-1-1:8545"
# See: https://stackoverflow.com/a/246128/1701505
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
$SCRIPT_DIR/status.sh

View File

@ -1,5 +1,7 @@
#!/bin/bash
#!/usr/bin/env bash
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
STATUSES=("geth to generate DAG" "beacon phase0" "beacon altair" "beacon bellatrix pre-merge" "beacon bellatrix merge")
STATUS=0
@ -7,6 +9,8 @@ STATUS=0
LIGHTHOUSE_BASE_URL=${LIGHTHOUSE_BASE_URL}
GETH_BASE_URL=${GETH_BASE_URL}
# TODO: Docker commands below should be replaced by some interface into stack orchestrator
# or some execution environment-neutral mechanism.
if [ -z "$LIGHTHOUSE_BASE_URL" ]; then
LIGHTHOUSE_CONTAINER=`docker ps -q -f "name=fixturenet-eth-lighthouse-1-1"`
LIGHTHOUSE_PORT=`docker port $LIGHTHOUSE_CONTAINER 8001 | cut -d':' -f2`

View File

@ -4,12 +4,12 @@ Instructions for deploying a local a geth + lighthouse blockchain "fixturenet" f
## Clone required repositories
```
$ laconic-so setup-repositories --include cerc-io/go-ethereum
$ laconic-so --stack fixturenet-eth setup-repositories
```
## Build the fixturenet-eth containers
```
$ laconic-so build-containers --include cerc/go-ethereum,cerc/lighthouse,cerc/fixturenet-eth-geth,cerc/fixturenet-eth-lighthouse
$ laconic-so --stack fixturenet-eth build-containers
```
This should create several container images in the local image registry:
@ -20,7 +20,7 @@ This should create several container images in the local image registry:
## Deploy the stack
```
$ laconic-so deploy-system --include fixturenet-eth up
$ laconic-so --stack fixturenet-eth deploy-system up
```
## Check status

View File

@ -3,10 +3,11 @@ name: fixturenet-eth
decription: "Ethereum Fixturenet"
repos:
- cerc-io/go-ethereum
- cerc-io/tx-spammer
containers:
- cerc/go-ethereum
- cerc/lighthouse
- cerc/fixturenet-eth-geth
- cerc/fixturenet-eth-lighthouse
pods:
- fixturenet-eth
- fixturenet-eth

View File

@ -37,6 +37,7 @@ def command(ctx, include, exclude, cluster, command, extra_args):
# TODO: implement option exclusion and command value constraint lost with the move from argparse to click
debug = ctx.obj.debug
quiet = ctx.obj.quiet
verbose = ctx.obj.verbose
dry_run = ctx.obj.dry_run
@ -91,6 +92,8 @@ def command(ctx, include, exclude, cluster, command, extra_args):
if not dry_run:
if command == "up":
if debug:
os.environ["CERC_SCRIPT_DEBUG"] = "true"
if verbose:
print(f"Running compose up for extra_args: {extra_args_list}")
docker.compose.up(detach=True, services=extra_args_list)
@ -104,9 +107,12 @@ def command(ctx, include, exclude, cluster, command, extra_args):
sys.exit(1)
service_name = extra_args_list[0]
command_to_exec = extra_args_list[1:]
container_exec_env = {
"CERC_SCRIPT_DEBUG": "true"
} if debug else None
if verbose:
print(f"Running compose exec {service_name} {command_to_exec}")
docker.compose.execute(service_name, command_to_exec)
docker.compose.execute(service_name, command_to_exec, envs=container_exec_env)
elif command == "port":
if extra_args_list is None or len(extra_args_list) < 2:
print("Usage: port <service> <exposed-port>")