Add a laconic-console stack with registry CLI and console (#2)

Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8)

Reviewed-on: cerc-io/testnet-laconicd-stack#2
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
This commit is contained in:
2024-06-24 07:26:38 +00:00
committed by ashwin
parent 0e0ddaa5ef
commit 6b74477aff
23 changed files with 853 additions and 206 deletions
@@ -0,0 +1,141 @@
# 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`
* `cerc/webapp-base`
* `cerc/laconic2-console-host`
## 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
```
* 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:
```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
# All optional
# 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=
```
## Run
* Start the deployment:
```bash
laconic-so deployment --dir laconic-console-deployment start
```
* View the laconic console at <http://localhost:8080>
* Use the `cli` service for registry CLI operations:
```bash
# Example
laconic-so deployment --dir laconic-console-deployment 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
```
@@ -0,0 +1,12 @@
version: "1.0"
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/laconic2-console-host
pods:
- laconic-console
@@ -1,199 +0,0 @@
# laconicd-full-node
Instructions for running a laconicd testnet full node and joining as a validator
## Prerequisites
* Minimum hardware requirements:
```bash
RAM: 8-16GB
Disk space: 200GB
CPU: 2 cores
```
* Testnet genesis file (file or an URL) and peer node addresses
## 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/laconicd-full-node setup-repositories
```
* Build the container images:
```bash
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconicd-full-node build-containers
```
This should create the following docker images locally:
* `cerc/laconic2d`
## Create a deployment
* 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
```
* Edit `network` in the spec file to map container ports to host ports as required:
```bash
...
network:
ports:
laconicd:
- '6060:6060'
- '26657:26657'
- '26656:26656'
- '9473:9473'
- '9090:9090'
- '1317:1317'
```
* 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
```
* Copy over the published testnet genesis file (`.json`) to data directory in deployment (`laconic-full-node-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
```
## Configuration
* Inside the deployment directory, open `config.env` file and set following env variables:
```bash
# Comma separated list of nodes to keep persistent connections to
# Example: "node-1-id@node-1-host:26656,node-2-id@node-2-host:26656"
CERC_PEERS=""
# Optional
# A custom human readable name for this node (default: TestnetNode)
CERC_MONIKER=
# Network chain ID (default: laconic_9000-1)
CERC_CHAIN_ID=
# Output log level (default: info)
CERC_LOGLEVEL=
```
## Start the deployment
```bash
laconic-so deployment --dir laconic-full-node-deployment start
```
## Check status
* To list down and monitor the running containers:
```bash
# With status
docker ps -a
# Follow logs for laconicd container
laconic-so deployment --dir laconic-full-node-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"
# `catching_up: false` indicates that node is completely synced
```
## Join as testnet validator
* Create / import a new key pair:
```bash
# Create new keypair
laconic-so deployment --dir laconic-full-node-deployment exec laconicd "laconicd keys add <key-name>"
# 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 <key-name> --recover"
# Query the keystore for your account's address
laconic-so deployment --dir laconic-full-node-deployment exec laconicd "laconicd keys show <key-name> -a"
```
* Request tokens from the testnet faucet for your account if required
* Check balance for your account:
```bash
laconic-so deployment --dir laconic-full-node-deployment exec laconicd "laconicd query bank balances <key-name>"
```
* 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 <<EOF > <your-node-moniker>-validator.json
{
"pubkey": $(laconicd cometbft show-validator),
"amount": "900000000photon",
"moniker": "<your-node-moniker>",
"commission-rate": "0.1",
"commission-max-rate": "0.2",
"commission-max-change-rate": "0.01",
"min-self-delegation": "1"
}
EOF'
```
* Create a validator:
```bash
laconic-so deployment --dir laconic-full-node-deployment exec laconicd 'laconicd tx staking create-validator <your-node-moniker>-validator.json \
--fees 50photon \
--chain-id=laconic_9000-1 \
--from <key-name>'
```
* View your staking validator details:
```bash
laconic-so deployment --dir laconic-full-node-deployment exec laconicd "laconicd query staking validator <key-name>"
```
## Clean up
* Stop all services running in the background:
```bash
# Stop the docker containers
laconic-so deployment --dir laconic-full-node-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
# Remove deployment directory (deployment will have to be recreated for a re-run)
rm -r laconic-full-node-deployment
```
@@ -0,0 +1,289 @@
# testnet-laconicd
Instructions for running a laconicd testnet full node and joining as a validator
## Prerequisites
* Minimum hardware requirements:
```bash
RAM: 8-16GB
Disk space: 200GB
CPU: 2 cores
```
* Testnet genesis file (file or an URL) and peer node addresses
## Setup
* Clone the stack repo:
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack
```
* 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/laconic2-console-host`
## Create a deployment
* Create a spec file for the deployment:
```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 both the spec files to map container ports to host ports as required:
```bash
# testnet-laconicd-spec.yml
...
network:
ports:
laconicd:
- '6060:6060'
- '26657:26657'
- '26656:26656'
- '9473:9473'
- '9090:9090'
- '1317:1317'
# laconic-console-spec.yml
...
network:
ports:
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/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`):
```bash
# Example
mkdir -p testnet-laconicd-deployment/data/laconicd-data/tmp
cp genesis.json testnet-laconicd-deployment/data/laconicd-data/tmp/genesis.json
```
## Configuration
* 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
# Example: "node-1-id@node-1-host:26656,node-2-id@node-2-host:26656"
CERC_PEERS=""
# Optional
# A custom human readable name for this node (default: TestnetNode)
CERC_MONIKER=
# Network chain ID (default: laconic_9000-1)
CERC_CHAIN_ID=
# Output log level (default: info)
CERC_LOGLEVEL=
```
* 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=
# Max fees for txs (default: 200000photon)
CERC_LACONICD_FEES=
# Console configuration
# Laconicd (hosted) GQL endpoint (default: http://localhost:9473)
LACONIC_HOSTED_ENDPOINT=
```
Note: Use `host.docker.internal` as host to access ports on the host machine
## Start the deployments
```bash
laconic-so deployment --dir testnet-laconicd-deployment start
laconic-so deployment --dir laconic-console-deployment start
```
## Check status
* To list down and monitor the running containers:
```bash
# With status
docker ps -a
# Follow logs for laconicd container
laconic-so deployment --dir testnet-laconicd-deployment logs laconicd -f
```
* Check the sync status of your node:
```bash
laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd status | jq .sync_info"
# `catching_up: false` indicates that node is completely synced
```
* View the laconic console at <http://localhost:8080>
* Use the cli service for registry CLI operations:
```bash
# Example
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry status"
```
## Join as testnet validator
* Create / import a new key pair:
```bash
# Create new keypair
laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd keys add <key-name>"
# OR
# Restore existing key with mnemonic seed phrase
# You will be prompted to enter mnemonic seed
laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd keys add <key-name> --recover"
# Query the keystore for your account's address
laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd keys show <key-name> -a"
```
* Request tokens from the testnet faucet for your account if required
* Check balance for your account:
```bash
laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd query bank balances <key-name>"
```
* Create required validator configuration:
```bash
# Edit the staking amount and other fields as required
laconic-so deployment --dir testnet-laconicd-deployment exec laconicd 'cat <<EOF > <your-node-moniker>-validator.json
{
"pubkey": $(laconicd cometbft show-validator),
"amount": "900000000photon",
"moniker": "<your-node-moniker>",
"commission-rate": "0.1",
"commission-max-rate": "0.2",
"commission-max-change-rate": "0.01",
"min-self-delegation": "1"
}
EOF'
```
* Create a validator:
```bash
laconic-so deployment --dir testnet-laconicd-deployment exec laconicd 'laconicd tx staking create-validator <your-node-moniker>-validator.json \
--fees 50photon \
--chain-id=laconic_9000-1 \
--from <key-name>'
```
* View your staking validator details:
```bash
laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd query staking validator <key-name>"
```
## 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 <key-name> --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
# 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:
```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:
```bash
# Stop the docker containers
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 testnet-laconicd-deployment stop --delete-volumes
# 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)
@@ -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