From eb70f2526ea59e53d1b2cf5f9661e70c2a11e631 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Sat, 4 Mar 2023 18:45:57 -0700 Subject: [PATCH 1/3] Initial commit Former-commit-id: 49c524e8edc27db89f79a13bbe19a8ece221372e --- app/data/compose/docker-compose-fixturenet-laconicd.yml | 5 ++++- .../fixturenet-laconicd/registry-cli-config-template.yml | 7 +++++++ .../container-build/cerc-laconic-registry-cli/Dockerfile | 4 +++- .../cerc-laconic-registry-cli/configure-key.sh | 2 ++ app/deploy_system.py | 2 +- 5 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 app/data/config/fixturenet-laconicd/registry-cli-config-template.yml create mode 100644 app/data/container-build/cerc-laconic-registry-cli/configure-key.sh diff --git a/app/data/compose/docker-compose-fixturenet-laconicd.yml b/app/data/compose/docker-compose-fixturenet-laconicd.yml index 997063db..cfbc574f 100644 --- a/app/data/compose/docker-compose-fixturenet-laconicd.yml +++ b/app/data/compose/docker-compose-fixturenet-laconicd.yml @@ -18,4 +18,7 @@ services: - "9090" - "9091" - "1317" - + cli: + image: cerc/laconic-registry-cli:local + volumes: + - ../config/fixturenet-laconicd/registry-cli-config-template.yml:/registry-cli-config-template.yml diff --git a/app/data/config/fixturenet-laconicd/registry-cli-config-template.yml b/app/data/config/fixturenet-laconicd/registry-cli-config-template.yml new file mode 100644 index 00000000..6074cc6d --- /dev/null +++ b/app/data/config/fixturenet-laconicd/registry-cli-config-template.yml @@ -0,0 +1,7 @@ +services: + cns: + restEndpoint: 'http://laconicd:1317' + gqlEndpoint: 'http://laconicd:9473/api' + userKey: REPLACE_WITH_MYKEY + bondId: + chainId: laconic_9000-1 diff --git a/app/data/container-build/cerc-laconic-registry-cli/Dockerfile b/app/data/container-build/cerc-laconic-registry-cli/Dockerfile index ba22a5c9..d7042207 100644 --- a/app/data/container-build/cerc-laconic-registry-cli/Dockerfile +++ b/app/data/container-build/cerc-laconic-registry-cli/Dockerfile @@ -51,4 +51,6 @@ RUN npm config set @lirewine:registry ${CERC_NPM_URL} \ # Globally install the cli package RUN yarn global add @cerc-io/laconic-registry-cli -ENTRYPOINT ["laconic"] +# Default command sleeps forever so docker doesn't kill it +CMD ["sh", "-c", "while :; do sleep 600; done"] + diff --git a/app/data/container-build/cerc-laconic-registry-cli/configure-key.sh b/app/data/container-build/cerc-laconic-registry-cli/configure-key.sh new file mode 100644 index 00000000..3bafec4b --- /dev/null +++ b/app/data/container-build/cerc-laconic-registry-cli/configure-key.sh @@ -0,0 +1,2 @@ +#!/bin/sh +sed 's/REPLACE_WITH_MYKEY/'${1}'/' registry-cli-config-template.yml > config.yml diff --git a/app/deploy_system.py b/app/deploy_system.py index 2d58967e..7001236f 100644 --- a/app/deploy_system.py +++ b/app/deploy_system.py @@ -75,7 +75,7 @@ def command(ctx, include, exclude, cluster, command, extra_args): print("Usage: exec ") sys.exit(1) service_name = extra_args_list[0] - command_to_exec = extra_args_list[1:] + command_to_exec = ["sh", "-c"] + extra_args_list[1:] container_exec_env = _make_runtime_env(ctx.obj) if verbose: print(f"Running compose exec {service_name} {command_to_exec}") From 178de8f496af455f97015f5876c3021b0fb0e95f Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 7 Mar 2023 09:07:15 -0700 Subject: [PATCH 2/3] Add simple export/import scheme Former-commit-id: 277be07dcd2bc4473c963119eb5d47d9739b0c21 --- .../container-build/cerc-laconic-registry-cli/Dockerfile | 6 +++++- .../{configure-key.sh => import-key.sh} | 0 app/data/container-build/cerc-laconicd/export-mykey.sh | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) rename app/data/container-build/cerc-laconic-registry-cli/{configure-key.sh => import-key.sh} (100%) create mode 100644 app/data/container-build/cerc-laconicd/export-mykey.sh diff --git a/app/data/container-build/cerc-laconic-registry-cli/Dockerfile b/app/data/container-build/cerc-laconic-registry-cli/Dockerfile index d7042207..bc772d49 100644 --- a/app/data/container-build/cerc-laconic-registry-cli/Dockerfile +++ b/app/data/container-build/cerc-laconic-registry-cli/Dockerfile @@ -51,6 +51,10 @@ RUN npm config set @lirewine:registry ${CERC_NPM_URL} \ # Globally install the cli package RUN yarn global add @cerc-io/laconic-registry-cli +# Add scripts +RUN mkdir /scripts +ENV PATH="${PATH}:/scripts" +COPY ./import.key.sh /scripts + # Default command sleeps forever so docker doesn't kill it CMD ["sh", "-c", "while :; do sleep 600; done"] - diff --git a/app/data/container-build/cerc-laconic-registry-cli/configure-key.sh b/app/data/container-build/cerc-laconic-registry-cli/import-key.sh similarity index 100% rename from app/data/container-build/cerc-laconic-registry-cli/configure-key.sh rename to app/data/container-build/cerc-laconic-registry-cli/import-key.sh diff --git a/app/data/container-build/cerc-laconicd/export-mykey.sh b/app/data/container-build/cerc-laconicd/export-mykey.sh new file mode 100644 index 00000000..a32ac2e6 --- /dev/null +++ b/app/data/container-build/cerc-laconicd/export-mykey.sh @@ -0,0 +1,2 @@ +#!/bin/sh +echo y | docker compose exec laconicd laconicd keys export mykey --unarmored-hex --unsafe From 6ae3c252ea64304496a25a47a922ee9a46dfade6 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 7 Mar 2023 10:08:04 -0700 Subject: [PATCH 3/3] Very basic key export/import implementation Former-commit-id: 8a8fef6845edbbde34e561bb1b613df1c5a9cc9b --- app/data/compose/docker-compose-fixturenet-laconicd.yml | 3 ++- app/data/config/fixturenet-laconicd/export-mykey.sh | 2 ++ app/data/container-build/cerc-laconic-registry-cli/Dockerfile | 2 +- app/data/container-build/cerc-laconicd/export-mykey.sh | 2 -- 4 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 app/data/config/fixturenet-laconicd/export-mykey.sh delete mode 100644 app/data/container-build/cerc-laconicd/export-mykey.sh diff --git a/app/data/compose/docker-compose-fixturenet-laconicd.yml b/app/data/compose/docker-compose-fixturenet-laconicd.yml index cfbc574f..9663e7f0 100644 --- a/app/data/compose/docker-compose-fixturenet-laconicd.yml +++ b/app/data/compose/docker-compose-fixturenet-laconicd.yml @@ -5,8 +5,9 @@ services: image: cerc/laconicd:local command: ["sh", "/docker-entrypoint-scripts.d/create-fixturenet.sh"] volumes: - # TODO: look at folding this script into the container + # TODO: look at folding these scripts into the container - ../config/fixturenet-laconicd/create-fixturenet.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh + - ../config/fixturenet-laconicd/export-mykey.sh:/docker-entrypoint-scripts.d/export-mykey.sh # TODO: determine which of the ports below is really needed ports: - "6060" diff --git a/app/data/config/fixturenet-laconicd/export-mykey.sh b/app/data/config/fixturenet-laconicd/export-mykey.sh new file mode 100644 index 00000000..1a5be86e --- /dev/null +++ b/app/data/config/fixturenet-laconicd/export-mykey.sh @@ -0,0 +1,2 @@ +#!/bin/sh +echo y | laconicd keys export mykey --unarmored-hex --unsafe diff --git a/app/data/container-build/cerc-laconic-registry-cli/Dockerfile b/app/data/container-build/cerc-laconic-registry-cli/Dockerfile index bc772d49..cef3b36f 100644 --- a/app/data/container-build/cerc-laconic-registry-cli/Dockerfile +++ b/app/data/container-build/cerc-laconic-registry-cli/Dockerfile @@ -54,7 +54,7 @@ RUN yarn global add @cerc-io/laconic-registry-cli # Add scripts RUN mkdir /scripts ENV PATH="${PATH}:/scripts" -COPY ./import.key.sh /scripts +COPY ./import-key.sh /scripts # Default command sleeps forever so docker doesn't kill it CMD ["sh", "-c", "while :; do sleep 600; done"] diff --git a/app/data/container-build/cerc-laconicd/export-mykey.sh b/app/data/container-build/cerc-laconicd/export-mykey.sh deleted file mode 100644 index a32ac2e6..00000000 --- a/app/data/container-build/cerc-laconicd/export-mykey.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -echo y | docker compose exec laconicd laconicd keys export mykey --unarmored-hex --unsafe