From 97da39c68be43d7faaac9594876586bb9f5a627e Mon Sep 17 00:00:00 2001 From: David Boreham Date: Sun, 26 Mar 2023 21:35:01 -0600 Subject: [PATCH 01/10] Update version Former-commit-id: 3706dfd7db3f6b7f3c51d9e4ed8dfd05677ca67e --- app/data/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/data/version.txt b/app/data/version.txt index 14872d4..bce0363 100644 --- a/app/data/version.txt +++ b/app/data/version.txt @@ -1,2 +1,2 @@ # This file should be re-generated running: scripts/update-version-file.sh script -v1.0.30-3d03b10 +v1.0.31-e70dca7 From bed5e262cc02eb59a0371d687350bc555a99b88c Mon Sep 17 00:00:00 2001 From: Nabarun Gogoi Date: Mon, 27 Mar 2023 11:17:12 +0530 Subject: [PATCH 02/10] Add missing notes and steps in mobymask-v2 stack readme (#241) * Add missing notes and steps in readme * Mention clearing of browser cache before opening invite link Former-commit-id: 1aeb44d5ad0f112685ef3b239a3ec3e5dffca257 --- app/data/stacks/mobymask-v2/README.md | 3 +++ app/data/stacks/mobymask-v2/demo.md | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/data/stacks/mobymask-v2/README.md b/app/data/stacks/mobymask-v2/README.md index 83bfd25..5cea857 100644 --- a/app/data/stacks/mobymask-v2/README.md +++ b/app/data/stacks/mobymask-v2/README.md @@ -10,6 +10,9 @@ Clone required repositories: laconic-so --stack mobymask-v2 setup-repositories ``` +NOTE: If repositories already exist and are checked out to different versions, `setup-repositories` command will throw an error. +For getting around this, the repositories mentioned below can be removed and then run the command. + Checkout to the required versions and branches in repos ```bash diff --git a/app/data/stacks/mobymask-v2/demo.md b/app/data/stacks/mobymask-v2/demo.md index af5ec2d..63ad0a2 100644 --- a/app/data/stacks/mobymask-v2/demo.md +++ b/app/data/stacks/mobymask-v2/demo.md @@ -6,14 +6,16 @@ laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 logs mobymask ``` - NOTE: Clear the browser cache (local storage) for http://127.0.0.1:3002 to remove old invitations - The invite link is seen at the end of the logs Example: ``` laconic-bfb01caf98b1b8f7c8db4d33f11b905a-mobymask-1 | http://127.0.0.1:3002/#/members?invitation=%7B%22v%22%3A1%2C%22signedDelegations%22%3A%5B%7B%22signature%22%3A%220x7559bd412f02677d60820e38243acf61547f79339395a34f7d4e1630e645aeb30535fc219f79b6fbd3af0ce3bd05132ad46d2b274a9fbc4c36bc71edd09850891b%22%2C%22delegation%22%3A%7B%22delegate%22%3A%220xc0838c92B2b71756E0eAD5B3C1e1F186baeEAAac%22%2C%22authority%22%3A%220x0000000000000000000000000000000000000000000000000000000000000000%22%2C%22caveats%22%3A%5B%7B%22enforcer%22%3A%220x558024C7d593B840E1BfD83E9B287a5CDad4db15%22%2C%22terms%22%3A%220x0000000000000000000000000000000000000000000000000000000000000000%22%7D%5D%7D%7D%5D%2C%22key%22%3A%220x98da9805821f1802196443e578fd32af567bababa0a249c07c82df01ecaa7d8d%22%7D ``` +* Open the invite link in browser to use the mobymask-app. + + NOTE: Before opening the invite link, clear the browser cache (local storage) for http://127.0.0.1:3002 to remove old invitations + * In the debug panel, check if it is connected to the p2p network (It should be connected to atleast one other peer for pubsub to work). * Create an invite link in the app by clicking on `Create new invite link` button. From 616f85ce6ba7028dec39724bb5a873f8ec02444e Mon Sep 17 00:00:00 2001 From: David Boreham Date: Mon, 27 Mar 2023 08:00:19 -0600 Subject: [PATCH 03/10] Update version Former-commit-id: 7e1137f81147103ddd45153ae059b60215eb537e --- app/data/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/data/version.txt b/app/data/version.txt index bce0363..6532c00 100644 --- a/app/data/version.txt +++ b/app/data/version.txt @@ -1,2 +1,2 @@ # This file should be re-generated running: scripts/update-version-file.sh script -v1.0.31-e70dca7 +v1.0.32-1aeb44d From 126d671bb09eb35437b84148244c01605e1853ed Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 28 Mar 2023 07:17:06 -0600 Subject: [PATCH 04/10] Update version Former-commit-id: 3caf0da9566eb47cc79af30837af13908e122895 --- app/data/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/data/version.txt b/app/data/version.txt index 6532c00..16d2611 100644 --- a/app/data/version.txt +++ b/app/data/version.txt @@ -1,2 +1,2 @@ # This file should be re-generated running: scripts/update-version-file.sh script -v1.0.32-1aeb44d +v1.0.33-7e1137f From ce04ca2be5cf30c8217549c0c061b6cdcfbbb4ed Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 28 Mar 2023 09:52:34 -0600 Subject: [PATCH 05/10] Update go-ethereum-foundry container for Debian base image Former-commit-id: 82acc99e2db8f08c282fd714eb98adbae026cb59 --- .../container-build/cerc-go-ethereum-foundry/Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/data/container-build/cerc-go-ethereum-foundry/Dockerfile b/app/data/container-build/cerc-go-ethereum-foundry/Dockerfile index b9a5a30..3f73abc 100644 --- a/app/data/container-build/cerc-go-ethereum-foundry/Dockerfile +++ b/app/data/container-build/cerc-go-ethereum-foundry/Dockerfile @@ -1,7 +1,9 @@ +# Note: cerc/foundry is Debian based FROM cerc/foundry:local -RUN apk update ; apk add --no-cache --allow-untrusted ca-certificates curl bash git jq -RUN apk add --no-cache --upgrade grep +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends jq curl netcat + WORKDIR /root ARG GENESIS_FILE_PATH=genesis.json From b3ae2159eeb7ab37ce38d6af0baeec6f49bfae70 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 28 Mar 2023 10:46:26 -0600 Subject: [PATCH 06/10] Fix health checks in erc20 containers Former-commit-id: 35ca979068b764ed53f4705f62f67ee5f5b6bcbd --- app/data/compose/docker-compose-go-ethereum-foundry.yml | 2 +- app/data/compose/docker-compose-watcher-erc20.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/data/compose/docker-compose-go-ethereum-foundry.yml b/app/data/compose/docker-compose-go-ethereum-foundry.yml index 20d008f..3da40d7 100644 --- a/app/data/compose/docker-compose-go-ethereum-foundry.yml +++ b/app/data/compose/docker-compose-go-ethereum-foundry.yml @@ -8,7 +8,7 @@ services: condition: service_healthy image: cerc/go-ethereum-foundry:local healthcheck: - test: ["CMD", "nc", "-v", "localhost", "8545"] + test: ["CMD", "nc", "-vz", "localhost", "8545"] interval: 30s timeout: 3s retries: 10 diff --git a/app/data/compose/docker-compose-watcher-erc20.yml b/app/data/compose/docker-compose-watcher-erc20.yml index 82e7612..a094250 100644 --- a/app/data/compose/docker-compose-watcher-erc20.yml +++ b/app/data/compose/docker-compose-watcher-erc20.yml @@ -39,7 +39,7 @@ services: - "0.0.0.0:3002:3001" - "0.0.0.0:9002:9001" healthcheck: - test: ["CMD", "nc", "-v", "localhost", "3002"] + test: ["CMD", "nc", "-vz", "localhost", "3001"] interval: 20s timeout: 5s retries: 15 From 75ca0d413832bee14d6222ab3040881c073f2aed Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 28 Mar 2023 11:44:02 -0600 Subject: [PATCH 07/10] Detect transient errors exporting variables and re-try Former-commit-id: 15c0a92f30057d292baf2770cda2dd4bcf6b43bc --- app/deploy_system.py | 56 ++++++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/app/deploy_system.py b/app/deploy_system.py index 94cf026..9371a2f 100644 --- a/app/deploy_system.py +++ b/app/deploy_system.py @@ -292,21 +292,41 @@ def _orchestrate_cluster_config(ctx, cluster_config, docker, container_exec_env) directive ) if ctx.verbose: - print(f"Setting {pd.destination_container}.{pd.destination_variable} = {pd.source_container}.{pd.source_variable}") - # TODO: fix the script paths so they're consistent between containers - source_value = docker.compose.execute(pd.source_container, - ["sh", "-c", - f"sh /docker-entrypoint-scripts.d/export-{pd.source_variable}.sh"], - tty=False, - envs=container_exec_env) - # TODO: handle the case that the value is not yet available - if ctx.debug: - 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 {source_value}"], - tty=False, - envs=container_exec_env) - if ctx.debug: - print(f"destination output: {destination_output}") - # TODO: detect errors here + print(f"Setting {pd.destination_container}.{pd.destination_variable}" + f" = {pd.source_container}.{pd.source_variable}") + # TODO: add a timeout + waiting_for_data = True + while waiting_for_data: + # TODO: fix the script paths so they're consistent between containers + source_value = None + try: + source_value = docker.compose.execute(pd.source_container, + ["sh", "-c", + "sh /docker-entrypoint-scripts.d/export-" + f"{pd.source_variable}.sh"], + tty=False, + envs=container_exec_env) + except DockerException as error: + if ctx.debug: + print(f"Docker exception reading config source: {error}") + # If the script executed failed for some reason, we get: + # "It returned with code 1" + if "It returned with code 1" in str(error): + if ctx.verbose: + print("Config export script returned an error, re-trying") + # If the script failed to execute (e.g. the file is not there) then we get: + # "It returned with code 2" + if "It returned with code 2" in str(error): + print(f"Fatal error reading config source: {error}") + if source_value: + if ctx.debug: + 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" + f" {source_value}"], + tty=False, + envs=container_exec_env) + waiting_for_data = False + if ctx.debug: + print(f"destination output: {destination_output}") From cb7b6f05f284e036a978c235f28130331abd1859 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 28 Mar 2023 11:49:58 -0600 Subject: [PATCH 08/10] Update version Former-commit-id: 1266ab88be4e55aaff2855a80973325c30a031a1 --- app/data/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/data/version.txt b/app/data/version.txt index 16d2611..35ec87b 100644 --- a/app/data/version.txt +++ b/app/data/version.txt @@ -1,2 +1,2 @@ # This file should be re-generated running: scripts/update-version-file.sh script -v1.0.33-7e1137f +v1.0.34-a4a9607 From 51ad55b1d14e628b02ddb22674427092210aaeeb Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 28 Mar 2023 19:52:42 -0600 Subject: [PATCH 09/10] Do not switch gid/uid for root and system users Former-commit-id: b6fb3b396bd48bc434590d3a6723157144d7f924 --- app/data/container-build/cerc-builder-js/Dockerfile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/data/container-build/cerc-builder-js/Dockerfile b/app/data/container-build/cerc-builder-js/Dockerfile index 71c770c..d8475d2 100644 --- a/app/data/container-build/cerc-builder-js/Dockerfile +++ b/app/data/container-build/cerc-builder-js/Dockerfile @@ -17,12 +17,16 @@ ARG NPM_GLOBAL=/usr/local/share/npm-global # Add NPM global to PATH. ENV PATH=${NPM_GLOBAL}/bin:${PATH} +SHELL ["/bin/bash", "-c"] + RUN \ - if [ ${CERC_HOST_GID} -ne 1000 ] ; then \ - groupmod -g ${CERC_HOST_GID} ${USERNAME} ; \ + # Don't switch container uid/gid if the host uid/gid is 1000 (which means it's already correct), + # or root (which won't work anyway) or <= 100 (which also won't work). + if [[ ${CERC_HOST_GID} -ne 1000 && ${CERC_HOST_GID} -ne 0 && ${CERC_HOST_GID} -gt 100 ]]; then \ + groupmod -g ${CERC_HOST_GID} ${USERNAME}; \ fi \ - && if [ ${CERC_HOST_UID} -ne 1000 ] ; then \ - usermod -u ${CERC_HOST_UID} -g ${CERC_HOST_GID} ${USERNAME} && chown ${CERC_HOST_UID}:${CERC_HOST_GID} /home/${USERNAME} ; \ + && if [[ ${CERC_HOST_UID} -ne 1000 && ${CERC_HOST_UID} -ne 0 && ${CERC_HOST_UID} -gt 100 ]]; then \ + usermod -u ${CERC_HOST_UID} -g ${CERC_HOST_GID} ${USERNAME} && chown ${CERC_HOST_UID}:${CERC_HOST_GID} /home/${USERNAME}; \ fi RUN \ From 75ca36e5f78a3656690c7f0ceef6cd55a3435dbc Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 28 Mar 2023 20:00:16 -0600 Subject: [PATCH 10/10] Update version Former-commit-id: e23ee1b176aa5db132c94ddf058076dab3aacb8b --- app/data/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/data/version.txt b/app/data/version.txt index 35ec87b..7a0035e 100644 --- a/app/data/version.txt +++ b/app/data/version.txt @@ -1,2 +1,2 @@ # This file should be re-generated running: scripts/update-version-file.sh script -v1.0.34-a4a9607 +v1.0.35-df23476