Add stack for app
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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 <http://localhost:3000>
|
||||
|
||||
## 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
|
||||
```
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user