From b708bb212279deb5475fdca6a0e01d74bbfd8e6e Mon Sep 17 00:00:00 2001 From: David Boreham Date: Wed, 8 Mar 2023 22:22:43 -0700 Subject: [PATCH 1/4] Configure foundry container --- app/data/compose/docker-compose-foundry.yml | 2 ++ .../scripts/status.sh | 2 +- app/data/stacks/fixturenet-eth/README.md | 29 ++++++++++--------- app/deploy_system.py | 7 +++-- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/app/data/compose/docker-compose-foundry.yml b/app/data/compose/docker-compose-foundry.yml index c55bda69..bbd778ec 100644 --- a/app/data/compose/docker-compose-foundry.yml +++ b/app/data/compose/docker-compose-foundry.yml @@ -3,3 +3,5 @@ services: foundry: image: ghcr.io/foundry-rs/foundry:latest command: ["while :; do sleep 600; done"] + volumes: + - ../config/foundry/foundry.toml:/foundry.toml \ No newline at end of file diff --git a/app/data/container-build/cerc-fixturenet-eth-lighthouse/scripts/status.sh b/app/data/container-build/cerc-fixturenet-eth-lighthouse/scripts/status.sh index faca9a49..c6e65a68 100755 --- a/app/data/container-build/cerc-fixturenet-eth-lighthouse/scripts/status.sh +++ b/app/data/container-build/cerc-fixturenet-eth-lighthouse/scripts/status.sh @@ -24,7 +24,7 @@ if [ -z "$GETH_BASE_URL" ]; then fi function inc_status() { - echo " DONE!" + echo " done" STATUS=$((STATUS + 1)) if [ $STATUS -lt ${#STATUSES[@]} ]; then echo -n "Waiting for ${STATUSES[$STATUS]}..." diff --git a/app/data/stacks/fixturenet-eth/README.md b/app/data/stacks/fixturenet-eth/README.md index a164f078..643e2141 100644 --- a/app/data/stacks/fixturenet-eth/README.md +++ b/app/data/stacks/fixturenet-eth/README.md @@ -26,21 +26,22 @@ $ laconic-so --stack fixturenet-eth deploy-system up ## Check status ``` -$ container-build/cerc-fixturenet-eth-lighthouse/scripts/status.sh -Waiting for geth to generate DAG ..................................................... DONE! -Waiting for beacon phase0 .... DONE! -Waiting for beacon altair .... DONE! -Waiting for beacon bellatrix pre-merge .... DONE! -Waiting for beacon bellatrix merge .... DONE! +$ laconic-so --stack fixturenet-eth deploy exec fixturenet-eth-bootnode-lighthouse /scripts/status-internal.sh +Waiting for geth to generate DAG.... done +Waiting for beacon phase0.... done +Waiting for beacon altair.... done +Waiting for beacon bellatrix pre-merge.... done +Waiting for beacon bellatrix merge.... done -$ docker ps -f 'name=laconic' --format 'table {{.Names}}\t{{.Ports}}' | cut -d'-' -f3- | sort -NAMES PORTS -fixturenet-eth-bootnode-geth-1 8545-8546/tcp, 30303/udp, 0.0.0.0:55847->9898/tcp, 0.0.0.0:55848->30303/tcp -fixturenet-eth-bootnode-lighthouse-1 -fixturenet-eth-geth-1-1 8546/tcp, 30303/tcp, 30303/udp, 0.0.0.0:55851->8545/tcp -fixturenet-eth-geth-2-1 8545-8546/tcp, 30303/tcp, 30303/udp -fixturenet-eth-lighthouse-1-1 0.0.0.0:55858->8001/tcp -fixturenet-eth-lighthouse-2-1 +$ laconic-so --stack fixturenet-eth deploy ps +Running containers: +id: c6538b60c0328dadfa2c5585c4d09674a6a13e6d712ff1cd82a26849e4e5679b, name: laconic-b12fa16e999821562937781f8ab0b1e8-fixturenet-eth-bootnode-geth-1, ports: 0.0.0.0:58909->30303/tcp, 0.0.0.0:58910->9898/tcp +id: 5b70597a8211bc7e78d33e50486cb565a7f4a9ce581ce150b3bb450e342bdeda, name: laconic-b12fa16e999821562937781f8ab0b1e8-fixturenet-eth-bootnode-lighthouse-1, ports: +id: 19ed78867b6c534d893835cdeb1e89a9ea553b8e8c02ab02468e4bd1563a340f, name: laconic-b12fa16e999821562937781f8ab0b1e8-fixturenet-eth-geth-1-1, ports: 0.0.0.0:58911->40000/tcp, 0.0.0.0:58912->6060/tcp, 0.0.0.0:58913->8545/tcp +id: 8da0e30a1ce33122d8fd2225e4d26c7f30eb4bfbfa743f2af04d9db5d0bf7fa6, name: laconic-b12fa16e999821562937781f8ab0b1e8-fixturenet-eth-geth-2-1, ports: +id: 387a42a14971034588ba9aeb9b9e2ca7fc0cc61b96f8fe8c2ab770c9d6fb1e0f, name: laconic-b12fa16e999821562937781f8ab0b1e8-fixturenet-eth-lighthouse-1-1, ports: 0.0.0.0:58917->8001/tcp +id: de5115bf89087bae03b291664a73ffe3554fe23e79e4b8345e088b040d5580ac, name: laconic-b12fa16e999821562937781f8ab0b1e8-fixturenet-eth-lighthouse-2-1, ports: +id: 2a7e5a0fb2be7fc9261a7b725a40818facbbe6d0cb2497d82c0e02de0a8e959b, name: laconic-b12fa16e999821562937781f8ab0b1e8-foundry-1, ports: ``` ## Additional pieces diff --git a/app/deploy_system.py b/app/deploy_system.py index 951e3758..dc674848 100644 --- a/app/deploy_system.py +++ b/app/deploy_system.py @@ -22,7 +22,7 @@ import sys from dataclasses import dataclass from decouple import config import subprocess -from python_on_whales import DockerClient +from python_on_whales import DockerClient, DockerException import click import importlib.resources from pathlib import Path @@ -83,7 +83,10 @@ def command(ctx, include, exclude, cluster, command, extra_args): container_exec_env = _make_runtime_env(ctx.obj) if verbose: print(f"Running compose exec {service_name} {command_to_exec}") - docker.compose.execute(service_name, command_to_exec, envs=container_exec_env) + try: + docker.compose.execute(service_name, command_to_exec, envs=container_exec_env) + except DockerException as error: + print(f"container command returned error exit status") elif command == "port": if extra_args_list is None or len(extra_args_list) < 2: print("Usage: port ") From c07f6c51e2de3b9e070d249668339c53c050a888 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Wed, 8 Mar 2023 22:49:00 -0700 Subject: [PATCH 2/4] Update doc --- app/data/compose/docker-compose-foundry.yml | 3 ++- app/data/stacks/fixturenet-eth/README.md | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/data/compose/docker-compose-foundry.yml b/app/data/compose/docker-compose-foundry.yml index bbd778ec..ed5a018a 100644 --- a/app/data/compose/docker-compose-foundry.yml +++ b/app/data/compose/docker-compose-foundry.yml @@ -4,4 +4,5 @@ services: image: ghcr.io/foundry-rs/foundry:latest command: ["while :; do sleep 600; done"] volumes: - - ../config/foundry/foundry.toml:/foundry.toml \ No newline at end of file + - ../config/foundry/foundry.toml:/foundry.toml + - ./foundry/workspace:/workspace diff --git a/app/data/stacks/fixturenet-eth/README.md b/app/data/stacks/fixturenet-eth/README.md index 643e2141..3aa41dec 100644 --- a/app/data/stacks/fixturenet-eth/README.md +++ b/app/data/stacks/fixturenet-eth/README.md @@ -20,7 +20,7 @@ This should create several container images in the local image registry: ## Deploy the stack ``` -$ laconic-so --stack fixturenet-eth deploy-system up +$ laconic-so --stack fixturenet-eth deploy up ``` ## Check status @@ -42,6 +42,9 @@ id: 8da0e30a1ce33122d8fd2225e4d26c7f30eb4bfbfa743f2af04d9db5d0bf7fa6, name: laco id: 387a42a14971034588ba9aeb9b9e2ca7fc0cc61b96f8fe8c2ab770c9d6fb1e0f, name: laconic-b12fa16e999821562937781f8ab0b1e8-fixturenet-eth-lighthouse-1-1, ports: 0.0.0.0:58917->8001/tcp id: de5115bf89087bae03b291664a73ffe3554fe23e79e4b8345e088b040d5580ac, name: laconic-b12fa16e999821562937781f8ab0b1e8-fixturenet-eth-lighthouse-2-1, ports: id: 2a7e5a0fb2be7fc9261a7b725a40818facbbe6d0cb2497d82c0e02de0a8e959b, name: laconic-b12fa16e999821562937781f8ab0b1e8-foundry-1, ports: + +$ laconic-so --stack fixturenet-eth deploy exec foundry "cast block-number" +3 ``` ## Additional pieces @@ -70,11 +73,11 @@ $ laconic-so deploy-system --include db,fixturenet-eth,ipld-eth-server,ipld-eth- # Status $ container-build/cerc-fixturenet-eth-lighthouse/scripts/status.sh -Waiting for geth to generate DAG.... DONE! -Waiting for beacon phase0.... DONE! -Waiting for beacon altair.... DONE! -Waiting for beacon bellatrix pre-merge.... DONE! -Waiting for beacon bellatrix merge.... DONE! +Waiting for geth to generate DAG.... done +Waiting for beacon phase0.... done +Waiting for beacon altair.... done +Waiting for beacon bellatrix pre-merge.... done +Waiting for beacon bellatrix merge.... done $ docker ps -f 'name=laconic' --format 'table {{.Names}}\t{{.Ports}}' | cut -d'-' -f3- | sort NAMES PORTS From a3440ad05bc41e4fcdcf739dfa75d032fb5c8f2f Mon Sep 17 00:00:00 2001 From: David Boreham Date: Thu, 9 Mar 2023 06:43:51 -0700 Subject: [PATCH 3/4] Add omitted file --- app/data/config/foundry/foundry.toml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 app/data/config/foundry/foundry.toml diff --git a/app/data/config/foundry/foundry.toml b/app/data/config/foundry/foundry.toml new file mode 100644 index 00000000..933f895c --- /dev/null +++ b/app/data/config/foundry/foundry.toml @@ -0,0 +1,2 @@ +[profile.default] +eth-rpc-url = "http://fixturenet-eth-geth-1:8545" From 21104f6b186153d16aca102ef879c4f791e44b25 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Thu, 9 Mar 2023 14:26:15 -0700 Subject: [PATCH 4/4] Drive by bug fix --- app/deploy_system.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/deploy_system.py b/app/deploy_system.py index 6a473684..94cf0263 100644 --- a/app/deploy_system.py +++ b/app/deploy_system.py @@ -304,7 +304,7 @@ def _orchestrate_cluster_config(ctx, cluster_config, docker, container_exec_env) print(f"fetched source value: {source_value}") destination_output = docker.compose.execute(pd.destination_container, ["sh", "-c", - f"sh /scripts/import-{pd.destination_variable}.sh {pd.source_variable}"], + f"sh /scripts/import-{pd.destination_variable}.sh {source_value}"], tty=False, envs=container_exec_env) if ctx.debug: