From 3529bdf0958b7fc9e5b67efaedcfcdddc649eb93 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Fri, 23 May 2025 09:36:55 +0530 Subject: [PATCH 01/12] Set default network to laconic --- context/ChainsContext/helpers.tsx | 4 ++-- context/ChainsContext/index.tsx | 2 +- context/ChainsContext/service.tsx | 2 +- context/ChainsContext/storage.tsx | 5 ----- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/context/ChainsContext/helpers.tsx b/context/ChainsContext/helpers.tsx index a679714..20d1cd8 100644 --- a/context/ChainsContext/helpers.tsx +++ b/context/ChainsContext/helpers.tsx @@ -19,7 +19,7 @@ export const emptyChain: ChainInfo = { export const isChainInfoFilled = (chain: Partial): chain is ChainInfo => Boolean( chain.registryName && - typeof chain.logo === "string" && + // typeof chain.logo === "string" && chain.chainId && chain.chainDisplayName && typeof chain.nodeAddress === "string" && @@ -28,7 +28,7 @@ export const isChainInfoFilled = (chain: Partial): chain is ChainInfo chain.displayDenom && Number.isSafeInteger(chain.displayDenomExponent) && typeof chain.displayDenomExponent === "number" && - chain.displayDenomExponent >= 0 && + // chain.displayDenomExponent >= 0 && chain.assets?.length && chain.gasPrice && chain.addressPrefix, diff --git a/context/ChainsContext/index.tsx b/context/ChainsContext/index.tsx index 9b83ca6..aba3363 100644 --- a/context/ChainsContext/index.tsx +++ b/context/ChainsContext/index.tsx @@ -78,7 +78,7 @@ export const ChainsProvider = ({ children }: ChainsProviderProps) => { const loadedChain = getChain(chainItems); if (chainItems.mainnets.size && loadedChain === emptyChain) { - setChain(dispatch, chainItems.mainnets.get("cosmoshub") ?? emptyChain); + setChain(dispatch, emptyChain); } else { setChain(dispatch, loadedChain); } diff --git a/context/ChainsContext/service.tsx b/context/ChainsContext/service.tsx index 0e274c9..dd395f7 100644 --- a/context/ChainsContext/service.tsx +++ b/context/ChainsContext/service.tsx @@ -107,7 +107,7 @@ export const getChain = (chains: ChainItems) => { const urlChain = getChainFromUrl(chainNameFromUrl); const envfileChain = getChainFromEnvfile(chainNameFromUrl); const storedChain = getChainFromStorage( - chainNameFromUrl || envfileChain.registryName || "cosmoshub", + chainNameFromUrl || envfileChain.registryName || "laconic", chains, ); diff --git a/context/ChainsContext/storage.tsx b/context/ChainsContext/storage.tsx index f5e80da..d530a92 100644 --- a/context/ChainsContext/storage.tsx +++ b/context/ChainsContext/storage.tsx @@ -142,11 +142,6 @@ export const getChainFromUrl = (chainName: string) => { }; export const getChainFromEnvfile = (chainName: string) => { - const registryName = process.env.NEXT_PUBLIC_REGISTRY_NAME || ""; - if (chainName && registryName !== chainName) { - return { registryName: chainName }; - } - const logo = process.env.NEXT_PUBLIC_LOGO; const chainId = process.env.NEXT_PUBLIC_CHAIN_ID; const chainDisplayName = process.env.NEXT_PUBLIC_CHAIN_DISPLAY_NAME; -- 2.45.2 From 8f6faddb1ae14daad664dd45c9cb217aea961110 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Fri, 23 May 2025 12:21:28 +0530 Subject: [PATCH 02/12] Add env for enabling http URL --- context/ChainsContext/service.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/context/ChainsContext/service.tsx b/context/ChainsContext/service.tsx index dd395f7..12e7a12 100644 --- a/context/ChainsContext/service.tsx +++ b/context/ChainsContext/service.tsx @@ -71,10 +71,15 @@ export const useChainsFromRegistry = () => { }; export const getNodeFromArray = async (nodeArray: readonly string[]) => { - // only return https connections - const secureNodes = nodeArray - .filter((address) => address.startsWith("https://")) - .map((address) => address); + let secureNodes: readonly string[] = []; + + if (process.env.NEXT_PUBLIC_IS_HTTP_ENABLED === "true") { + // Allow all nodes, HTTP or HTTPS + secureNodes = nodeArray; + } else { + // Filter only HTTPS nodes + secureNodes = nodeArray.filter((address) => address.startsWith("https://")); + } if (!secureNodes.length) { throw new Error("No SSL enabled RPC nodes available for this chain"); -- 2.45.2 From a940607270537671b5c7abe636eba5bbb675c435 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Fri, 23 May 2025 12:36:22 +0530 Subject: [PATCH 03/12] Add stack for app --- .../docker-compose-cosmos-multisig-ui.yml | 63 ++++++++++++++ .../config/cosmos-multisig-ui/run.sh | 17 ++++ .../cerc-cosmos-multisig-ui/Dockerfile | 41 +++++++++ .../cerc-cosmos-multisig-ui/build.sh | 10 +++ .../stacks/cosmos-multisig-ui/README.md | 87 +++++++++++++++++++ .../stacks/cosmos-multisig-ui/stack.yml | 9 ++ 6 files changed, 227 insertions(+) create mode 100644 stack-orchestrator/compose/docker-compose-cosmos-multisig-ui.yml create mode 100644 stack-orchestrator/config/cosmos-multisig-ui/run.sh create mode 100644 stack-orchestrator/container-build/cerc-cosmos-multisig-ui/Dockerfile create mode 100755 stack-orchestrator/container-build/cerc-cosmos-multisig-ui/build.sh create mode 100644 stack-orchestrator/stacks/cosmos-multisig-ui/README.md create mode 100644 stack-orchestrator/stacks/cosmos-multisig-ui/stack.yml diff --git a/stack-orchestrator/compose/docker-compose-cosmos-multisig-ui.yml b/stack-orchestrator/compose/docker-compose-cosmos-multisig-ui.yml new file mode 100644 index 0000000..752e507 --- /dev/null +++ b/stack-orchestrator/compose/docker-compose-cosmos-multisig-ui.yml @@ -0,0 +1,63 @@ +version: '3.8' + +services: + zero: + image: dgraph/dgraph:latest + volumes: + - ./data/zero:/dgraph + ports: + - "5080:5080" + - "6080:6080" + restart: on-failure + command: dgraph zero --my=zero:5080 + + alpha: + image: dgraph/dgraph:latest + depends_on: + - zero + volumes: + - ./data/alpha:/dgraph + ports: + - "8080:8080" + - "9080:9080" + restart: on-failure + command: dgraph alpha --my=alpha:7080 --zero=zero:5080 --security "whitelist=0.0.0.0/0" + + ratel: + image: dgraph/ratel:latest + ports: + - "8000:8000" + depends_on: + - alpha + + cosmos-multisig-ui: + image: cerc/cosmos-multisig-ui:local + restart: unless-stopped + depends_on: + - alpha + environment: + DGRAPH_URL: ${DGRAPH_URL:-http://alpha:8080/graphql} + NEXT_PUBLIC_MULTICHAIN: ${NEXT_PUBLIC_MULTICHAIN:-true} + NEXT_PUBLIC_REGISTRY_NAME: ${NEXT_PUBLIC_REGISTRY_NAME:-laconic} + NEXT_PUBLIC_LOGO: ${NEXT_PUBLIC_LOGO:-""} + NEXT_PUBLIC_CHAIN_ID: ${NEXT_PUBLIC_CHAIN_ID:-"laconic_9000-1"} + NEXT_PUBLIC_CHAIN_DISPLAY_NAME: ${NEXT_PUBLIC_CHAIN_DISPLAY_NAME:-"Laconic Network"} + NEXT_PUBLIC_NODE_ADDRESSES: ${NEXT_PUBLIC_NODE_ADDRESSES:-["https://8d1e-14-140-185-73.ngrok-free.app"]} + NEXT_PUBLIC_DENOM: ${NEXT_PUBLIC_DENOM:-"alnt"} + NEXT_PUBLIC_DISPLAY_DENOM: ${NEXT_PUBLIC_DISPLAY_DENOM:-"ALNT"} + NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT: ${NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT:-"18"} + NEXT_PUBLIC_ASSETS: ${NEXT_PUBLIC_ASSETS} + NEXT_PUBLIC_GAS_PRICE: ${NEXT_PUBLIC_GAS_PRICE:-"0.01alnt"} + NEXT_PUBLIC_ADDRESS_PREFIX: ${NEXT_PUBLIC_ADDRESS_PREFIX:-"laconic"} + NEXT_PUBLIC_IS_HTTP_ENABLED: ${NEXT_PUBLIC_IS_HTTP_ENABLED:-false} + command: ["bash", "/cosmos-script/run.sh"] + volumes: + - ../config/cosmos-multisig-ui/run.sh:/cosmos-script/run.sh + ports: + - "3000:3000" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:3000"] + interval: 20s + timeout: 5s + retries: 15 + start_period: 10s diff --git a/stack-orchestrator/config/cosmos-multisig-ui/run.sh b/stack-orchestrator/config/cosmos-multisig-ui/run.sh new file mode 100644 index 0000000..a4d0b1b --- /dev/null +++ b/stack-orchestrator/config/cosmos-multisig-ui/run.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -e +if [ -n "$CERC_SCRIPT_DEBUG" ]; then + set -x +fi + +echo "Using the following env variables:" +echo "NEXT_PUBLIC_IS_HTTP_ENABLED: ${NEXT_PUBLIC_IS_HTTP_ENABLED}" + +# Build with required env +NEXT_PUBLIC_IS_HTTP_ENABLED=$NEXT_PUBLIC_IS_HTTP_ENABLED + +npm install + +echo "Starting server..." +npm run dev diff --git a/stack-orchestrator/container-build/cerc-cosmos-multisig-ui/Dockerfile b/stack-orchestrator/container-build/cerc-cosmos-multisig-ui/Dockerfile new file mode 100644 index 0000000..f18a262 --- /dev/null +++ b/stack-orchestrator/container-build/cerc-cosmos-multisig-ui/Dockerfile @@ -0,0 +1,41 @@ +FROM node:20.11.0-bullseye + +ARG USERNAME=node +ARG NPM_GLOBAL=/usr/local/share/npm-global + +# Add NPM global to PATH and disable update notifier +ENV PATH=${NPM_GLOBAL}/bin:${PATH} +ENV NPM_CONFIG_UPDATE_NOTIFIER=false + +# Configure global npm install location and install CLI tools +RUN \ + if ! getent group 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}" \ + && su ${USERNAME} -c "umask 0002 && npm install -g http-server" \ + && npm cache clean --force > /dev/null 2>&1 + +# Install system packages +RUN apt-get update && DEBIAN_FRONTEND=noninteractive \ + apt-get -y install --no-install-recommends jq bash netcat curl \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Create script directory +RUN mkdir -p /cosmos-script + +# Set app working directory +WORKDIR /app + +# Copy app source code +COPY . . + +# Install app dependencies +RUN npm install --legacy-peer-deps + +EXPOSE 3000 diff --git a/stack-orchestrator/container-build/cerc-cosmos-multisig-ui/build.sh b/stack-orchestrator/container-build/cerc-cosmos-multisig-ui/build.sh new file mode 100755 index 0000000..eaf475b --- /dev/null +++ b/stack-orchestrator/container-build/cerc-cosmos-multisig-ui/build.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +# Build cerc/cosmos-multisig-ui + +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 ) +echo "SCRIPT_DIR: ${SCRIPT_DIR}" + +docker build -t cerc/cosmos-multisig-ui:local ${build_command_args} -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/cosmos-multisig-ui diff --git a/stack-orchestrator/stacks/cosmos-multisig-ui/README.md b/stack-orchestrator/stacks/cosmos-multisig-ui/README.md new file mode 100644 index 0000000..4ddbdeb --- /dev/null +++ b/stack-orchestrator/stacks/cosmos-multisig-ui/README.md @@ -0,0 +1,87 @@ +# cosmos-multisig-ui + +Instructions for running the `cosmos-multisig-ui` using [laconic-so](https://git.vdb.to/cerc-io/stack-orchestrator) + +## Setup + +* Clone the stack repo: + + ```bash + laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull + ``` + +* Setup required repositories: + + ```bash + laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/cosmos-multisig-ui setup-repositories --git-ssh --pull + + # If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories and re-run the command + ``` + +* Build the container image: + + ```bash + laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/cosmos-multisig-ui build-containers + ``` + + This should create the `cerc/cosmos-multisig-ui` image locally + +## Create a deployment + +* Create a spec file for the deployment: + + ```bash + laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/cosmos-multisig-ui deploy init --output cosmos-multisig-ui-spec.yml + ``` + +* Create a deployment from the spec file: + + ```bash + laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/cosmos-multisig-ui/ deploy create --spec-file cosmos-multisig-ui-spec.yml --deployment-dir cosmos-multisig-deployment + ``` + +## Start the deployment + +* Run: + + ```bash + laconic-so deployment --dir cosmos-multisig-deployment start + ``` + +* Check health status: + + ```bash + docker ps + ``` + +* Open the app in a browser at + +## Add graphql schema + +* Register the GraphQL schema in the Dgraph database + + ``` + cd ~/cerc/laconicd-stack/schema + curl -X POST localhost:8080/admin/schema -d '@db-schema.graphql' + ``` + +## Clean up + +* Stop the deployment: + + ```bash + laconic-so deployment --dir cosmos-multisig-deployment stop + ``` + +* Remove data: + + ```bash + # Remove deployment directory (deployment will have to be recreated for a re-run) + sudo rm -rf cosmos-multisig-deployment + ``` + +* Remove `cerc/cosmos-multisig-ui` image + + ```bash + docker rmi cerc/cosmos-multisig-ui:local + ``` diff --git a/stack-orchestrator/stacks/cosmos-multisig-ui/stack.yml b/stack-orchestrator/stacks/cosmos-multisig-ui/stack.yml new file mode 100644 index 0000000..9edfbf0 --- /dev/null +++ b/stack-orchestrator/stacks/cosmos-multisig-ui/stack.yml @@ -0,0 +1,9 @@ +version: "1.0" +name: cosmos-multisig-ui +description: "cosmos multisig UI" +repos: + - git.vdb.to/cerc-io/cosmos-multisig-ui@iv-default-laconic +containers: + - cerc/cosmos-multisig-ui +pods: + - cosmos-multisig-ui -- 2.45.2 From 044facddce9476bf7b719f6f80c4df08e3d50fee Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Fri, 23 May 2025 15:16:27 +0530 Subject: [PATCH 04/12] Create separate docker compose file for dgraph --- context/ChainsContext/helpers.tsx | 2 +- context/ChainsContext/index.tsx | 2 +- context/ChainsContext/service.tsx | 2 +- context/ChainsContext/storage.tsx | 5 ++ db-schema.graphql | 3 - .../docker-compose-cosmos-multisig-ui.yml | 60 +++++-------------- .../compose/docker-compose-dgraph.yml | 35 +++++++++++ .../config/cosmos-multisig-ui/run.sh | 9 ++- .../stacks/cosmos-multisig-ui/README.md | 18 ++---- .../stacks/cosmos-multisig-ui/stack.yml | 2 +- 10 files changed, 71 insertions(+), 67 deletions(-) create mode 100644 stack-orchestrator/compose/docker-compose-dgraph.yml diff --git a/context/ChainsContext/helpers.tsx b/context/ChainsContext/helpers.tsx index 20d1cd8..965bd73 100644 --- a/context/ChainsContext/helpers.tsx +++ b/context/ChainsContext/helpers.tsx @@ -28,7 +28,7 @@ export const isChainInfoFilled = (chain: Partial): chain is ChainInfo chain.displayDenom && Number.isSafeInteger(chain.displayDenomExponent) && typeof chain.displayDenomExponent === "number" && - // chain.displayDenomExponent >= 0 && + chain.displayDenomExponent >= 0 && chain.assets?.length && chain.gasPrice && chain.addressPrefix, diff --git a/context/ChainsContext/index.tsx b/context/ChainsContext/index.tsx index aba3363..9b83ca6 100644 --- a/context/ChainsContext/index.tsx +++ b/context/ChainsContext/index.tsx @@ -78,7 +78,7 @@ export const ChainsProvider = ({ children }: ChainsProviderProps) => { const loadedChain = getChain(chainItems); if (chainItems.mainnets.size && loadedChain === emptyChain) { - setChain(dispatch, emptyChain); + setChain(dispatch, chainItems.mainnets.get("cosmoshub") ?? emptyChain); } else { setChain(dispatch, loadedChain); } diff --git a/context/ChainsContext/service.tsx b/context/ChainsContext/service.tsx index 12e7a12..b6a2328 100644 --- a/context/ChainsContext/service.tsx +++ b/context/ChainsContext/service.tsx @@ -112,7 +112,7 @@ export const getChain = (chains: ChainItems) => { const urlChain = getChainFromUrl(chainNameFromUrl); const envfileChain = getChainFromEnvfile(chainNameFromUrl); const storedChain = getChainFromStorage( - chainNameFromUrl || envfileChain.registryName || "laconic", + chainNameFromUrl || envfileChain.registryName || "cosmoshub", chains, ); diff --git a/context/ChainsContext/storage.tsx b/context/ChainsContext/storage.tsx index d530a92..f5e80da 100644 --- a/context/ChainsContext/storage.tsx +++ b/context/ChainsContext/storage.tsx @@ -142,6 +142,11 @@ export const getChainFromUrl = (chainName: string) => { }; export const getChainFromEnvfile = (chainName: string) => { + const registryName = process.env.NEXT_PUBLIC_REGISTRY_NAME || ""; + if (chainName && registryName !== chainName) { + return { registryName: chainName }; + } + const logo = process.env.NEXT_PUBLIC_LOGO; const chainId = process.env.NEXT_PUBLIC_CHAIN_ID; const chainDisplayName = process.env.NEXT_PUBLIC_CHAIN_DISPLAY_NAME; diff --git a/db-schema.graphql b/db-schema.graphql index c362df6..2196eda 100644 --- a/db-schema.graphql +++ b/db-schema.graphql @@ -1,8 +1,5 @@ type Multisig { id: ID! - # The @search annotation allows us to query the list of multisigs and filter - # by (chainId, address) pairs. We use "hash" since we only need exact matches. - # See https://dgraph.io/docs/graphql/schema/directives/search/#string chainId: String! @search(by: [hash]) address: String! @search(by: [hash]) creator: String @search(by: [hash]) diff --git a/stack-orchestrator/compose/docker-compose-cosmos-multisig-ui.yml b/stack-orchestrator/compose/docker-compose-cosmos-multisig-ui.yml index 752e507..91ccd12 100644 --- a/stack-orchestrator/compose/docker-compose-cosmos-multisig-ui.yml +++ b/stack-orchestrator/compose/docker-compose-cosmos-multisig-ui.yml @@ -1,62 +1,34 @@ version: '3.8' services: - zero: - image: dgraph/dgraph:latest - volumes: - - ./data/zero:/dgraph - ports: - - "5080:5080" - - "6080:6080" - restart: on-failure - command: dgraph zero --my=zero:5080 - - alpha: - image: dgraph/dgraph:latest - depends_on: - - zero - volumes: - - ./data/alpha:/dgraph - ports: - - "8080:8080" - - "9080:9080" - restart: on-failure - command: dgraph alpha --my=alpha:7080 --zero=zero:5080 --security "whitelist=0.0.0.0/0" - - ratel: - image: dgraph/ratel:latest - ports: - - "8000:8000" - depends_on: - - alpha - cosmos-multisig-ui: image: cerc/cosmos-multisig-ui:local restart: unless-stopped depends_on: - alpha environment: - DGRAPH_URL: ${DGRAPH_URL:-http://alpha:8080/graphql} - NEXT_PUBLIC_MULTICHAIN: ${NEXT_PUBLIC_MULTICHAIN:-true} - NEXT_PUBLIC_REGISTRY_NAME: ${NEXT_PUBLIC_REGISTRY_NAME:-laconic} - NEXT_PUBLIC_LOGO: ${NEXT_PUBLIC_LOGO:-""} - NEXT_PUBLIC_CHAIN_ID: ${NEXT_PUBLIC_CHAIN_ID:-"laconic_9000-1"} - NEXT_PUBLIC_CHAIN_DISPLAY_NAME: ${NEXT_PUBLIC_CHAIN_DISPLAY_NAME:-"Laconic Network"} - NEXT_PUBLIC_NODE_ADDRESSES: ${NEXT_PUBLIC_NODE_ADDRESSES:-["https://8d1e-14-140-185-73.ngrok-free.app"]} - NEXT_PUBLIC_DENOM: ${NEXT_PUBLIC_DENOM:-"alnt"} - NEXT_PUBLIC_DISPLAY_DENOM: ${NEXT_PUBLIC_DISPLAY_DENOM:-"ALNT"} - NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT: ${NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT:-"18"} + DGRAPH_URL: ${DGRAPH_URL} + NEXT_PUBLIC_MULTICHAIN: ${NEXT_PUBLIC_MULTICHAIN} + NEXT_PUBLIC_REGISTRY_NAME: ${NEXT_PUBLIC_REGISTRY_NAME} + NEXT_PUBLIC_LOGO: ${NEXT_PUBLIC_LOGO} + NEXT_PUBLIC_CHAIN_ID: ${NEXT_PUBLIC_CHAIN_ID} + NEXT_PUBLIC_CHAIN_DISPLAY_NAME: ${NEXT_PUBLIC_CHAIN_DISPLAY_NAME} + NEXT_PUBLIC_NODE_ADDRESSES: ${NEXT_PUBLIC_NODE_ADDRESSES} + NEXT_PUBLIC_DENOM: ${NEXT_PUBLIC_DENOM} + NEXT_PUBLIC_DISPLAY_DENOM: ${NEXT_PUBLIC_DISPLAY_DENOM} + NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT: ${NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT} NEXT_PUBLIC_ASSETS: ${NEXT_PUBLIC_ASSETS} - NEXT_PUBLIC_GAS_PRICE: ${NEXT_PUBLIC_GAS_PRICE:-"0.01alnt"} - NEXT_PUBLIC_ADDRESS_PREFIX: ${NEXT_PUBLIC_ADDRESS_PREFIX:-"laconic"} - NEXT_PUBLIC_IS_HTTP_ENABLED: ${NEXT_PUBLIC_IS_HTTP_ENABLED:-false} + NEXT_PUBLIC_GAS_PRICE: ${NEXT_PUBLIC_GAS_PRICE} + NEXT_PUBLIC_ADDRESS_PREFIX: ${NEXT_PUBLIC_ADDRESS_PREFIX} + NEXT_PUBLIC_IS_HTTP_ENABLED: ${NEXT_PUBLIC_IS_HTTP_ENABLED} + NEXT_PUBLIC_EXPLORER_LINKS: ${NEXT_PUBLIC_EXPLORER_LINKS} command: ["bash", "/cosmos-script/run.sh"] volumes: - ../config/cosmos-multisig-ui/run.sh:/cosmos-script/run.sh ports: - - "3000:3000" + - "3000" healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:3000"] + test: ["CMD", "nc", "-vz", "127.0.0.1", "3000"] interval: 20s timeout: 5s retries: 15 diff --git a/stack-orchestrator/compose/docker-compose-dgraph.yml b/stack-orchestrator/compose/docker-compose-dgraph.yml new file mode 100644 index 0000000..649e48c --- /dev/null +++ b/stack-orchestrator/compose/docker-compose-dgraph.yml @@ -0,0 +1,35 @@ +version: '3.8' + +services: + zero: + image: dgraph/dgraph:latest + volumes: + - zero-data:/dgraph + ports: + - "5080:5080" + - "6080:6080" + restart: on-failure + command: dgraph zero --my=zero:5080 + + alpha: + image: dgraph/dgraph:latest + depends_on: + - zero + volumes: + - alpha-data:/dgraph + ports: + - "8080:8080" + - "9080:9080" + restart: on-failure + command: dgraph alpha --my=alpha:7080 --zero=zero:5080 --security "whitelist=0.0.0.0/0" + + ratel: + image: dgraph/ratel:latest + ports: + - "8000:8000" + depends_on: + - alpha + +volumes: + zero-data: + alpha-data: diff --git a/stack-orchestrator/config/cosmos-multisig-ui/run.sh b/stack-orchestrator/config/cosmos-multisig-ui/run.sh index a4d0b1b..ddd5b31 100644 --- a/stack-orchestrator/config/cosmos-multisig-ui/run.sh +++ b/stack-orchestrator/config/cosmos-multisig-ui/run.sh @@ -8,10 +8,13 @@ fi echo "Using the following env variables:" echo "NEXT_PUBLIC_IS_HTTP_ENABLED: ${NEXT_PUBLIC_IS_HTTP_ENABLED}" -# Build with required env NEXT_PUBLIC_IS_HTTP_ENABLED=$NEXT_PUBLIC_IS_HTTP_ENABLED +# Install dependencies npm install -echo "Starting server..." -npm run dev +# Build Next.js app +npm run build + +echo "Start app..." +npm run start diff --git a/stack-orchestrator/stacks/cosmos-multisig-ui/README.md b/stack-orchestrator/stacks/cosmos-multisig-ui/README.md index 4ddbdeb..a5055a4 100644 --- a/stack-orchestrator/stacks/cosmos-multisig-ui/README.md +++ b/stack-orchestrator/stacks/cosmos-multisig-ui/README.md @@ -7,21 +7,13 @@ Instructions for running the `cosmos-multisig-ui` using [laconic-so](https://git * Clone the stack repo: ```bash - laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull - ``` - -* Setup required repositories: - - ```bash - laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/cosmos-multisig-ui setup-repositories --git-ssh --pull - - # If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories and re-run the command + laconic-so fetch-stack git.vdb.to/cerc-io/cosmos-multisig-ui --git-ssh --pull ``` * Build the container image: ```bash - laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/cosmos-multisig-ui build-containers + laconic-so --stack ~/cerc/cosmos-multisig-ui/stack-orchestrator/stacks/cosmos-multisig-ui build-containers ``` This should create the `cerc/cosmos-multisig-ui` image locally @@ -31,13 +23,13 @@ Instructions for running the `cosmos-multisig-ui` using [laconic-so](https://git * Create a spec file for the deployment: ```bash - laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/cosmos-multisig-ui deploy init --output cosmos-multisig-ui-spec.yml + laconic-so --stack ~/cerc/cosmos-multisig-ui/stack-orchestrator/stacks/cosmos-multisig-ui deploy init --output cosmos-multisig-ui-spec.yml ``` * Create a deployment from the spec file: ```bash - laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/cosmos-multisig-ui/ deploy create --spec-file cosmos-multisig-ui-spec.yml --deployment-dir cosmos-multisig-deployment + laconic-so --stack ~/cerc/cosmos-multisig-ui/stack-orchestrator/stacks/cosmos-multisig-ui/ deploy create --spec-file cosmos-multisig-ui-spec.yml --deployment-dir cosmos-multisig-deployment ``` ## Start the deployment @@ -61,7 +53,7 @@ Instructions for running the `cosmos-multisig-ui` using [laconic-so](https://git * Register the GraphQL schema in the Dgraph database ``` - cd ~/cerc/laconicd-stack/schema + cd ~/cerc/cosmos-multisig-ui curl -X POST localhost:8080/admin/schema -d '@db-schema.graphql' ``` diff --git a/stack-orchestrator/stacks/cosmos-multisig-ui/stack.yml b/stack-orchestrator/stacks/cosmos-multisig-ui/stack.yml index 9edfbf0..dadfca2 100644 --- a/stack-orchestrator/stacks/cosmos-multisig-ui/stack.yml +++ b/stack-orchestrator/stacks/cosmos-multisig-ui/stack.yml @@ -2,8 +2,8 @@ version: "1.0" name: cosmos-multisig-ui description: "cosmos multisig UI" repos: - - git.vdb.to/cerc-io/cosmos-multisig-ui@iv-default-laconic containers: - cerc/cosmos-multisig-ui pods: - cosmos-multisig-ui + - dgraph -- 2.45.2 From 504fa39f650e8fa94157feae71f09a1bc7b4772b Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Mon, 26 May 2025 15:08:01 +0530 Subject: [PATCH 05/12] Use host network mode in multisig container --- .../docker-compose-cosmos-multisig-ui.yml | 31 ++++++++++--------- .../config/cosmos-multisig-ui/run.sh | 26 +++++++++++++--- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/stack-orchestrator/compose/docker-compose-cosmos-multisig-ui.yml b/stack-orchestrator/compose/docker-compose-cosmos-multisig-ui.yml index 91ccd12..69e7752 100644 --- a/stack-orchestrator/compose/docker-compose-cosmos-multisig-ui.yml +++ b/stack-orchestrator/compose/docker-compose-cosmos-multisig-ui.yml @@ -6,22 +6,23 @@ services: restart: unless-stopped depends_on: - alpha + network_mode: "host" environment: - DGRAPH_URL: ${DGRAPH_URL} - NEXT_PUBLIC_MULTICHAIN: ${NEXT_PUBLIC_MULTICHAIN} - NEXT_PUBLIC_REGISTRY_NAME: ${NEXT_PUBLIC_REGISTRY_NAME} - NEXT_PUBLIC_LOGO: ${NEXT_PUBLIC_LOGO} - NEXT_PUBLIC_CHAIN_ID: ${NEXT_PUBLIC_CHAIN_ID} - NEXT_PUBLIC_CHAIN_DISPLAY_NAME: ${NEXT_PUBLIC_CHAIN_DISPLAY_NAME} - NEXT_PUBLIC_NODE_ADDRESSES: ${NEXT_PUBLIC_NODE_ADDRESSES} - NEXT_PUBLIC_DENOM: ${NEXT_PUBLIC_DENOM} - NEXT_PUBLIC_DISPLAY_DENOM: ${NEXT_PUBLIC_DISPLAY_DENOM} - NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT: ${NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT} - NEXT_PUBLIC_ASSETS: ${NEXT_PUBLIC_ASSETS} - NEXT_PUBLIC_GAS_PRICE: ${NEXT_PUBLIC_GAS_PRICE} - NEXT_PUBLIC_ADDRESS_PREFIX: ${NEXT_PUBLIC_ADDRESS_PREFIX} - NEXT_PUBLIC_IS_HTTP_ENABLED: ${NEXT_PUBLIC_IS_HTTP_ENABLED} - NEXT_PUBLIC_EXPLORER_LINKS: ${NEXT_PUBLIC_EXPLORER_LINKS} + DGRAPH_URL: ${DGRAPH_URL:-http://localhost:8080/graphql} + NEXT_PUBLIC_MULTICHAIN: "true" + NEXT_PUBLIC_REGISTRY_NAME: "laconic" + NEXT_PUBLIC_LOGO: "" + NEXT_PUBLIC_CHAIN_ID: "laconic_9000-1" + NEXT_PUBLIC_CHAIN_DISPLAY_NAME: "Laconic Network" + NEXT_PUBLIC_NODE_ADDRESSES: '["http://localhost:26657"]' + NEXT_PUBLIC_DENOM: "alnt" + NEXT_PUBLIC_DISPLAY_DENOM: "ALNT" + NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT: "18" + NEXT_PUBLIC_ASSETS: > + [{"denom_units":[{"denom":"alnt","exponent":0},{"denom":"alnt","exponent":6}],"base":"alnt","name":"Laconic Token","display":"ALNT","symbol":"alnt"}] + NEXT_PUBLIC_GAS_PRICE: "0.01alnt" + NEXT_PUBLIC_ADDRESS_PREFIX: "laconic" + NEXT_PUBLIC_IS_HTTP_ENABLED: "true" command: ["bash", "/cosmos-script/run.sh"] volumes: - ../config/cosmos-multisig-ui/run.sh:/cosmos-script/run.sh diff --git a/stack-orchestrator/config/cosmos-multisig-ui/run.sh b/stack-orchestrator/config/cosmos-multisig-ui/run.sh index ddd5b31..2913f64 100644 --- a/stack-orchestrator/config/cosmos-multisig-ui/run.sh +++ b/stack-orchestrator/config/cosmos-multisig-ui/run.sh @@ -6,15 +6,33 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then fi echo "Using the following env variables:" +echo "NEXT_PUBLIC_CHAIN_ID: ${NEXT_PUBLIC_CHAIN_ID}" +echo "NEXT_PUBLIC_CHAIN_DISPLAY_NAME: ${NEXT_PUBLIC_CHAIN_DISPLAY_NAME}" +echo "NEXT_PUBLIC_NODE_ADDRESSES: ${NEXT_PUBLIC_NODE_ADDRESSES}" +echo "NEXT_PUBLIC_DENOM: ${NEXT_PUBLIC_DENOM}" +echo "NEXT_PUBLIC_DISPLAY_DENOM: ${NEXT_PUBLIC_DISPLAY_DENOM}" +echo "NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT: ${NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT}" +echo "NEXT_PUBLIC_ASSETS: ${NEXT_PUBLIC_ASSETS}" +echo "NEXT_PUBLIC_GAS_PRICE: ${NEXT_PUBLIC_GAS_PRICE}" +echo "NEXT_PUBLIC_ADDRESS_PREFIX: ${NEXT_PUBLIC_ADDRESS_PREFIX}" echo "NEXT_PUBLIC_IS_HTTP_ENABLED: ${NEXT_PUBLIC_IS_HTTP_ENABLED}" -NEXT_PUBLIC_IS_HTTP_ENABLED=$NEXT_PUBLIC_IS_HTTP_ENABLED - # Install dependencies npm install -# Build Next.js app +# Build with all required env vars +NEXT_PUBLIC_CHAIN_ID="${NEXT_PUBLIC_CHAIN_ID}" \ +NEXT_PUBLIC_CHAIN_DISPLAY_NAME="${NEXT_PUBLIC_CHAIN_DISPLAY_NAME}" \ +NEXT_PUBLIC_NODE_ADDRESSES="${NEXT_PUBLIC_NODE_ADDRESSES}" \ +NEXT_PUBLIC_DENOM="${NEXT_PUBLIC_DENOM}" \ +NEXT_PUBLIC_DISPLAY_DENOM="${NEXT_PUBLIC_DISPLAY_DENOM}" \ +NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT="${NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT}" \ +NEXT_PUBLIC_ASSETS="${NEXT_PUBLIC_ASSETS}" \ +NEXT_PUBLIC_GAS_PRICE="${NEXT_PUBLIC_GAS_PRICE}" \ +NEXT_PUBLIC_ADDRESS_PREFIX="${NEXT_PUBLIC_ADDRESS_PREFIX}" \ +NEXT_PUBLIC_IS_HTTP_ENABLED="${NEXT_PUBLIC_IS_HTTP_ENABLED}" \ npm run build -echo "Start app..." +# Start Next.js production server +echo "Starting Next.js app in production mode..." npm run start -- 2.45.2 From 2a9b9f240bafb8e492063766460f3050fe399595 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Mon, 26 May 2025 15:27:49 +0530 Subject: [PATCH 06/12] Update docker compose to set default env values --- .../docker-compose-cosmos-multisig-ui.yml | 29 +++++++++---------- .../config/cosmos-multisig-ui/run.sh | 8 +++++ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/stack-orchestrator/compose/docker-compose-cosmos-multisig-ui.yml b/stack-orchestrator/compose/docker-compose-cosmos-multisig-ui.yml index 69e7752..c60ea0f 100644 --- a/stack-orchestrator/compose/docker-compose-cosmos-multisig-ui.yml +++ b/stack-orchestrator/compose/docker-compose-cosmos-multisig-ui.yml @@ -9,25 +9,24 @@ services: network_mode: "host" environment: DGRAPH_URL: ${DGRAPH_URL:-http://localhost:8080/graphql} - NEXT_PUBLIC_MULTICHAIN: "true" - NEXT_PUBLIC_REGISTRY_NAME: "laconic" - NEXT_PUBLIC_LOGO: "" - NEXT_PUBLIC_CHAIN_ID: "laconic_9000-1" - NEXT_PUBLIC_CHAIN_DISPLAY_NAME: "Laconic Network" - NEXT_PUBLIC_NODE_ADDRESSES: '["http://localhost:26657"]' - NEXT_PUBLIC_DENOM: "alnt" - NEXT_PUBLIC_DISPLAY_DENOM: "ALNT" - NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT: "18" - NEXT_PUBLIC_ASSETS: > - [{"denom_units":[{"denom":"alnt","exponent":0},{"denom":"alnt","exponent":6}],"base":"alnt","name":"Laconic Token","display":"ALNT","symbol":"alnt"}] - NEXT_PUBLIC_GAS_PRICE: "0.01alnt" - NEXT_PUBLIC_ADDRESS_PREFIX: "laconic" - NEXT_PUBLIC_IS_HTTP_ENABLED: "true" + NEXT_PUBLIC_MULTICHAIN: ${NEXT_PUBLIC_MULTICHAIN:-true} + NEXT_PUBLIC_REGISTRY_NAME: ${NEXT_PUBLIC_REGISTRY_NAME:-laconic} + NEXT_PUBLIC_LOGO: ${NEXT_PUBLIC_LOGO:-} + NEXT_PUBLIC_CHAIN_ID: ${NEXT_PUBLIC_CHAIN_ID:-laconic_9000-1} + NEXT_PUBLIC_CHAIN_DISPLAY_NAME: ${NEXT_PUBLIC_CHAIN_DISPLAY_NAME:-Laconic Network} + NEXT_PUBLIC_NODE_ADDRESSES: ${NEXT_PUBLIC_NODE_ADDRESSES:-["http://localhost:26657"]} + NEXT_PUBLIC_DENOM: ${NEXT_PUBLIC_DENOM:-alnt} + NEXT_PUBLIC_DISPLAY_DENOM: ${NEXT_PUBLIC_DISPLAY_DENOM:-ALNT} + NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT: ${NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT:-18} + NEXT_PUBLIC_ASSETS: ${NEXT_PUBLIC_ASSETS:-[{"denom_units":[{"denom":"alnt","exponent":0},{"denom":"alnt","exponent":6}],"base":"alnt","name":"Laconic Token","display":"ALNT","symbol":"alnt"}]} + NEXT_PUBLIC_GAS_PRICE: ${NEXT_PUBLIC_GAS_PRICE:-0.01alnt} + NEXT_PUBLIC_ADDRESS_PREFIX: ${NEXT_PUBLIC_ADDRESS_PREFIX:-laconic} + NEXT_PUBLIC_IS_HTTP_ENABLED: ${NEXT_PUBLIC_IS_HTTP_ENABLED:-true} command: ["bash", "/cosmos-script/run.sh"] volumes: - ../config/cosmos-multisig-ui/run.sh:/cosmos-script/run.sh ports: - - "3000" + - "3000:3000" healthcheck: test: ["CMD", "nc", "-vz", "127.0.0.1", "3000"] interval: 20s diff --git a/stack-orchestrator/config/cosmos-multisig-ui/run.sh b/stack-orchestrator/config/cosmos-multisig-ui/run.sh index 2913f64..a369c67 100644 --- a/stack-orchestrator/config/cosmos-multisig-ui/run.sh +++ b/stack-orchestrator/config/cosmos-multisig-ui/run.sh @@ -6,6 +6,10 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then fi echo "Using the following env variables:" +echo "DGRAPH_URL: ${DGRAPH_URL}" +echo "NEXT_PUBLIC_MULTICHAIN: ${NEXT_PUBLIC_MULTICHAIN}" +echo "NEXT_PUBLIC_REGISTRY_NAME: ${NEXT_PUBLIC_REGISTRY_NAME}" +echo "NEXT_PUBLIC_LOGO: ${NEXT_PUBLIC_LOGO}" echo "NEXT_PUBLIC_CHAIN_ID: ${NEXT_PUBLIC_CHAIN_ID}" echo "NEXT_PUBLIC_CHAIN_DISPLAY_NAME: ${NEXT_PUBLIC_CHAIN_DISPLAY_NAME}" echo "NEXT_PUBLIC_NODE_ADDRESSES: ${NEXT_PUBLIC_NODE_ADDRESSES}" @@ -21,6 +25,10 @@ echo "NEXT_PUBLIC_IS_HTTP_ENABLED: ${NEXT_PUBLIC_IS_HTTP_ENABLED}" npm install # Build with all required env vars +DGRAPH_URL="${DGRAPH_URL}" \ +NEXT_PUBLIC_MULTICHAIN="${NEXT_PUBLIC_MULTICHAIN}" \ +NEXT_PUBLIC_REGISTRY_NAME="${NEXT_PUBLIC_REGISTRY_NAME}" \ +NEXT_PUBLIC_LOGO="${NEXT_PUBLIC_LOGO}" \ NEXT_PUBLIC_CHAIN_ID="${NEXT_PUBLIC_CHAIN_ID}" \ NEXT_PUBLIC_CHAIN_DISPLAY_NAME="${NEXT_PUBLIC_CHAIN_DISPLAY_NAME}" \ NEXT_PUBLIC_NODE_ADDRESSES="${NEXT_PUBLIC_NODE_ADDRESSES}" \ -- 2.45.2 From be55efd877e86c05e523481fc63f2d9251fd623f Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Mon, 26 May 2025 16:34:39 +0530 Subject: [PATCH 07/12] Add GQL schema in run script --- db-schema.graphql | 3 + .../docker-compose-cosmos-multisig-ui.yml | 33 +++++----- .../compose/docker-compose-dgraph.yml | 18 +++--- .../cosmos-multisig-ui/db-schema.graphql | 30 +++++++++ .../config/cosmos-multisig-ui/run.sh | 4 ++ .../stacks/cosmos-multisig-ui/README.md | 63 +++++++++++++++++++ 6 files changed, 124 insertions(+), 27 deletions(-) create mode 100644 stack-orchestrator/config/cosmos-multisig-ui/db-schema.graphql diff --git a/db-schema.graphql b/db-schema.graphql index 2196eda..c362df6 100644 --- a/db-schema.graphql +++ b/db-schema.graphql @@ -1,5 +1,8 @@ type Multisig { id: ID! + # The @search annotation allows us to query the list of multisigs and filter + # by (chainId, address) pairs. We use "hash" since we only need exact matches. + # See https://dgraph.io/docs/graphql/schema/directives/search/#string chainId: String! @search(by: [hash]) address: String! @search(by: [hash]) creator: String @search(by: [hash]) diff --git a/stack-orchestrator/compose/docker-compose-cosmos-multisig-ui.yml b/stack-orchestrator/compose/docker-compose-cosmos-multisig-ui.yml index c60ea0f..885f9d2 100644 --- a/stack-orchestrator/compose/docker-compose-cosmos-multisig-ui.yml +++ b/stack-orchestrator/compose/docker-compose-cosmos-multisig-ui.yml @@ -1,32 +1,31 @@ -version: '3.8' - services: cosmos-multisig-ui: image: cerc/cosmos-multisig-ui:local restart: unless-stopped depends_on: - alpha - network_mode: "host" + network_mode: "host" # For local testing, to allow the container to directly access host machine ports from container environment: DGRAPH_URL: ${DGRAPH_URL:-http://localhost:8080/graphql} - NEXT_PUBLIC_MULTICHAIN: ${NEXT_PUBLIC_MULTICHAIN:-true} - NEXT_PUBLIC_REGISTRY_NAME: ${NEXT_PUBLIC_REGISTRY_NAME:-laconic} - NEXT_PUBLIC_LOGO: ${NEXT_PUBLIC_LOGO:-} - NEXT_PUBLIC_CHAIN_ID: ${NEXT_PUBLIC_CHAIN_ID:-laconic_9000-1} - NEXT_PUBLIC_CHAIN_DISPLAY_NAME: ${NEXT_PUBLIC_CHAIN_DISPLAY_NAME:-Laconic Network} - NEXT_PUBLIC_NODE_ADDRESSES: ${NEXT_PUBLIC_NODE_ADDRESSES:-["http://localhost:26657"]} - NEXT_PUBLIC_DENOM: ${NEXT_PUBLIC_DENOM:-alnt} - NEXT_PUBLIC_DISPLAY_DENOM: ${NEXT_PUBLIC_DISPLAY_DENOM:-ALNT} - NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT: ${NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT:-18} - NEXT_PUBLIC_ASSETS: ${NEXT_PUBLIC_ASSETS:-[{"denom_units":[{"denom":"alnt","exponent":0},{"denom":"alnt","exponent":6}],"base":"alnt","name":"Laconic Token","display":"ALNT","symbol":"alnt"}]} - NEXT_PUBLIC_GAS_PRICE: ${NEXT_PUBLIC_GAS_PRICE:-0.01alnt} - NEXT_PUBLIC_ADDRESS_PREFIX: ${NEXT_PUBLIC_ADDRESS_PREFIX:-laconic} - NEXT_PUBLIC_IS_HTTP_ENABLED: ${NEXT_PUBLIC_IS_HTTP_ENABLED:-true} + NEXT_PUBLIC_MULTICHAIN: ${NEXT_PUBLIC_MULTICHAIN} + NEXT_PUBLIC_REGISTRY_NAME: ${NEXT_PUBLIC_REGISTRY_NAME} + NEXT_PUBLIC_LOGO: ${NEXT_PUBLIC_LOGO} + NEXT_PUBLIC_CHAIN_ID: ${NEXT_PUBLIC_CHAIN_ID} + NEXT_PUBLIC_CHAIN_DISPLAY_NAME: ${NEXT_PUBLIC_CHAIN_DISPLAY_NAME} + NEXT_PUBLIC_NODE_ADDRESSES: ${NEXT_PUBLIC_NODE_ADDRESSES} + NEXT_PUBLIC_DENOM: ${NEXT_PUBLIC_DENOM} + NEXT_PUBLIC_DISPLAY_DENOM: ${NEXT_PUBLIC_DISPLAY_DENOM} + NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT: ${NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT} + NEXT_PUBLIC_ASSETS: ${NEXT_PUBLIC_ASSETS} + NEXT_PUBLIC_GAS_PRICE: ${NEXT_PUBLIC_GAS_PRICE} + NEXT_PUBLIC_ADDRESS_PREFIX: ${NEXT_PUBLIC_ADDRESS_PREFIX} + NEXT_PUBLIC_IS_HTTP_ENABLED: ${NEXT_PUBLIC_IS_HTTP_ENABLED:-false} command: ["bash", "/cosmos-script/run.sh"] volumes: - ../config/cosmos-multisig-ui/run.sh:/cosmos-script/run.sh + - ../config/cosmos-multisig-ui/db-schema.graphql:/cosmos-script/db-schema.graphql ports: - - "3000:3000" + - "3000" healthcheck: test: ["CMD", "nc", "-vz", "127.0.0.1", "3000"] interval: 20s diff --git a/stack-orchestrator/compose/docker-compose-dgraph.yml b/stack-orchestrator/compose/docker-compose-dgraph.yml index 649e48c..1c38c87 100644 --- a/stack-orchestrator/compose/docker-compose-dgraph.yml +++ b/stack-orchestrator/compose/docker-compose-dgraph.yml @@ -1,32 +1,30 @@ -version: '3.8' - services: zero: - image: dgraph/dgraph:latest + image: dgraph/dgraph:v21.03.2 volumes: - zero-data:/dgraph ports: - - "5080:5080" - - "6080:6080" + - "5080" + - "6080" restart: on-failure command: dgraph zero --my=zero:5080 alpha: - image: dgraph/dgraph:latest + image: dgraph/dgraph:v21.03.2 depends_on: - zero volumes: - alpha-data:/dgraph ports: - - "8080:8080" - - "9080:9080" + - "8080" + - "9080" restart: on-failure command: dgraph alpha --my=alpha:7080 --zero=zero:5080 --security "whitelist=0.0.0.0/0" ratel: - image: dgraph/ratel:latest + image: dgraph/ratel:v21.03.0 ports: - - "8000:8000" + - "8000" depends_on: - alpha diff --git a/stack-orchestrator/config/cosmos-multisig-ui/db-schema.graphql b/stack-orchestrator/config/cosmos-multisig-ui/db-schema.graphql new file mode 100644 index 0000000..2196eda --- /dev/null +++ b/stack-orchestrator/config/cosmos-multisig-ui/db-schema.graphql @@ -0,0 +1,30 @@ +type Multisig { + id: ID! + chainId: String! @search(by: [hash]) + address: String! @search(by: [hash]) + creator: String @search(by: [hash]) + pubkeyJSON: String! @search(by: [fulltext]) + transactions: [Transaction] @hasInverse(field: creator) +} + +type Transaction { + id: ID! + txHash: String + creator: Multisig + dataJSON: String! + signatures: [Signature] @hasInverse(field: transaction) +} + +type Signature { + transaction: Transaction! + bodyBytes: String! + signature: String! + address: String! +} + +type Nonce { + id: ID! + chainId: String! @search(by: [hash]) + address: String! @search(by: [hash]) + nonce: Int! +} diff --git a/stack-orchestrator/config/cosmos-multisig-ui/run.sh b/stack-orchestrator/config/cosmos-multisig-ui/run.sh index a369c67..1f9ae0f 100644 --- a/stack-orchestrator/config/cosmos-multisig-ui/run.sh +++ b/stack-orchestrator/config/cosmos-multisig-ui/run.sh @@ -5,6 +5,10 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then set -x fi +# Load Dgraph schema +echo "Posting schema to Dgraph..." +curl -X POST localhost:8080/admin/schema -d @/cosmos-script/db-schema.graphql + echo "Using the following env variables:" echo "DGRAPH_URL: ${DGRAPH_URL}" echo "NEXT_PUBLIC_MULTICHAIN: ${NEXT_PUBLIC_MULTICHAIN}" diff --git a/stack-orchestrator/stacks/cosmos-multisig-ui/README.md b/stack-orchestrator/stacks/cosmos-multisig-ui/README.md index a5055a4..5629b34 100644 --- a/stack-orchestrator/stacks/cosmos-multisig-ui/README.md +++ b/stack-orchestrator/stacks/cosmos-multisig-ui/README.md @@ -26,12 +26,75 @@ Instructions for running the `cosmos-multisig-ui` using [laconic-so](https://git laconic-so --stack ~/cerc/cosmos-multisig-ui/stack-orchestrator/stacks/cosmos-multisig-ui deploy init --output cosmos-multisig-ui-spec.yml ``` +* Edit `network` in the spec file to map container ports to host ports as required: + + ```bash + # cosmos-multisig-ui-spec.yml + ... + network: + ports: + cosmos-multisig-ui: + - 3000:3000 + zero: + - 5080:5080 + - 6080:6080 + alpha: + - 8080:8080 + - 9080:9080 + ratel: + - 8000:8000 + ... + ``` + * Create a deployment from the spec file: ```bash laconic-so --stack ~/cerc/cosmos-multisig-ui/stack-orchestrator/stacks/cosmos-multisig-ui/ deploy create --spec-file cosmos-multisig-ui-spec.yml --deployment-dir cosmos-multisig-deployment ``` +* Inside the `cosmos-multisig-deployment` deployment directory, open `config.env` file and set following env variables: + + ```bash + # Allow multiple networks/chains in app + NEXT_PUBLIC_MULTICHAIN=false + + # Name of the chain registry + NEXT_PUBLIC_REGISTRY_NAME=laconic + + # Path or URL to the logo asset (can be left empty if not needed) + NEXT_PUBLIC_LOGO= + + # Chain ID + NEXT_PUBLIC_CHAIN_ID=laconic_9000-1 + + # Display name for the chain + NEXT_PUBLIC_CHAIN_DISPLAY_NAME="Laconic Network" + + # JSON array of RPC node URLs + NEXT_PUBLIC_NODE_ADDRESSES='["http://localhost:26657"]' + + # Native token base denom + NEXT_PUBLIC_DENOM=alnt + + # Display name for the token (used in UI) + NEXT_PUBLIC_DISPLAY_DENOM=ALNT + + # Exponent used to convert from base denom + NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT=18 + + # JSON array of asset metadata + NEXT_PUBLIC_ASSETS='[{"denom_units":[{"denom":"alnt","exponent":0},{"denom":"alnt","exponent":6}],"base":"alnt","name":"Laconic Token","display":"ALNT","symbol":"alnt"}]' + + # Minimum gas price + NEXT_PUBLIC_GAS_PRICE=0.01alnt + + # Bech32 address prefix for the chain + NEXT_PUBLIC_ADDRESS_PREFIX=laconic + + # Whether to use HTTP (true/false) + NEXT_PUBLIC_IS_HTTP_ENABLED=true + ``` + ## Start the deployment * Run: -- 2.45.2 From 18330464d4a52bb8a17d4cf400ce766ea1960e40 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Mon, 26 May 2025 16:53:29 +0530 Subject: [PATCH 08/12] Add GQL schema after app build --- stack-orchestrator/config/cosmos-multisig-ui/run.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stack-orchestrator/config/cosmos-multisig-ui/run.sh b/stack-orchestrator/config/cosmos-multisig-ui/run.sh index 1f9ae0f..32154c8 100644 --- a/stack-orchestrator/config/cosmos-multisig-ui/run.sh +++ b/stack-orchestrator/config/cosmos-multisig-ui/run.sh @@ -5,10 +5,6 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then set -x fi -# Load Dgraph schema -echo "Posting schema to Dgraph..." -curl -X POST localhost:8080/admin/schema -d @/cosmos-script/db-schema.graphql - echo "Using the following env variables:" echo "DGRAPH_URL: ${DGRAPH_URL}" echo "NEXT_PUBLIC_MULTICHAIN: ${NEXT_PUBLIC_MULTICHAIN}" @@ -45,6 +41,10 @@ NEXT_PUBLIC_ADDRESS_PREFIX="${NEXT_PUBLIC_ADDRESS_PREFIX}" \ NEXT_PUBLIC_IS_HTTP_ENABLED="${NEXT_PUBLIC_IS_HTTP_ENABLED}" \ npm run build +# Load Dgraph schema +echo "Posting schema to Dgraph..." +curl -X POST localhost:8080/admin/schema -d @/cosmos-script/db-schema.graphql + # Start Next.js production server echo "Starting Next.js app in production mode..." npm run start -- 2.45.2 From a24e34c59d377213bdba9607215e014d53d8d5af Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Mon, 26 May 2025 16:59:31 +0530 Subject: [PATCH 09/12] Update README --- stack-orchestrator/stacks/cosmos-multisig-ui/README.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/stack-orchestrator/stacks/cosmos-multisig-ui/README.md b/stack-orchestrator/stacks/cosmos-multisig-ui/README.md index 5629b34..b3f7966 100644 --- a/stack-orchestrator/stacks/cosmos-multisig-ui/README.md +++ b/stack-orchestrator/stacks/cosmos-multisig-ui/README.md @@ -111,15 +111,6 @@ Instructions for running the `cosmos-multisig-ui` using [laconic-so](https://git * Open the app in a browser at -## Add graphql schema - -* Register the GraphQL schema in the Dgraph database - - ``` - cd ~/cerc/cosmos-multisig-ui - curl -X POST localhost:8080/admin/schema -d '@db-schema.graphql' - ``` - ## Clean up * Stop the deployment: -- 2.45.2 From 6887cf91002b2c5ae1d6952f75515178936ba6a1 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Mon, 26 May 2025 17:16:48 +0530 Subject: [PATCH 10/12] Remove default values from README --- .../compose/docker-compose-dgraph.yml | 8 +++---- .../stacks/cosmos-multisig-ui/README.md | 24 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/stack-orchestrator/compose/docker-compose-dgraph.yml b/stack-orchestrator/compose/docker-compose-dgraph.yml index 1c38c87..fce0ab7 100644 --- a/stack-orchestrator/compose/docker-compose-dgraph.yml +++ b/stack-orchestrator/compose/docker-compose-dgraph.yml @@ -4,8 +4,8 @@ services: volumes: - zero-data:/dgraph ports: - - "5080" - - "6080" + - "5080:5080" + - "6080:6080" restart: on-failure command: dgraph zero --my=zero:5080 @@ -17,14 +17,14 @@ services: - alpha-data:/dgraph ports: - "8080" - - "9080" + - "9080:9080" restart: on-failure command: dgraph alpha --my=alpha:7080 --zero=zero:5080 --security "whitelist=0.0.0.0/0" ratel: image: dgraph/ratel:v21.03.0 ports: - - "8000" + - "8000:8000" depends_on: - alpha diff --git a/stack-orchestrator/stacks/cosmos-multisig-ui/README.md b/stack-orchestrator/stacks/cosmos-multisig-ui/README.md index b3f7966..8bbc881 100644 --- a/stack-orchestrator/stacks/cosmos-multisig-ui/README.md +++ b/stack-orchestrator/stacks/cosmos-multisig-ui/README.md @@ -56,43 +56,43 @@ Instructions for running the `cosmos-multisig-ui` using [laconic-so](https://git ```bash # Allow multiple networks/chains in app - NEXT_PUBLIC_MULTICHAIN=false + NEXT_PUBLIC_MULTICHAIN= # Name of the chain registry - NEXT_PUBLIC_REGISTRY_NAME=laconic + NEXT_PUBLIC_REGISTRY_NAME= # Path or URL to the logo asset (can be left empty if not needed) NEXT_PUBLIC_LOGO= # Chain ID - NEXT_PUBLIC_CHAIN_ID=laconic_9000-1 + NEXT_PUBLIC_CHAIN_ID= # Display name for the chain - NEXT_PUBLIC_CHAIN_DISPLAY_NAME="Laconic Network" + NEXT_PUBLIC_CHAIN_DISPLAY_NAME= # JSON array of RPC node URLs - NEXT_PUBLIC_NODE_ADDRESSES='["http://localhost:26657"]' + NEXT_PUBLIC_NODE_ADDRESSES= # Native token base denom - NEXT_PUBLIC_DENOM=alnt + NEXT_PUBLIC_DENOM= # Display name for the token (used in UI) - NEXT_PUBLIC_DISPLAY_DENOM=ALNT + NEXT_PUBLIC_DISPLAY_DENOM= # Exponent used to convert from base denom - NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT=18 + NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT= # JSON array of asset metadata - NEXT_PUBLIC_ASSETS='[{"denom_units":[{"denom":"alnt","exponent":0},{"denom":"alnt","exponent":6}],"base":"alnt","name":"Laconic Token","display":"ALNT","symbol":"alnt"}]' + NEXT_PUBLIC_ASSETS= # Minimum gas price - NEXT_PUBLIC_GAS_PRICE=0.01alnt + NEXT_PUBLIC_GAS_PRICE= # Bech32 address prefix for the chain - NEXT_PUBLIC_ADDRESS_PREFIX=laconic + NEXT_PUBLIC_ADDRESS_PREFIX= # Whether to use HTTP (true/false) - NEXT_PUBLIC_IS_HTTP_ENABLED=true + NEXT_PUBLIC_IS_HTTP_ENABLED= ``` ## Start the deployment -- 2.45.2 From bacebaefcb231ca515789120f9181bac4b7480e0 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Mon, 26 May 2025 18:29:28 +0530 Subject: [PATCH 11/12] Handle env value for http enabled --- context/ChainsContext/service.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/context/ChainsContext/service.tsx b/context/ChainsContext/service.tsx index b6a2328..b327c07 100644 --- a/context/ChainsContext/service.tsx +++ b/context/ChainsContext/service.tsx @@ -73,7 +73,7 @@ export const useChainsFromRegistry = () => { export const getNodeFromArray = async (nodeArray: readonly string[]) => { let secureNodes: readonly string[] = []; - if (process.env.NEXT_PUBLIC_IS_HTTP_ENABLED === "true") { + if (process.env.NEXT_PUBLIC_IS_HTTP_ENABLED?.toLowerCase() === "true") { // Allow all nodes, HTTP or HTTPS secureNodes = nodeArray; } else { -- 2.45.2 From f13efc9798a0c8844ac8b8b0e685a245a0007c9a Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Mon, 26 May 2025 18:40:45 +0530 Subject: [PATCH 12/12] Expose only required ports --- stack-orchestrator/compose/docker-compose-dgraph.yml | 10 +++++----- stack-orchestrator/stacks/cosmos-multisig-ui/README.md | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/stack-orchestrator/compose/docker-compose-dgraph.yml b/stack-orchestrator/compose/docker-compose-dgraph.yml index fce0ab7..2e511b2 100644 --- a/stack-orchestrator/compose/docker-compose-dgraph.yml +++ b/stack-orchestrator/compose/docker-compose-dgraph.yml @@ -4,8 +4,8 @@ services: volumes: - zero-data:/dgraph ports: - - "5080:5080" - - "6080:6080" + - "5080" + - "6080" restart: on-failure command: dgraph zero --my=zero:5080 @@ -17,14 +17,14 @@ services: - alpha-data:/dgraph ports: - "8080" - - "9080:9080" + - "9080" restart: on-failure command: dgraph alpha --my=alpha:7080 --zero=zero:5080 --security "whitelist=0.0.0.0/0" ratel: - image: dgraph/ratel:v21.03.0 + image: dgraph/ratel:v21.03.2 ports: - - "8000:8000" + - "8000" depends_on: - alpha diff --git a/stack-orchestrator/stacks/cosmos-multisig-ui/README.md b/stack-orchestrator/stacks/cosmos-multisig-ui/README.md index 8bbc881..40fe0d3 100644 --- a/stack-orchestrator/stacks/cosmos-multisig-ui/README.md +++ b/stack-orchestrator/stacks/cosmos-multisig-ui/README.md @@ -36,13 +36,13 @@ Instructions for running the `cosmos-multisig-ui` using [laconic-so](https://git cosmos-multisig-ui: - 3000:3000 zero: - - 5080:5080 - - 6080:6080 + - 5080 + - 6080 alpha: - 8080:8080 - - 9080:9080 + - 9080 ratel: - - 8000:8000 + - 8000 ... ``` -- 2.45.2