Create separate docker compose file for dgraph
All checks were successful
/ test (pull_request) Successful in 1m19s
/ build (pull_request) Successful in 2m2s
/ lint (pull_request) Successful in 1m17s

This commit is contained in:
IshaVenikar 2025-05-23 15:16:27 +05:30
parent a940607270
commit 044facddce
10 changed files with 71 additions and 67 deletions

View File

@ -28,7 +28,7 @@ export const isChainInfoFilled = (chain: Partial<ChainInfo>): 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,

View File

@ -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);
}

View File

@ -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,
);

View File

@ -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;

View File

@ -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])

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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'
```

View File

@ -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