Run laconic-console stack as part of fixturenet deployment (#1)
Part of [Create an external fixturenet-laconicd stack](https://www.notion.so/Create-an-external-fixturenet-laconicd-stack-3b33cc2317444f4da209c4472f4244ed) Reviewed-on: cerc-io/fixturenet-laconicd-stack#1 Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com> Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
This commit is contained in:
@@ -1,36 +1,57 @@
|
||||
# fixturenet-laconicd-stack
|
||||
|
||||
Instructions for running a laconicd fixturenet along with registry CLI and console
|
||||
|
||||
## Setup
|
||||
|
||||
* Clone the stack repo
|
||||
* Clone the stack repos:
|
||||
|
||||
```bash
|
||||
laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-laconicd-stack
|
||||
laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack
|
||||
```
|
||||
|
||||
* Clone required repositories:
|
||||
|
||||
```bash
|
||||
# laconicd
|
||||
laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd setup-repositories
|
||||
|
||||
# laconic 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/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd build-containers
|
||||
|
||||
# laconic 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:
|
||||
* Create spec files for the deployment:
|
||||
|
||||
```bash
|
||||
laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd deploy init --output fixturenet-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:
|
||||
|
||||
```bash
|
||||
# testnet-laconicd-spec.yml
|
||||
...
|
||||
network:
|
||||
ports:
|
||||
@@ -41,18 +62,51 @@
|
||||
- '9473:9473'
|
||||
- '9090:9090'
|
||||
- '1317:1317'
|
||||
|
||||
# laconic-console-spec.yml
|
||||
...
|
||||
network:
|
||||
ports:
|
||||
console:
|
||||
- '8080:80'
|
||||
```
|
||||
|
||||
* Create a deployment from the spec file:
|
||||
* Create deployment from the spec files:
|
||||
|
||||
```bash
|
||||
laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd deploy create --spec-file fixturenet-laconicd-spec.yml --deployment-dir fixturenet-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 fixturenet-laconicd-deployment/deployment.yml laconic-console-deployment/deployment.yml
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
* Inside the `laconic-console-deployment` deployment directory, open `config.env` file and set following env variables:
|
||||
|
||||
```bash
|
||||
# Optional CLI configuration
|
||||
|
||||
# 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=
|
||||
```
|
||||
|
||||
## Start the deployment
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir fixturenet-laconicd-deployment start
|
||||
laconic-so deployment --dir laconic-console-deployment start
|
||||
```
|
||||
|
||||
## Check status
|
||||
@@ -67,6 +121,31 @@ laconic-so deployment --dir fixturenet-laconicd-deployment start
|
||||
laconic-so deployment --dir fixturenet-laconicd-deployment logs laconicd -f
|
||||
```
|
||||
|
||||
* 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"
|
||||
```
|
||||
|
||||
## Perform operations
|
||||
|
||||
* Example (bond creation):
|
||||
|
||||
```bash
|
||||
# Get the PK from your node
|
||||
ALICE_PK=$(echo y | laconic-so deployment --dir fixturenet-laconicd-deployment exec laconicd "laconicd keys export alice --unarmored-hex --unsafe")
|
||||
|
||||
# Create a bond:
|
||||
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry bond create --type photon --quantity 100000000000 --user-key $ALICE_PK" | jq -r '.bondId'
|
||||
```
|
||||
|
||||
## Demo
|
||||
|
||||
* Follow the [records-demo](./records-demo.md) to try loading data into registry
|
||||
|
||||
## Clean up
|
||||
|
||||
* Stop all services running in the background:
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
# records-demo
|
||||
|
||||
## Setup
|
||||
|
||||
* Set account key and bond id in the CLI config:
|
||||
|
||||
```bash
|
||||
# Set bond id to the bond created earlier or create a new one
|
||||
BOND_ID=<bond-id>
|
||||
|
||||
# Update CLI config
|
||||
laconic-so deployment --dir laconic-console-deployment exec cli "CERC_LACONICD_USER_KEY=${ALICE_PK} CERC_LACONICD_BOND_ID=${BOND_ID} /app/create-config.sh"
|
||||
|
||||
# Note: Update the values in 'laconic-console-deployment/config.env' accordingly before restarting
|
||||
```
|
||||
|
||||
## Run
|
||||
|
||||
* Copy over all records from a dir to the data dir in `laconic-console-deployment` (`laconic-console-deployment/data/laconic-registry-data`) and publish the records:
|
||||
|
||||
```bash
|
||||
# Example: for demo records
|
||||
# Copy over the records
|
||||
cp -r /home/user/fixturenet-laconicd-stack/stack-orchestrator/config/demo-records laconic-console-deployment/data/laconic-registry-data/
|
||||
|
||||
# Publish the records from `laconic-registry-data` directory
|
||||
laconic-so deployment --dir laconic-console-deployment exec cli "yarn ts-node demo/scripts/publish-records.ts --config config.yml --records /laconic-registry-data/demo-records"
|
||||
```
|
||||
|
||||
OR
|
||||
|
||||
```bash
|
||||
# Example: for testnet records
|
||||
# Copy over the records
|
||||
cp -r /home/user/laconic-testnet-data/records/repo laconic-console-deployment/data/laconic-registry-data/repo-records
|
||||
rsync -av --exclude 'repo' /home/user/laconic-testnet-data/records laconic-console-deployment/data/laconic-registry-data/
|
||||
|
||||
# Publish repository records first
|
||||
laconic-so deployment --dir laconic-console-deployment exec cli "yarn ts-node demo/scripts/publish-records.ts --config config.yml --records /laconic-registry-data/repo-records"
|
||||
|
||||
# Publish rest of the records
|
||||
laconic-so deployment --dir laconic-console-deployment exec cli "yarn ts-node demo/scripts/publish-records.ts --config config.yml --records /laconic-registry-data/records"
|
||||
```
|
||||
|
||||
## Query
|
||||
|
||||
* All the published records can be viewed on the console at <http://localhost:8080>
|
||||
* explore the console for more information
|
||||
* click on the link aside a record that opens the GraphQL console
|
||||
* the query is pre-loaded, run it and inspect the output
|
||||
|
||||
### CLI Examples
|
||||
|
||||
* Query all records:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry record list"
|
||||
```
|
||||
|
||||
* Query for `geth` service deployment(s):
|
||||
|
||||
* Find the `ServiceRecord` for `geth`:
|
||||
|
||||
```bash
|
||||
SERVICE_RECORD_ID=$(laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry record list --all --type ServiceRecord --name geth | jq -r '.[].id'")
|
||||
```
|
||||
|
||||
* Find corresponding deployment(s):
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry record list --all --type ServiceDeploymentRecord service $SERVICE_RECORD_ID"
|
||||
|
||||
# Get the deployment URL(s)
|
||||
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry record list --all --type ServiceDeploymentRecord service $SERVICE_RECORD_ID | jq -r '.[].attributes.url'"
|
||||
|
||||
# Expected output:
|
||||
# https://geth-rpc-endpoint-1.example.com
|
||||
# https://geth-rpc-endpoint-2.example.com
|
||||
```
|
||||
|
||||
* Query for `azimuth-watcher` deployment(s):
|
||||
|
||||
* Find the `WatcherRecord` for `azimuth-watcher`:
|
||||
|
||||
```bash
|
||||
WATCHER_RECORD_ID=$(laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry record list --all --type WatcherRecord --name azimuth-watcher | jq -r '.[].id'")
|
||||
```
|
||||
|
||||
* Find corresponding deployment(s):
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry record list --all --type WatcherDeploymentRecord watcher $WATCHER_RECORD_ID"
|
||||
|
||||
# Get the deployment URL(s)
|
||||
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry record list --all --type WatcherDeploymentRecord watcher $WATCHER_RECORD_ID | jq -r '.[].attributes.url'"
|
||||
|
||||
# Expected output:
|
||||
https://azimuth-watcher-endpoint.example.com
|
||||
```
|
||||
|
||||
* Query for `bsc-node` stack:
|
||||
|
||||
* Find the `StackRecord` for `bsc-node` stack:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry record list --all --type StackRecord --name bsc-node"
|
||||
|
||||
# Get the repo record id
|
||||
STACK_REPO_RECORD_ID=$(laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry record list --all --type StackRecord --name bsc-node | jq -r '.[].attributes.repository'")
|
||||
```
|
||||
|
||||
* Find the corresponding `RepositoryRecord`:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry record get --id $STACK_REPO_RECORD_ID"
|
||||
|
||||
# Get the repo URL
|
||||
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry record get --id $STACK_REPO_RECORD_ID | jq -r '.[].attributes.url'"
|
||||
```
|
||||
Reference in New Issue
Block a user