From bdddada3da948fb8156192d3f63cdde0b0a727c9 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Wed, 19 Jun 2024 15:44:46 +0530 Subject: [PATCH 01/12] Rename existing stack to testnet-laconicd --- README.md | 2 +- ...ml => docker-compose-testnet-laconicd.yml} | 0 .../container-build/cerc-laconic2d/build.sh | 2 +- .../README.md | 42 +++++++++---------- .../stack.yml | 4 +- 5 files changed, 25 insertions(+), 25 deletions(-) rename stack-orchestrator/compose/{docker-compose-laconicd-full-node.yml => docker-compose-testnet-laconicd.yml} (100%) rename stack-orchestrator/stacks/{laconicd-full-node => testnet-laconicd}/README.md (65%) rename stack-orchestrator/stacks/{laconicd-full-node => testnet-laconicd}/stack.yml (72%) diff --git a/README.md b/README.md index b368cc3..7305d1b 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,4 @@ Stacks to run nodes for laconic-testnet -- [Full node stack documentation](stack-orchestrator/stacks/laconicd-full-node/README.md) +- [Stack documentation](./stack-orchestrator/stacks/testnet-laconicd/README.md) diff --git a/stack-orchestrator/compose/docker-compose-laconicd-full-node.yml b/stack-orchestrator/compose/docker-compose-testnet-laconicd.yml similarity index 100% rename from stack-orchestrator/compose/docker-compose-laconicd-full-node.yml rename to stack-orchestrator/compose/docker-compose-testnet-laconicd.yml diff --git a/stack-orchestrator/container-build/cerc-laconic2d/build.sh b/stack-orchestrator/container-build/cerc-laconic2d/build.sh index 1c4f7de..2265c85 100755 --- a/stack-orchestrator/container-build/cerc-laconic2d/build.sh +++ b/stack-orchestrator/container-build/cerc-laconic2d/build.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Build cerc/laconicd +# Build cerc/laconic2d source ${CERC_CONTAINER_BASE_DIR}/build-base.sh docker build -t cerc/laconic2d:local ${build_command_args} ${CERC_REPO_BASE_DIR}/laconic2d diff --git a/stack-orchestrator/stacks/laconicd-full-node/README.md b/stack-orchestrator/stacks/testnet-laconicd/README.md similarity index 65% rename from stack-orchestrator/stacks/laconicd-full-node/README.md rename to stack-orchestrator/stacks/testnet-laconicd/README.md index 05ba436..8511c6a 100644 --- a/stack-orchestrator/stacks/laconicd-full-node/README.md +++ b/stack-orchestrator/stacks/testnet-laconicd/README.md @@ -1,4 +1,4 @@ -# laconicd-full-node +# laconicd-testnet Instructions for running a laconicd testnet full node and joining as a validator @@ -25,13 +25,13 @@ Instructions for running a laconicd testnet full node and joining as a validator * Clone required repositories: ```bash - laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconicd-full-node setup-repositories + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd setup-repositories ``` * Build the container images: ```bash - laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconicd-full-node build-containers + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd build-containers ``` This should create the following docker images locally: @@ -43,7 +43,7 @@ Instructions for running a laconicd testnet full node and joining as a validator * Create a spec file for the deployment: ```bash - laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconicd-full-node deploy init --output laconic-full-node-spec.yml + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd deploy init --output testnet-laconicd-spec.yml ``` * Edit `network` in the spec file to map container ports to host ports as required: @@ -64,15 +64,15 @@ Instructions for running a laconicd testnet full node and joining as a validator * Create a deployment from the spec file: ```bash - laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconicd-full-node deploy create --spec-file laconic-full-node-spec.yml --deployment-dir laconic-full-node-deployment + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd deploy create --spec-file testnet-laconicd-spec.yml --deployment-dir testnet-laconicd-deployment ``` -* Copy over the published testnet genesis file (`.json`) to data directory in deployment (`laconic-full-node-deployment/data/laconicd-data/tmp`): +* Copy over the published testnet genesis file (`.json`) to data directory in deployment (`testnet-laconicd-deployment/data/laconicd-data/tmp`): ```bash # Example - mkdir -p laconic-full-node-deployment/data/laconicd-data/tmp - cp genesis.json laconic-full-node-deployment/data/laconicd-data/tmp/genesis.json + mkdir -p testnet-laconicd-deployment/data/laconicd-data/tmp + cp genesis.json testnet-laconicd-deployment/data/laconicd-data/tmp/genesis.json ``` ## Configuration @@ -99,7 +99,7 @@ Instructions for running a laconicd testnet full node and joining as a validator ## Start the deployment ```bash -laconic-so deployment --dir laconic-full-node-deployment start +laconic-so deployment --dir testnet-laconicd-deployment start ``` ## Check status @@ -111,13 +111,13 @@ laconic-so deployment --dir laconic-full-node-deployment start docker ps -a # Follow logs for laconicd container - laconic-so deployment --dir laconic-full-node-deployment logs laconicd -f + laconic-so deployment --dir testnet-laconicd-deployment logs laconicd -f ``` * Check the sync status of your node: ```bash - laconic-so deployment --dir laconic-full-node-deployment exec laconicd "laconicd status | jq .sync_info" + laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd status | jq .sync_info" # `catching_up: false` indicates that node is completely synced ``` @@ -128,15 +128,15 @@ laconic-so deployment --dir laconic-full-node-deployment start ```bash # Create new keypair - laconic-so deployment --dir laconic-full-node-deployment exec laconicd "laconicd keys add " + laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd keys add " # OR # Restore existing key with mnemonic seed phrase # You will be prompted to enter mnemonic seed - laconic-so deployment --dir laconic-full-node-deployment exec laconicd "laconicd keys add --recover" + laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd keys add --recover" # Query the keystore for your account's address - laconic-so deployment --dir laconic-full-node-deployment exec laconicd "laconicd keys show -a" + laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd keys show -a" ``` * Request tokens from the testnet faucet for your account if required @@ -144,14 +144,14 @@ laconic-so deployment --dir laconic-full-node-deployment start * Check balance for your account: ```bash - laconic-so deployment --dir laconic-full-node-deployment exec laconicd "laconicd query bank balances " + laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd query bank balances " ``` * Create required validator configuration: ```bash # Edit the staking amount and other fields as required - laconic-so deployment --dir laconic-full-node-deployment exec laconicd 'cat < -validator.json + laconic-so deployment --dir testnet-laconicd-deployment exec laconicd 'cat < -validator.json { "pubkey": $(laconicd cometbft show-validator), "amount": "900000000photon", @@ -167,7 +167,7 @@ laconic-so deployment --dir laconic-full-node-deployment start * Create a validator: ```bash - laconic-so deployment --dir laconic-full-node-deployment exec laconicd 'laconicd tx staking create-validator -validator.json \ + laconic-so deployment --dir testnet-laconicd-deployment exec laconicd 'laconicd tx staking create-validator -validator.json \ --fees 50photon \ --chain-id=laconic_9000-1 \ --from ' @@ -176,7 +176,7 @@ laconic-so deployment --dir laconic-full-node-deployment start * View your staking validator details: ```bash - laconic-so deployment --dir laconic-full-node-deployment exec laconicd "laconicd query staking validator " + laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd query staking validator " ``` ## Clean up @@ -185,15 +185,15 @@ laconic-so deployment --dir laconic-full-node-deployment start ```bash # Stop the docker containers - laconic-so deployment --dir laconic-full-node-deployment stop + laconic-so deployment --dir testnet-laconicd-deployment stop ``` * To stop all services and also delete data: ```bash # Stop the docker containers - laconic-so deployment --dir laconic-full-node-deployment stop --delete-volumes + laconic-so deployment --dir testnet-laconicd-deployment stop --delete-volumes # Remove deployment directory (deployment will have to be recreated for a re-run) - rm -r laconic-full-node-deployment + rm -r testnet-laconicd-deployment ``` diff --git a/stack-orchestrator/stacks/laconicd-full-node/stack.yml b/stack-orchestrator/stacks/testnet-laconicd/stack.yml similarity index 72% rename from stack-orchestrator/stacks/laconicd-full-node/stack.yml rename to stack-orchestrator/stacks/testnet-laconicd/stack.yml index 677b1d2..82252ba 100644 --- a/stack-orchestrator/stacks/laconicd-full-node/stack.yml +++ b/stack-orchestrator/stacks/testnet-laconicd/stack.yml @@ -1,9 +1,9 @@ version: "1.0" -name: laconicd-full-node +name: testnet-laconicd description: "Laconicd full node" repos: - git.vdb.to/cerc-io/laconic2d containers: - cerc/laconic2d pods: - - laconicd-full-node + - testnet-laconicd -- 2.45.2 From 50194b6bbee170093c027204dbcb0af146706bd8 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Wed, 19 Jun 2024 17:23:29 +0530 Subject: [PATCH 02/12] Add a laconic-console stack with registry CLI --- .../docker-compose-laconic-console.yml | 10 +++++++++ .../config/laconic-console/create-config.sh | 21 +++++++++++++++++++ .../cerc-laconic2-registry-cli/Dockerfile | 18 ++++++++++++++++ .../cerc-laconic2-registry-cli/build.sh | 9 ++++++++ .../stacks/laconic-console/README.md | 1 + .../stacks/laconic-console/stack.yml | 9 ++++++++ 6 files changed, 68 insertions(+) create mode 100644 stack-orchestrator/compose/docker-compose-laconic-console.yml create mode 100755 stack-orchestrator/config/laconic-console/create-config.sh create mode 100644 stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile create mode 100755 stack-orchestrator/container-build/cerc-laconic2-registry-cli/build.sh create mode 100644 stack-orchestrator/stacks/laconic-console/README.md create mode 100644 stack-orchestrator/stacks/laconic-console/stack.yml diff --git a/stack-orchestrator/compose/docker-compose-laconic-console.yml b/stack-orchestrator/compose/docker-compose-laconic-console.yml new file mode 100644 index 0000000..8cde253 --- /dev/null +++ b/stack-orchestrator/compose/docker-compose-laconic-console.yml @@ -0,0 +1,10 @@ +services: + cli: + image: cerc/laconic2-registry-cli:local + environment: + CERC_LACONICD_RPC_ENDPOINT: ${CERC_LACONICD_RPC_ENDPOINT:-http://laconicd:26657} + CERC_LACONICD_GQL_ENDPOINT: ${CERC_LACONICD_GQL_ENDPOINT:-http://laconicd:9473/api} + CERC_CHAIN_ID: ${CERC_CHAIN_ID:-laconic_9000-1} + CERC_LOGLEVEL: ${CERC_LOGLEVEL:-info} + volumes: + - ../config/laconic-console/create-config.sh:/app/create-config.sh diff --git a/stack-orchestrator/config/laconic-console/create-config.sh b/stack-orchestrator/config/laconic-console/create-config.sh new file mode 100755 index 0000000..c80be8a --- /dev/null +++ b/stack-orchestrator/config/laconic-console/create-config.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then + set -x +fi + +set -e + +# Create the required config file +config_file="/app/config.yml" +cat < $config_file +services: + registry: + rpcEndpoint: ${CERC_LACONICD_RPC_ENDPOINT} + gqlEndpoint: ${CERC_LACONICD_GQL_ENDPOINT} + userKey: ${CERC_USER_KEY} + bondId: ${CERC_BOND_ID} + chainId: ${CERC_CHAIN_ID} + gas: 200000 + fees: 200000photon +EOF diff --git a/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile b/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile new file mode 100644 index 0000000..63e1ea8 --- /dev/null +++ b/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile @@ -0,0 +1,18 @@ +# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster +ARG VARIANT=18-bullseye +FROM node:${VARIANT} + +RUN apt-get update \ + && apt-get -y install --no-install-recommends python3 jq bash curl + +WORKDIR /app + +COPY . . + +RUN echo "Installing dependencies and building laconic-registry-cli" && \ + yarn && yarn build + +# Globally install the cli binary +RUN yarn global add file:$PWD + +CMD ["bash", "-c", "tail -f /dev/null"] diff --git a/stack-orchestrator/container-build/cerc-laconic2-registry-cli/build.sh b/stack-orchestrator/container-build/cerc-laconic2-registry-cli/build.sh new file mode 100755 index 0000000..8ead4b6 --- /dev/null +++ b/stack-orchestrator/container-build/cerc-laconic2-registry-cli/build.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +# Build cerc/laconic2-registry-cli +source ${CERC_CONTAINER_BASE_DIR}/build-base.sh + +# See: https://stackoverflow.com/a/246128/1701505 +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +docker build -t cerc/laconic2-registry-cli:local ${build_command_args} -f ${SCRIPT_DIR}/Dockerfile ${SCRIPT_DIR} diff --git a/stack-orchestrator/stacks/laconic-console/README.md b/stack-orchestrator/stacks/laconic-console/README.md new file mode 100644 index 0000000..00e0cf7 --- /dev/null +++ b/stack-orchestrator/stacks/laconic-console/README.md @@ -0,0 +1 @@ +# laconic-console diff --git a/stack-orchestrator/stacks/laconic-console/stack.yml b/stack-orchestrator/stacks/laconic-console/stack.yml new file mode 100644 index 0000000..57adcc3 --- /dev/null +++ b/stack-orchestrator/stacks/laconic-console/stack.yml @@ -0,0 +1,9 @@ +version: "1.0" +name: laconic-console +description: "Laconic registry CLI and console" +repos: + - git.vdb.to/cerc-io/laconic-regsitry-cli@laconic2 +containers: + - cerc/laconic2-registry-cli +pods: + - laconic-console -- 2.45.2 From 5b8c133c1c72126d7d25e8ff9ac1a2beb668c07f Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Wed, 19 Jun 2024 17:43:34 +0530 Subject: [PATCH 03/12] Add laconic-console stack instructions --- .../docker-compose-laconic-console.yml | 6 +++ .../cerc-laconic2-registry-cli/Dockerfile | 1 + .../cerc-laconic2-registry-cli/build.sh | 2 +- .../stacks/laconic-console/README.md | 53 +++++++++++++++++++ .../stacks/laconic-console/stack.yml | 2 +- 5 files changed, 62 insertions(+), 2 deletions(-) diff --git a/stack-orchestrator/compose/docker-compose-laconic-console.yml b/stack-orchestrator/compose/docker-compose-laconic-console.yml index 8cde253..b4f2ff0 100644 --- a/stack-orchestrator/compose/docker-compose-laconic-console.yml +++ b/stack-orchestrator/compose/docker-compose-laconic-console.yml @@ -8,3 +8,9 @@ services: CERC_LOGLEVEL: ${CERC_LOGLEVEL:-info} volumes: - ../config/laconic-console/create-config.sh:/app/create-config.sh + - laconic-registry-data:/laconic-registry-data + extra_hosts: + - "host.docker.internal:host-gateway" + +volumes: + laconic-registry-data: diff --git a/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile b/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile index 63e1ea8..2449066 100644 --- a/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile +++ b/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile @@ -13,6 +13,7 @@ RUN echo "Installing dependencies and building laconic-registry-cli" && \ yarn && yarn build # Globally install the cli binary +RUN npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/ RUN yarn global add file:$PWD CMD ["bash", "-c", "tail -f /dev/null"] diff --git a/stack-orchestrator/container-build/cerc-laconic2-registry-cli/build.sh b/stack-orchestrator/container-build/cerc-laconic2-registry-cli/build.sh index 8ead4b6..0c775dc 100755 --- a/stack-orchestrator/container-build/cerc-laconic2-registry-cli/build.sh +++ b/stack-orchestrator/container-build/cerc-laconic2-registry-cli/build.sh @@ -6,4 +6,4 @@ source ${CERC_CONTAINER_BASE_DIR}/build-base.sh # See: https://stackoverflow.com/a/246128/1701505 SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -docker build -t cerc/laconic2-registry-cli:local ${build_command_args} -f ${SCRIPT_DIR}/Dockerfile ${SCRIPT_DIR} +docker build -t cerc/laconic2-registry-cli:local ${build_command_args} -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/laconic-registry-cli diff --git a/stack-orchestrator/stacks/laconic-console/README.md b/stack-orchestrator/stacks/laconic-console/README.md index 00e0cf7..0e42463 100644 --- a/stack-orchestrator/stacks/laconic-console/README.md +++ b/stack-orchestrator/stacks/laconic-console/README.md @@ -1 +1,54 @@ # laconic-console + +Instructions for running laconic registry CLI and console + +## Prerequisites + +* laconicd RPC and GQL endpoints + +## Setup + +* Clone the stack repo: + + ```bash + laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack + ``` + +* Clone required repositories: + + ```bash + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console setup-repositories + ``` + +* Build the container images: + + ```bash + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console build-containers + ``` + + This should create the following docker images locally: + + * `cerc/laconic2-registry-cli` + +## Create a deployment + +* Create a spec file for the deployment: + + ```bash + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console deploy init --output laconic-console-spec.yml + ``` + +* Create a deployment from the spec file: + + ```bash + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console deploy create --spec-file laconic-console-spec.yml --deployment-dir laconic-console-deployment + ``` + +## Configuration + +* Inside the deployment directory, open `config.env` file and set following env variables: + + ```bash + # TODO + ``` + diff --git a/stack-orchestrator/stacks/laconic-console/stack.yml b/stack-orchestrator/stacks/laconic-console/stack.yml index 57adcc3..7a2d6db 100644 --- a/stack-orchestrator/stacks/laconic-console/stack.yml +++ b/stack-orchestrator/stacks/laconic-console/stack.yml @@ -2,7 +2,7 @@ version: "1.0" name: laconic-console description: "Laconic registry CLI and console" repos: - - git.vdb.to/cerc-io/laconic-regsitry-cli@laconic2 + - git.vdb.to/cerc-io/laconic-registry-cli@laconic2 containers: - cerc/laconic2-registry-cli pods: -- 2.45.2 From 1e014e6b2e371953c6dc9ec66d9d5d6e0285b011 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Wed, 19 Jun 2024 19:29:07 +0530 Subject: [PATCH 04/12] Setup laconic-console in the stack --- .../docker-compose-laconic-console.yml | 11 ++++ .../{ => cli}/create-config.sh | 0 .../config/laconic-console/console/config.yml | 6 ++ .../cerc-laconic-console-host/Dockerfile | 12 ++++ .../cerc-laconic-console-host/build.sh | 9 +++ .../cerc-webapp-base/Dockerfile | 58 ++++++++++++++++++ .../cerc-webapp-base/Dockerfile.webapp | 12 ++++ .../container-build/cerc-webapp-base/build.sh | 35 +++++++++++ .../scripts/apply-runtime-env.sh | 33 ++++++++++ .../scripts/apply-webapp-config.sh | 35 +++++++++++ .../cerc-webapp-base/scripts/build-app.sh | 61 +++++++++++++++++++ .../scripts/start-serving-app.sh | 48 +++++++++++++++ .../stacks/laconic-console/stack.yml | 3 + 13 files changed, 323 insertions(+) rename stack-orchestrator/config/laconic-console/{ => cli}/create-config.sh (100%) create mode 100644 stack-orchestrator/config/laconic-console/console/config.yml create mode 100644 stack-orchestrator/container-build/cerc-laconic-console-host/Dockerfile create mode 100755 stack-orchestrator/container-build/cerc-laconic-console-host/build.sh create mode 100644 stack-orchestrator/container-build/cerc-webapp-base/Dockerfile create mode 100644 stack-orchestrator/container-build/cerc-webapp-base/Dockerfile.webapp create mode 100755 stack-orchestrator/container-build/cerc-webapp-base/build.sh create mode 100755 stack-orchestrator/container-build/cerc-webapp-base/scripts/apply-runtime-env.sh create mode 100755 stack-orchestrator/container-build/cerc-webapp-base/scripts/apply-webapp-config.sh create mode 100755 stack-orchestrator/container-build/cerc-webapp-base/scripts/build-app.sh create mode 100755 stack-orchestrator/container-build/cerc-webapp-base/scripts/start-serving-app.sh diff --git a/stack-orchestrator/compose/docker-compose-laconic-console.yml b/stack-orchestrator/compose/docker-compose-laconic-console.yml index b4f2ff0..6dcebb9 100644 --- a/stack-orchestrator/compose/docker-compose-laconic-console.yml +++ b/stack-orchestrator/compose/docker-compose-laconic-console.yml @@ -12,5 +12,16 @@ services: extra_hosts: - "host.docker.internal:host-gateway" + laconic-console: + restart: unless-stopped + image: cerc/laconic-console-host:local + environment: + - CERC_WEBAPP_FILES_DIR=${CERC_WEBAPP_FILES_DIR:-/usr/local/share/.config/yarn/global/node_modules/@cerc-io/console-app/dist/production} + - LACONIC_HOSTED_ENDPOINT=${LACONIC_HOSTED_ENDPOINT:-http://localhost:9473} + volumes: + - ../config/laconic-console/console/config.yml:/config.yml + ports: + - "80" + volumes: laconic-registry-data: diff --git a/stack-orchestrator/config/laconic-console/create-config.sh b/stack-orchestrator/config/laconic-console/cli/create-config.sh similarity index 100% rename from stack-orchestrator/config/laconic-console/create-config.sh rename to stack-orchestrator/config/laconic-console/cli/create-config.sh diff --git a/stack-orchestrator/config/laconic-console/console/config.yml b/stack-orchestrator/config/laconic-console/console/config.yml new file mode 100644 index 0000000..883e34e --- /dev/null +++ b/stack-orchestrator/config/laconic-console/console/config.yml @@ -0,0 +1,6 @@ +# Config for laconic-console + +services: + wns: + server: 'LACONIC_HOSTED_ENDPOINT/api' + webui: 'LACONIC_HOSTED_ENDPOINT/console' diff --git a/stack-orchestrator/container-build/cerc-laconic-console-host/Dockerfile b/stack-orchestrator/container-build/cerc-laconic-console-host/Dockerfile new file mode 100644 index 0000000..2a7f015 --- /dev/null +++ b/stack-orchestrator/container-build/cerc-laconic-console-host/Dockerfile @@ -0,0 +1,12 @@ +FROM cerc/webapp-base:local + +# Configure the cerc-io npm registry +RUN npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/ + +COPY . . + +RUN echo "Installing dependencies" && yarn +RUN LACONIC_HOSTED_CONFIG_FILE=config-hosted.yml yarn dist + +RUN npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/ +RUN yarn global add file:$PWD diff --git a/stack-orchestrator/container-build/cerc-laconic-console-host/build.sh b/stack-orchestrator/container-build/cerc-laconic-console-host/build.sh new file mode 100755 index 0000000..ee349e1 --- /dev/null +++ b/stack-orchestrator/container-build/cerc-laconic-console-host/build.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# Build cerc/laconic-registry-cli + +source ${CERC_CONTAINER_BASE_DIR}/build-base.sh + +# See: https://stackoverflow.com/a/246128/1701505 +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +docker build -t cerc/laconic-console-host:local ${build_command_args} -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/laconic-console diff --git a/stack-orchestrator/container-build/cerc-webapp-base/Dockerfile b/stack-orchestrator/container-build/cerc-webapp-base/Dockerfile new file mode 100644 index 0000000..5b119b3 --- /dev/null +++ b/stack-orchestrator/container-build/cerc-webapp-base/Dockerfile @@ -0,0 +1,58 @@ +# Originally from: https://github.com/devcontainers/images/blob/main/src/javascript-node/.devcontainer/Dockerfile +# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster +ARG VARIANT=20-bullseye-slim +FROM node:${VARIANT} + +ARG USERNAME=node +ARG NPM_GLOBAL=/usr/local/share/npm-global + +# Add NPM global to PATH. +ENV PATH=${NPM_GLOBAL}/bin:${PATH} +# Prevents npm from printing version warnings +ENV NPM_CONFIG_UPDATE_NOTIFIER=false + +RUN \ + # Configure global npm install location, use group to adapt to UID/GID changes + if ! cat /etc/group | grep -e "^npm:" > /dev/null 2>&1; then groupadd -r npm; fi \ + && usermod -a -G npm ${USERNAME} \ + && umask 0002 \ + && mkdir -p ${NPM_GLOBAL} \ + && touch /usr/local/etc/npmrc \ + && chown ${USERNAME}:npm ${NPM_GLOBAL} /usr/local/etc/npmrc \ + && chmod g+s ${NPM_GLOBAL} \ + && npm config -g set prefix ${NPM_GLOBAL} \ + && su ${USERNAME} -c "npm config -g set prefix ${NPM_GLOBAL}" \ + # Install eslint + && su ${USERNAME} -c "umask 0002 && npm install -g eslint" \ + # Install semver + && su ${USERNAME} -c "umask 0002 && npm install -g semver" \ + # Install pnpm + && su ${USERNAME} -c "umask 0002 && npm install -g pnpm" \ + && npm cache clean --force > /dev/null 2>&1 + +# [Optional] Uncomment this section to install additional OS packages. +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends jq gettext-base + +# [Optional] Uncomment if you want to install an additional version of node using nvm +# ARG EXTRA_NODE_VERSION=10 +# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}" + +# We do this to get a yq binary from the published container, for the correct architecture we're building here +COPY --from=docker.io/mikefarah/yq:latest /usr/bin/yq /usr/local/bin/yq + +COPY scripts /scripts + +# [Optional] Uncomment if you want to install more global node modules +# RUN su node -c "npm install -g " + +RUN mkdir -p /config + +# Install simple web server for now (use nginx perhaps later) +RUN yarn global add http-server + +# Expose port for http +EXPOSE 80 + +# Default command sleeps forever so docker doesn't kill it +CMD ["/scripts/start-serving-app.sh"] diff --git a/stack-orchestrator/container-build/cerc-webapp-base/Dockerfile.webapp b/stack-orchestrator/container-build/cerc-webapp-base/Dockerfile.webapp new file mode 100644 index 0000000..9eaf46e --- /dev/null +++ b/stack-orchestrator/container-build/cerc-webapp-base/Dockerfile.webapp @@ -0,0 +1,12 @@ +FROM cerc/webapp-base:local as builder + +ARG CERC_BUILD_TOOL +ARG CERC_BUILD_OUTPUT_DIR + +WORKDIR /app +COPY . . +RUN rm -rf node_modules build dist .next* +RUN /scripts/build-app.sh /app /data + +FROM cerc/webapp-base:local +COPY --from=builder /data /data diff --git a/stack-orchestrator/container-build/cerc-webapp-base/build.sh b/stack-orchestrator/container-build/cerc-webapp-base/build.sh new file mode 100755 index 0000000..5fc6cc3 --- /dev/null +++ b/stack-orchestrator/container-build/cerc-webapp-base/build.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# Build cerc/webapp-base + +source ${CERC_CONTAINER_BASE_DIR}/build-base.sh + +# See: https://stackoverflow.com/a/246128/1701505 +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +CERC_CONTAINER_BUILD_WORK_DIR=${CERC_CONTAINER_BUILD_WORK_DIR:-$SCRIPT_DIR} +CERC_CONTAINER_BUILD_DOCKERFILE=${CERC_CONTAINER_BUILD_DOCKERFILE:-$SCRIPT_DIR/Dockerfile} +CERC_CONTAINER_BUILD_TAG=${CERC_CONTAINER_BUILD_TAG:-cerc/webapp-base:local} + +docker build -t $CERC_CONTAINER_BUILD_TAG ${build_command_args} -f $CERC_CONTAINER_BUILD_DOCKERFILE $CERC_CONTAINER_BUILD_WORK_DIR +rc=$? + +if [ $rc -ne 0 ]; then + echo "BUILD FAILED" 1>&2 + exit $rc +fi + +if [ "$CERC_CONTAINER_BUILD_TAG" != "cerc/webapp-base:local" ]; then + cat < $TMP_ENV + set -a + source .env + source $TMP_ENV + set +a + rm -f $TMP_ENV +fi + +for f in $(find . -type f \( -regex '.*.html?' -or -regex ".*.[tj]s\(x\|on\)?$" \) | grep -v 'node_modules' | grep -v '.git'); do + for e in $(cat "${f}" | tr -s '[:blank:]' '\n' | tr -s '["/\\{},();]' '\n' | tr -s "[']" '\n' | egrep -o -e '^CERC_RUNTIME_ENV_.+$' -e '^LACONIC_HOSTED_CONFIG_.+$'); do + orig_name=$(echo -n "${e}" | sed 's/"//g') + cur_name=$(echo -n "${orig_name}" | sed 's/CERC_RUNTIME_ENV_//g') + cur_val=$(echo -n "\$${cur_name}" | envsubst) + if [ "$CERC_RETAIN_ENV_QUOTES" != "true" ]; then + cur_val=$(sed "s/^[\"']//" <<< "$cur_val" | sed "s/[\"']//") + fi + esc_val=$(sed 's/[&/\]/\\&/g' <<< "$cur_val") + echo "$f: $cur_name=$cur_val" + sed -i "s/$orig_name/$esc_val/g" $f + done +done diff --git a/stack-orchestrator/container-build/cerc-webapp-base/scripts/apply-webapp-config.sh b/stack-orchestrator/container-build/cerc-webapp-base/scripts/apply-webapp-config.sh new file mode 100755 index 0000000..6d36680 --- /dev/null +++ b/stack-orchestrator/container-build/cerc-webapp-base/scripts/apply-webapp-config.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +if [ -n "$CERC_SCRIPT_DEBUG" ]; then + set -x +fi +if [[ $# -ne 2 ]]; then + echo "Illegal number of parameters" >&2 + exit 1 +fi +config_file_name=$1 +webapp_files_dir=$2 +if ! [[ -f ${config_file_name} ]]; then + echo "Config file ${config_file_name} does not exist" >&2 + exit 1 +fi +if ! [[ -d ${webapp_files_dir} ]]; then + echo "Webapp directory ${webapp_files_dir} does not exist" >&2 + exit 1 +fi +# First some magic using yq to translate our yaml config file into an array of key value pairs like: +# LACONIC_HOSTED_CONFIG_= +readarray -t config_kv_pair_array < <( yq '.. | ([path | join("_"), .] | join("=") )' ${config_file_name} | sort -r | sed -e '$ d' | sed 's/^/LACONIC_HOSTED_CONFIG_/' ) +declare -p config_kv_pair_array +# Then iterate over that kv array making the template substitution in our web app files +for kv_pair_string in "${config_kv_pair_array[@]}" +do + kv_pair=(${kv_pair_string//=/ }) + template_string_to_replace=${kv_pair[0]} + template_value_to_substitute=${kv_pair[1]} + template_value_to_substitute_expanded=${template_value_to_substitute//LACONIC_HOSTED_ENDPOINT/${LACONIC_HOSTED_ENDPOINT}} + # Run find and sed to do the substitution of one variable over all files + # See: https://stackoverflow.com/a/21479607/1701505 + echo "Substituting: ${template_string_to_replace} = ${template_value_to_substitute_expanded}" + # Note: we do not escape our strings, on the expectation they do not container the '#' char. + find ${webapp_files_dir} -type f -exec sed -i 's#'${template_string_to_replace}'#'${template_value_to_substitute_expanded}'#g' {} + +done diff --git a/stack-orchestrator/container-build/cerc-webapp-base/scripts/build-app.sh b/stack-orchestrator/container-build/cerc-webapp-base/scripts/build-app.sh new file mode 100755 index 0000000..30358bb --- /dev/null +++ b/stack-orchestrator/container-build/cerc-webapp-base/scripts/build-app.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +if [ -n "$CERC_SCRIPT_DEBUG" ]; then + set -x +fi + +CERC_BUILD_TOOL="${CERC_BUILD_TOOL}" +CERC_BUILD_OUTPUT_DIR="${CERC_BUILD_OUTPUT_DIR}" + +WORK_DIR="${1:-/app}" +DEST_DIR="${2:-/data}" + +if [ -f "${WORK_DIR}/build-webapp.sh" ]; then + echo "Building webapp with ${WORK_DIR}/build-webapp.sh ..." + cd "${WORK_DIR}" || exit 1 + + rm -rf "${DEST_DIR}" + ./build-webapp.sh "${DEST_DIR}" || exit 1 +elif [ -f "${WORK_DIR}/package.json" ]; then + echo "Building node-based webapp ..." + cd "${WORK_DIR}" || exit 1 + + if [ -z "$CERC_BUILD_TOOL" ]; then + if [ -f "pnpm-lock.yaml" ]; then + CERC_BUILD_TOOL=pnpm + elif [ -f "yarn.lock" ]; then + CERC_BUILD_TOOL=yarn + else + CERC_BUILD_TOOL=npm + fi + fi + + time $CERC_BUILD_TOOL install || exit 1 + time $CERC_BUILD_TOOL build || exit 1 + + rm -rf "${DEST_DIR}" + if [ -z "${CERC_BUILD_OUTPUT_DIR}" ]; then + if [ -d "${WORK_DIR}/dist" ]; then + CERC_BUILD_OUTPUT_DIR="${WORK_DIR}/dist" + elif [ -d "${WORK_DIR}/build" ]; then + CERC_BUILD_OUTPUT_DIR="${WORK_DIR}/build" + else + echo "ERROR: Unable to locate build output. Set with --extra-build-args \"--build-arg CERC_BUILD_OUTPUT_DIR=path\"" 1>&2 + exit 1 + fi + fi + mv "${CERC_BUILD_OUTPUT_DIR}" "${DEST_DIR}" +else + echo "Copying static app ..." + mv "${WORK_DIR}" "${DEST_DIR}" +fi + +# One special fix ... +cd "${DEST_DIR}" +for f in $(find . -type f -name '*.htm*'); do + sed -i -e 's#/LACONIC_HOSTED_CONFIG_homepage/#LACONIC_HOSTED_CONFIG_homepage/#g' "$f" +done + +exit 0 diff --git a/stack-orchestrator/container-build/cerc-webapp-base/scripts/start-serving-app.sh b/stack-orchestrator/container-build/cerc-webapp-base/scripts/start-serving-app.sh new file mode 100755 index 0000000..3a114ee --- /dev/null +++ b/stack-orchestrator/container-build/cerc-webapp-base/scripts/start-serving-app.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +if [ -n "$CERC_SCRIPT_DEBUG" ]; then + set -x +fi + +CERC_LISTEN_PORT=${CERC_LISTEN_PORT:-80} +CERC_WEBAPP_FILES_DIR="${CERC_WEBAPP_FILES_DIR:-/data}" +CERC_ENABLE_CORS="${CERC_ENABLE_CORS:-false}" +CERC_SINGLE_PAGE_APP="${CERC_SINGLE_PAGE_APP}" + +if [ -z "${CERC_SINGLE_PAGE_APP}" ]; then + # If there is only one HTML file, assume an SPA. + if [ 1 -eq $(find "${CERC_WEBAPP_FILES_DIR}" -name '*.html' | wc -l) ]; then + CERC_SINGLE_PAGE_APP=true + else + CERC_SINGLE_PAGE_APP=false + fi +fi + +# ${var,,} is a lower-case comparison +if [ "true" == "${CERC_ENABLE_CORS,,}" ]; then + CERC_HTTP_EXTRA_ARGS="$CERC_HTTP_EXTRA_ARGS --cors" +fi + +# ${var,,} is a lower-case comparison +if [ "true" == "${CERC_SINGLE_PAGE_APP,,}" ]; then + echo "Serving content as single-page app. If this is wrong, set 'CERC_SINGLE_PAGE_APP=false'" + # Create a catchall redirect back to / + CERC_HTTP_EXTRA_ARGS="$CERC_HTTP_EXTRA_ARGS --proxy http://localhost:${CERC_LISTEN_PORT}?" +else + echo "Serving content normally. If this is a single-page app, set 'CERC_SINGLE_PAGE_APP=true'" +fi + +LACONIC_HOSTED_CONFIG_FILE=${LACONIC_HOSTED_CONFIG_FILE} +if [ -z "${LACONIC_HOSTED_CONFIG_FILE}" ]; then + if [ -f "/config/laconic-hosted-config.yml" ]; then + LACONIC_HOSTED_CONFIG_FILE="/config/laconic-hosted-config.yml" + elif [ -f "/config/config.yml" ]; then + LACONIC_HOSTED_CONFIG_FILE="/config/config.yml" + fi +fi + +if [ -f "${LACONIC_HOSTED_CONFIG_FILE}" ]; then + /scripts/apply-webapp-config.sh $LACONIC_HOSTED_CONFIG_FILE "${CERC_WEBAPP_FILES_DIR}" +fi + +/scripts/apply-runtime-env.sh ${CERC_WEBAPP_FILES_DIR} +http-server $CERC_HTTP_EXTRA_ARGS -p ${CERC_LISTEN_PORT} "${CERC_WEBAPP_FILES_DIR}" diff --git a/stack-orchestrator/stacks/laconic-console/stack.yml b/stack-orchestrator/stacks/laconic-console/stack.yml index 7a2d6db..a25eca7 100644 --- a/stack-orchestrator/stacks/laconic-console/stack.yml +++ b/stack-orchestrator/stacks/laconic-console/stack.yml @@ -3,7 +3,10 @@ name: laconic-console description: "Laconic registry CLI and console" repos: - git.vdb.to/cerc-io/laconic-registry-cli@laconic2 + - git.vdb.to/cerc-io/laconic-console@laconic2 containers: - cerc/laconic2-registry-cli + - cerc/webapp-base + - cerc/laconic-console-host pods: - laconic-console -- 2.45.2 From 8ee7040298528bb14c77daea6a2c3e66da40249e Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 20 Jun 2024 10:52:38 +0530 Subject: [PATCH 05/12] Update docker build and compose file for console --- .../docker-compose-laconic-console.yml | 10 ++++--- .../cerc-laconic-console-host/Dockerfile | 4 +++ .../cerc-laconic-console-host/build.sh | 5 ++-- .../stacks/laconic-console/README.md | 26 +++++++++++++++++-- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/stack-orchestrator/compose/docker-compose-laconic-console.yml b/stack-orchestrator/compose/docker-compose-laconic-console.yml index 6dcebb9..1fe36f1 100644 --- a/stack-orchestrator/compose/docker-compose-laconic-console.yml +++ b/stack-orchestrator/compose/docker-compose-laconic-console.yml @@ -2,6 +2,7 @@ services: cli: image: cerc/laconic2-registry-cli:local environment: + CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} CERC_LACONICD_RPC_ENDPOINT: ${CERC_LACONICD_RPC_ENDPOINT:-http://laconicd:26657} CERC_LACONICD_GQL_ENDPOINT: ${CERC_LACONICD_GQL_ENDPOINT:-http://laconicd:9473/api} CERC_CHAIN_ID: ${CERC_CHAIN_ID:-laconic_9000-1} @@ -14,12 +15,13 @@ services: laconic-console: restart: unless-stopped - image: cerc/laconic-console-host:local + image: cerc/laconic2-console-host:local environment: - - CERC_WEBAPP_FILES_DIR=${CERC_WEBAPP_FILES_DIR:-/usr/local/share/.config/yarn/global/node_modules/@cerc-io/console-app/dist/production} - - LACONIC_HOSTED_ENDPOINT=${LACONIC_HOSTED_ENDPOINT:-http://localhost:9473} + CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} + CERC_WEBAPP_FILES_DIR: ${CERC_WEBAPP_FILES_DIR:-/usr/local/share/.config/yarn/global/node_modules/@cerc-io/console-app/dist/production} + LACONIC_HOSTED_ENDPOINT: ${LACONIC_HOSTED_ENDPOINT:-http://localhost:9473} volumes: - - ../config/laconic-console/console/config.yml:/config.yml + - ../config/laconic-console/console/config.yml:/config/config.yml ports: - "80" diff --git a/stack-orchestrator/container-build/cerc-laconic-console-host/Dockerfile b/stack-orchestrator/container-build/cerc-laconic-console-host/Dockerfile index 2a7f015..c7be4b9 100644 --- a/stack-orchestrator/container-build/cerc-laconic-console-host/Dockerfile +++ b/stack-orchestrator/container-build/cerc-laconic-console-host/Dockerfile @@ -2,6 +2,9 @@ FROM cerc/webapp-base:local # Configure the cerc-io npm registry RUN npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/ +RUN npm config set @lirewine:registry https://git.vdb.to/api/packages/cerc-io/npm/ + +WORKDIR /app COPY . . @@ -9,4 +12,5 @@ RUN echo "Installing dependencies" && yarn RUN LACONIC_HOSTED_CONFIG_FILE=config-hosted.yml yarn dist RUN npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/ + RUN yarn global add file:$PWD diff --git a/stack-orchestrator/container-build/cerc-laconic-console-host/build.sh b/stack-orchestrator/container-build/cerc-laconic-console-host/build.sh index ee349e1..ef43944 100755 --- a/stack-orchestrator/container-build/cerc-laconic-console-host/build.sh +++ b/stack-orchestrator/container-build/cerc-laconic-console-host/build.sh @@ -1,9 +1,10 @@ #!/usr/bin/env bash -# Build cerc/laconic-registry-cli + +# Build cerc/laconic2-console-host source ${CERC_CONTAINER_BASE_DIR}/build-base.sh # See: https://stackoverflow.com/a/246128/1701505 SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -docker build -t cerc/laconic-console-host:local ${build_command_args} -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/laconic-console +docker build -t cerc/laconic2-console-host:local ${build_command_args} -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/laconic-console diff --git a/stack-orchestrator/stacks/laconic-console/README.md b/stack-orchestrator/stacks/laconic-console/README.md index 0e42463..8219312 100644 --- a/stack-orchestrator/stacks/laconic-console/README.md +++ b/stack-orchestrator/stacks/laconic-console/README.md @@ -35,7 +35,17 @@ Instructions for running laconic registry CLI and console * Create a spec file for the deployment: ```bash - laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console deploy init --output laconic-console-spec.yml + laconic-so --stack /home/prathamesh/deepstack/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console deploy init --output laconic-console-spec.yml + ``` + +* Edit `network` in the spec file to map container ports to host ports as required: + + ```bash + ... + network: + ports: + laconic-console: + - '8080:80' ``` * Create a deployment from the spec file: @@ -49,6 +59,18 @@ Instructions for running laconic registry CLI and console * Inside the deployment directory, open `config.env` file and set following env variables: ```bash - # TODO + # All optional + + CERC_LACONICD_RPC_ENDPOINT= + CERC_LACONICD_GQL_ENDPOINT= + CERC_CHAIN_ID= + CERC_LOGLEVEL= + + LACONIC_HOSTED_ENDPOINT= ``` +## Start the deployment + +```bash +laconic-so deployment --dir laconic-console-deployment start +``` -- 2.45.2 From f5060d3e22ca250d946c8e26a69b48b98890b08b Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 20 Jun 2024 12:20:30 +0530 Subject: [PATCH 06/12] Add laconic-console stack instructions --- .../docker-compose-laconic-console.yml | 13 +-- .../laconic-console/cli/create-config.sh | 12 +-- .../cerc-laconic2-registry-cli/Dockerfile | 3 +- .../stacks/laconic-console/README.md | 79 +++++++++++++++++-- 4 files changed, 88 insertions(+), 19 deletions(-) diff --git a/stack-orchestrator/compose/docker-compose-laconic-console.yml b/stack-orchestrator/compose/docker-compose-laconic-console.yml index 1fe36f1..ec97b53 100644 --- a/stack-orchestrator/compose/docker-compose-laconic-console.yml +++ b/stack-orchestrator/compose/docker-compose-laconic-console.yml @@ -1,19 +1,22 @@ services: cli: image: cerc/laconic2-registry-cli:local + command: ["bash", "-c", "/app/create-config.sh && tail -f /dev/null"] environment: - CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} CERC_LACONICD_RPC_ENDPOINT: ${CERC_LACONICD_RPC_ENDPOINT:-http://laconicd:26657} CERC_LACONICD_GQL_ENDPOINT: ${CERC_LACONICD_GQL_ENDPOINT:-http://laconicd:9473/api} - CERC_CHAIN_ID: ${CERC_CHAIN_ID:-laconic_9000-1} - CERC_LOGLEVEL: ${CERC_LOGLEVEL:-info} + CERC_LACONICD_CHAIN_ID: ${CERC_LACONICD_CHAIN_ID:-laconic_9000-1} + CERC_LACONICD_USER_KEY: ${CERC_LACONICD_USER_KEY} + CERC_LACONICD_BOND_ID: ${CERC_LACONICD_BOND_ID} + CERC_LACONICD_GAS: ${CERC_LACONICD_GAS:-200000} + CERC_LACONICD_FEES: ${CERC_LACONICD_FEES:-200000photon} volumes: - - ../config/laconic-console/create-config.sh:/app/create-config.sh + - ../config/laconic-console/cli/create-config.sh:/app/create-config.sh - laconic-registry-data:/laconic-registry-data extra_hosts: - "host.docker.internal:host-gateway" - laconic-console: + console: restart: unless-stopped image: cerc/laconic2-console-host:local environment: diff --git a/stack-orchestrator/config/laconic-console/cli/create-config.sh b/stack-orchestrator/config/laconic-console/cli/create-config.sh index c80be8a..a57ef0d 100755 --- a/stack-orchestrator/config/laconic-console/cli/create-config.sh +++ b/stack-orchestrator/config/laconic-console/cli/create-config.sh @@ -13,9 +13,11 @@ services: registry: rpcEndpoint: ${CERC_LACONICD_RPC_ENDPOINT} gqlEndpoint: ${CERC_LACONICD_GQL_ENDPOINT} - userKey: ${CERC_USER_KEY} - bondId: ${CERC_BOND_ID} - chainId: ${CERC_CHAIN_ID} - gas: 200000 - fees: 200000photon + userKey: ${CERC_LACONICD_USER_KEY} + bondId: ${CERC_LACONICD_BOND_ID} + chainId: ${CERC_LACONICD_CHAIN_ID} + gas: ${CERC_LACONICD_GAS} + fees: ${CERC_LACONICD_FEES} EOF + +echo "Exported config to $config_file" diff --git a/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile b/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile index 2449066..e3ad75d 100644 --- a/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile +++ b/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile @@ -16,4 +16,5 @@ RUN echo "Installing dependencies and building laconic-registry-cli" && \ RUN npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/ RUN yarn global add file:$PWD -CMD ["bash", "-c", "tail -f /dev/null"] +# Default command sleeps forever so docker doesn't kill it +CMD ["bash", "-c", "while :; do sleep 600; done"] diff --git a/stack-orchestrator/stacks/laconic-console/README.md b/stack-orchestrator/stacks/laconic-console/README.md index 8219312..12db5ec 100644 --- a/stack-orchestrator/stacks/laconic-console/README.md +++ b/stack-orchestrator/stacks/laconic-console/README.md @@ -61,16 +61,79 @@ Instructions for running laconic registry CLI and console ```bash # All optional - CERC_LACONICD_RPC_ENDPOINT= - CERC_LACONICD_GQL_ENDPOINT= - CERC_CHAIN_ID= - CERC_LOGLEVEL= + # CLI configuration + # laconicd RPC endpoint (default: http://laconicd:26657) + CERC_LACONICD_RPC_ENDPOINT= + + # laconicd GQL endpoint (default: http://laconicd:9473/api) + CERC_LACONICD_GQL_ENDPOINT= + + # laconicd chain id (default: laconic_9000-1) + CERC_LACONICD_CHAIN_ID= + + # laconicd user private key for txs + CERC_LACONICD_USER_KEY= + + # laconicd bond id for txs + CERC_LACONICD_BOND_ID= + + # Gas limit for txs (default: 200000) + CERC_LACONICD_GAS= + + # Max fees for txs (default: 200000photon) + CERC_LACONICD_FEES= + + # Console configuration + + # Laconicd (hosted) GQL endpoint (default: http://localhost:9473) LACONIC_HOSTED_ENDPOINT= ``` -## Start the deployment +## Run -```bash -laconic-so deployment --dir laconic-console-deployment start -``` +* Start the deployment: + + ```bash + laconic-so deployment --dir laconic-console-deployment start + ``` + +* View the laconic console at + +* Use the `cli` service for registry CLI operations: + + ```bash + # Example + laconic-so --dir laconic-console-deployment deploy exec cli "laconic registry status" + ``` + +## Check status + +* To list down and monitor the running containers: + + ```bash + # With status + docker ps -a + + # Follow logs for console container + laconic-so deployment --dir laconic-console-deployment logs console -f + ``` + +## Clean up + +* Stop all services running in the background: + + ```bash + # Stop the docker containers + laconic-so deployment --dir laconic-console-deployment stop + ``` + +* To stop all services and also delete data: + + ```bash + # Stop the docker containers + laconic-so deployment --dir laconic-console-deployment stop --delete-volumes + + # Remove deployment directory (deployment will have to be recreated for a re-run) + rm -r laconic-console-deployment + ``` -- 2.45.2 From 2eb842083d191510a866f66e8e4acca5934a18d9 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 20 Jun 2024 12:52:48 +0530 Subject: [PATCH 07/12] Update testnet-laconicd stack instructions to include cli and console --- .../stacks/laconic-console/README.md | 4 +- .../stacks/testnet-laconicd/README.md | 70 +++++++++++++++++-- 2 files changed, 66 insertions(+), 8 deletions(-) diff --git a/stack-orchestrator/stacks/laconic-console/README.md b/stack-orchestrator/stacks/laconic-console/README.md index 12db5ec..8919c3e 100644 --- a/stack-orchestrator/stacks/laconic-console/README.md +++ b/stack-orchestrator/stacks/laconic-console/README.md @@ -35,7 +35,7 @@ Instructions for running laconic registry CLI and console * Create a spec file for the deployment: ```bash - laconic-so --stack /home/prathamesh/deepstack/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console deploy init --output laconic-console-spec.yml + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console deploy init --output laconic-console-spec.yml ``` * Edit `network` in the spec file to map container ports to host ports as required: @@ -104,7 +104,7 @@ Instructions for running laconic registry CLI and console ```bash # Example - laconic-so --dir laconic-console-deployment deploy exec cli "laconic registry status" + laconic-so deployment --dir laconic-console-deployment deploy exec cli "laconic registry status" ``` ## Check status diff --git a/stack-orchestrator/stacks/testnet-laconicd/README.md b/stack-orchestrator/stacks/testnet-laconicd/README.md index 8511c6a..dd5fbd1 100644 --- a/stack-orchestrator/stacks/testnet-laconicd/README.md +++ b/stack-orchestrator/stacks/testnet-laconicd/README.md @@ -1,4 +1,4 @@ -# laconicd-testnet +# testnet-laconicd Instructions for running a laconicd testnet full node and joining as a validator @@ -25,18 +25,29 @@ Instructions for running a laconicd testnet full node and joining as a validator * Clone required repositories: ```bash + # laconicd laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd setup-repositories + + # laocnic cli and console + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console setup-repositories ``` * Build the container images: ```bash + # laconicd laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd build-containers + + # laocnic cli and console + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console build-containers ``` This should create the following docker images locally: * `cerc/laconic2d` + * `cerc/laconic2-registry-cli` + * `cerc/webapp-base` + * `cerc/laconic-console-host` ## Create a deployment @@ -44,11 +55,14 @@ Instructions for running a laconicd testnet full node and joining as a validator ```bash laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd deploy init --output testnet-laconicd-spec.yml + + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console deploy init --output laconic-console-spec.yml ``` -* Edit `network` in the spec file to map container ports to host ports as required: +* Edit `network` in both the spec files to map container ports to host ports as required: ```bash + # testnet-laconicd-spec.yml ... network: ports: @@ -59,12 +73,24 @@ Instructions for running a laconicd testnet full node and joining as a validator - '9473:9473' - '9090:9090' - '1317:1317' + + # laconic-console-spec.yml + ... + network: + ports: + laconic-console: + - '8080:80' ``` -* Create a deployment from the spec file: +* Create deployments from the spec files: ```bash laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd deploy create --spec-file testnet-laconicd-spec.yml --deployment-dir testnet-laconicd-deployment + + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console deploy create --spec-file laconic-console-spec.yml --deployment-dir laconic-console-deployment + + # Place them both in the same namespace (cluster) + cp testnet-laconicd-deployment/deployment.yml laconic-console-deployment/deployment.yml ``` * Copy over the published testnet genesis file (`.json`) to data directory in deployment (`testnet-laconicd-deployment/data/laconicd-data/tmp`): @@ -77,7 +103,7 @@ Instructions for running a laconicd testnet full node and joining as a validator ## Configuration -* Inside the deployment directory, open `config.env` file and set following env variables: +* Inside the `testnet-laconicd-deployment` deployment directory, open `config.env` file and set following env variables: ```bash # Comma separated list of nodes to keep persistent connections to @@ -96,10 +122,31 @@ Instructions for running a laconicd testnet full node and joining as a validator CERC_LOGLEVEL= ``` -## Start the deployment +* Inside the `laconic-console-deployment` deployment directory, open `config.env` file and set following env variables: + + ```bash + # CLI configuration + + # laconicd chain id (default: laconic_9000-1) + CERC_LACONICD_CHAIN_ID= + + # Gas limit for txs (default: 200000) + CERC_LACONICD_GAS= + + # Max fees for txs (default: 200000photon) + CERC_LACONICD_FEES= + + # Console configuration + + # Laconicd (hosted) GQL endpoint (default: http://localhost:9473) + LACONIC_HOSTED_ENDPOINT= + ``` + +## Start the deployments ```bash laconic-so deployment --dir testnet-laconicd-deployment start +laconic-so deployment --dir laconic-console-deployment start ``` ## Check status @@ -122,6 +169,15 @@ laconic-so deployment --dir testnet-laconicd-deployment start # `catching_up: false` indicates that node is completely synced ``` +* View the laconic console at + +* Use the cli service for registry CLI operations: + + ```bash + # Example + laconic-so deployment --dir laconic-console-deployment deploy exec cli "laconic registry status" + ``` + ## Join as testnet validator * Create / import a new key pair: @@ -181,7 +237,7 @@ laconic-so deployment --dir testnet-laconicd-deployment start ## Clean up -* Stop all services running in the background: +* Stop all `testnet-laconicd` services running in the background: ```bash # Stop the docker containers @@ -197,3 +253,5 @@ laconic-so deployment --dir testnet-laconicd-deployment start # Remove deployment directory (deployment will have to be recreated for a re-run) rm -r testnet-laconicd-deployment ``` + +* For `laconic-console`, see [laconic-console clean up](../laconic-console/README.md#clean-up) -- 2.45.2 From d12266ce440d3c5a083f59f8afeef0685b4d6240 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 20 Jun 2024 13:10:56 +0530 Subject: [PATCH 08/12] Update root README --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7305d1b..13248d2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # testnet-laconicd-stack -Stacks to run nodes for laconic-testnet +Stacks to run a node for laconic testnet -- [Stack documentation](./stack-orchestrator/stacks/testnet-laconicd/README.md) +- [testnet-laconicd stack documentation](stack-orchestrator/stacks/testnet-laconicd/README.md) +- [laconic-console stack documentation](stack-orchestrator/stacks/laconic-console/README.md) (to run laconic registry and console standalone) -- 2.45.2 From 5497d385e113fed49f27abff0fabe719a3f049bf Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 20 Jun 2024 13:22:57 +0530 Subject: [PATCH 09/12] Rename laconic console Docker image name --- stack-orchestrator/compose/docker-compose-testnet-laconicd.yml | 2 +- .../config/laconicd/{scripts => }/run-laconicd.sh | 0 .../Dockerfile | 2 +- .../build.sh | 0 stack-orchestrator/stacks/laconic-console/README.md | 2 ++ stack-orchestrator/stacks/laconic-console/stack.yml | 2 +- stack-orchestrator/stacks/testnet-laconicd/README.md | 2 +- 7 files changed, 6 insertions(+), 4 deletions(-) rename stack-orchestrator/config/laconicd/{scripts => }/run-laconicd.sh (100%) rename stack-orchestrator/container-build/{cerc-laconic-console-host => cerc-laconic2-console-host}/Dockerfile (84%) rename stack-orchestrator/container-build/{cerc-laconic-console-host => cerc-laconic2-console-host}/build.sh (100%) diff --git a/stack-orchestrator/compose/docker-compose-testnet-laconicd.yml b/stack-orchestrator/compose/docker-compose-testnet-laconicd.yml index 83b378e..9e22cf8 100644 --- a/stack-orchestrator/compose/docker-compose-testnet-laconicd.yml +++ b/stack-orchestrator/compose/docker-compose-testnet-laconicd.yml @@ -10,7 +10,7 @@ services: CERC_LOGLEVEL: ${CERC_LOGLEVEL:-info} volumes: - laconicd-data:/root/.laconicd - - ../config/laconicd/scripts/run-laconicd.sh:/opt/run-laconicd.sh + - ../config/laconicd/run-laconicd.sh:/opt/run-laconicd.sh ports: - "6060" - "26657" diff --git a/stack-orchestrator/config/laconicd/scripts/run-laconicd.sh b/stack-orchestrator/config/laconicd/run-laconicd.sh similarity index 100% rename from stack-orchestrator/config/laconicd/scripts/run-laconicd.sh rename to stack-orchestrator/config/laconicd/run-laconicd.sh diff --git a/stack-orchestrator/container-build/cerc-laconic-console-host/Dockerfile b/stack-orchestrator/container-build/cerc-laconic2-console-host/Dockerfile similarity index 84% rename from stack-orchestrator/container-build/cerc-laconic-console-host/Dockerfile rename to stack-orchestrator/container-build/cerc-laconic2-console-host/Dockerfile index c7be4b9..a989f24 100644 --- a/stack-orchestrator/container-build/cerc-laconic-console-host/Dockerfile +++ b/stack-orchestrator/container-build/cerc-laconic2-console-host/Dockerfile @@ -9,7 +9,7 @@ WORKDIR /app COPY . . RUN echo "Installing dependencies" && yarn -RUN LACONIC_HOSTED_CONFIG_FILE=config-hosted.yml yarn dist +RUN echo "Building" && LACONIC_HOSTED_CONFIG_FILE=config-hosted.yml yarn dist RUN npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/ diff --git a/stack-orchestrator/container-build/cerc-laconic-console-host/build.sh b/stack-orchestrator/container-build/cerc-laconic2-console-host/build.sh similarity index 100% rename from stack-orchestrator/container-build/cerc-laconic-console-host/build.sh rename to stack-orchestrator/container-build/cerc-laconic2-console-host/build.sh diff --git a/stack-orchestrator/stacks/laconic-console/README.md b/stack-orchestrator/stacks/laconic-console/README.md index 8919c3e..52ec118 100644 --- a/stack-orchestrator/stacks/laconic-console/README.md +++ b/stack-orchestrator/stacks/laconic-console/README.md @@ -29,6 +29,8 @@ Instructions for running laconic registry CLI and console This should create the following docker images locally: * `cerc/laconic2-registry-cli` + * `cerc/webapp-base` + * `cerc/laconic2-console-host` ## Create a deployment diff --git a/stack-orchestrator/stacks/laconic-console/stack.yml b/stack-orchestrator/stacks/laconic-console/stack.yml index a25eca7..f03007f 100644 --- a/stack-orchestrator/stacks/laconic-console/stack.yml +++ b/stack-orchestrator/stacks/laconic-console/stack.yml @@ -7,6 +7,6 @@ repos: containers: - cerc/laconic2-registry-cli - cerc/webapp-base - - cerc/laconic-console-host + - cerc/laconic2-console-host pods: - laconic-console diff --git a/stack-orchestrator/stacks/testnet-laconicd/README.md b/stack-orchestrator/stacks/testnet-laconicd/README.md index dd5fbd1..0585aa7 100644 --- a/stack-orchestrator/stacks/testnet-laconicd/README.md +++ b/stack-orchestrator/stacks/testnet-laconicd/README.md @@ -47,7 +47,7 @@ Instructions for running a laconicd testnet full node and joining as a validator * `cerc/laconic2d` * `cerc/laconic2-registry-cli` * `cerc/webapp-base` - * `cerc/laconic-console-host` + * `cerc/laconic2-console-host` ## Create a deployment -- 2.45.2 From 8b28a3303cc6a809db97d4fe50199226ebd0d0bd Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 20 Jun 2024 15:56:55 +0530 Subject: [PATCH 10/12] Add instructions for performing txs to the testnet stack --- .../config/laconicd/run-laconicd.sh | 7 ++++- .../cerc-laconic2-registry-cli/Dockerfile | 2 +- .../stacks/laconic-console/README.md | 4 +-- .../stacks/testnet-laconicd/README.md | 31 ++++++++++++++++--- 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/stack-orchestrator/config/laconicd/run-laconicd.sh b/stack-orchestrator/config/laconicd/run-laconicd.sh index 99e7998..3ae415f 100755 --- a/stack-orchestrator/config/laconicd/run-laconicd.sh +++ b/stack-orchestrator/config/laconicd/run-laconicd.sh @@ -44,4 +44,9 @@ fi sed -i "s/^persistent_peers *=.*/persistent_peers = \"$CERC_PEERS\"/g" $NODE_HOME/config/config.toml echo "Starting laconicd node..." -laconicd start --gql-playground --gql-server --log_level $CERC_LOGLEVEL --home $NODE_HOME +laconicd start \ + --api.enable \ + --rpc.laddr="tcp://0.0.0.0:26657" \ + --gql-playground --gql-server \ + --log_level $CERC_LOGLEVEL \ + --home $NODE_HOME diff --git a/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile b/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile index e3ad75d..91acc38 100644 --- a/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile +++ b/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile @@ -3,7 +3,7 @@ ARG VARIANT=18-bullseye FROM node:${VARIANT} RUN apt-get update \ - && apt-get -y install --no-install-recommends python3 jq bash curl + && apt-get -y install --no-install-recommends python3 jq bash curl nano WORKDIR /app diff --git a/stack-orchestrator/stacks/laconic-console/README.md b/stack-orchestrator/stacks/laconic-console/README.md index 52ec118..3513bf2 100644 --- a/stack-orchestrator/stacks/laconic-console/README.md +++ b/stack-orchestrator/stacks/laconic-console/README.md @@ -53,7 +53,7 @@ Instructions for running laconic registry CLI and console * Create a deployment from the spec file: ```bash - laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console deploy create --spec-file laconic-console-spec.yml --deployment-dir laconic-console-deployment + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console deploy create --spec-file laconic-console-spec.yml --deployment-dir laconic-console-deployment ``` ## Configuration @@ -106,7 +106,7 @@ Instructions for running laconic registry CLI and console ```bash # Example - laconic-so deployment --dir laconic-console-deployment deploy exec cli "laconic registry status" + laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry status" ``` ## Check status diff --git a/stack-orchestrator/stacks/testnet-laconicd/README.md b/stack-orchestrator/stacks/testnet-laconicd/README.md index 0585aa7..66ef4b6 100644 --- a/stack-orchestrator/stacks/testnet-laconicd/README.md +++ b/stack-orchestrator/stacks/testnet-laconicd/README.md @@ -78,16 +78,16 @@ Instructions for running a laconicd testnet full node and joining as a validator ... network: ports: - laconic-console: + console: - '8080:80' ``` * Create deployments from the spec files: ```bash - laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd deploy create --spec-file testnet-laconicd-spec.yml --deployment-dir testnet-laconicd-deployment + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd deploy create --spec-file testnet-laconicd-spec.yml --deployment-dir testnet-laconicd-deployment - laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console deploy create --spec-file laconic-console-spec.yml --deployment-dir laconic-console-deployment + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console deploy create --spec-file laconic-console-spec.yml --deployment-dir laconic-console-deployment # Place them both in the same namespace (cluster) cp testnet-laconicd-deployment/deployment.yml laconic-console-deployment/deployment.yml @@ -142,6 +142,8 @@ Instructions for running a laconicd testnet full node and joining as a validator LACONIC_HOSTED_ENDPOINT= ``` + Note: Use `host.docker.internal` as host to access ports on the host machine + ## Start the deployments ```bash @@ -175,7 +177,7 @@ laconic-so deployment --dir laconic-console-deployment start ```bash # Example - laconic-so deployment --dir laconic-console-deployment deploy exec cli "laconic registry status" + laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry status" ``` ## Join as testnet validator @@ -235,6 +237,27 @@ laconic-so deployment --dir laconic-console-deployment start laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd query staking validator " ``` +## Perform operations + +* To perform txs against the chain using registry CLI, set your private key in config in the CLI container: + + ```bash + # (Optional) Get the PK from your node + laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd keys export --unarmored-hex --unsafe" + + # Set your PK as 'userKey' in the config file + laconic-so deployment --dir laconic-console-deployment exec cli "nano config.yml" + + # Note: any changes made to the config will be lost when the cli Docker container is brought down + ``` + +* Adjust / set other config values (`bondId`, `gas`, `fees`) as required and perform txs: + + ```bash + # Example + laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry bond create --type photon --quantity 100000000000" + ``` + ## Clean up * Stop all `testnet-laconicd` services running in the background: -- 2.45.2 From a915c6f8baf0bf462c80be0335b7492f19a22fef Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Fri, 21 Jun 2024 10:03:52 +0530 Subject: [PATCH 11/12] Update CLI config after creating account and bond --- .../cerc-laconic2-registry-cli/Dockerfile | 2 +- stack-orchestrator/stacks/testnet-laconicd/README.md | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile b/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile index 91acc38..603cda5 100644 --- a/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile +++ b/stack-orchestrator/container-build/cerc-laconic2-registry-cli/Dockerfile @@ -1,4 +1,4 @@ -# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster +# Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster ARG VARIANT=18-bullseye FROM node:${VARIANT} diff --git a/stack-orchestrator/stacks/testnet-laconicd/README.md b/stack-orchestrator/stacks/testnet-laconicd/README.md index 66ef4b6..3f950d0 100644 --- a/stack-orchestrator/stacks/testnet-laconicd/README.md +++ b/stack-orchestrator/stacks/testnet-laconicd/README.md @@ -125,11 +125,19 @@ Instructions for running a laconicd testnet full node and joining as a validator * Inside the `laconic-console-deployment` deployment directory, open `config.env` file and set following env variables: ```bash + # All optional + # CLI configuration # laconicd chain id (default: laconic_9000-1) CERC_LACONICD_CHAIN_ID= + # laconicd user private key for txs + CERC_LACONICD_USER_KEY= + + # laconicd bond id for txs + CERC_LACONICD_BOND_ID= + # Gas limit for txs (default: 200000) CERC_LACONICD_GAS= @@ -249,6 +257,7 @@ laconic-so deployment --dir laconic-console-deployment start laconic-so deployment --dir laconic-console-deployment exec cli "nano config.yml" # Note: any changes made to the config will be lost when the cli Docker container is brought down + # So set / update the values in 'laconic-console-deployment/config.env' accordingly before restarting ``` * Adjust / set other config values (`bondId`, `gas`, `fees`) as required and perform txs: -- 2.45.2 From 8ca9257af7a5d0e757a89607f4cf103741f9c8b8 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Fri, 21 Jun 2024 10:59:06 +0530 Subject: [PATCH 12/12] Fix root README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 13248d2..bb069fe 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,4 @@ Stacks to run a node for laconic testnet - [testnet-laconicd stack documentation](stack-orchestrator/stacks/testnet-laconicd/README.md) -- [laconic-console stack documentation](stack-orchestrator/stacks/laconic-console/README.md) (to run laconic registry and console standalone) +- [laconic-console stack documentation](stack-orchestrator/stacks/laconic-console/README.md) (to run laconic registry CLI and console standalone) -- 2.45.2