fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd/records-demo.md

123 lines
5.0 KiB
Markdown
Raw Normal View History

# records-demo
## Setup
* Set account key and bond id in the CLI config:
```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:
BOND_ID=$(laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry bond create --type photon --quantity 100000000000 --user-key $ALICE_PK" | jq -r '.bondId')
# Update CLI config
laconic-so deployment --dir laconic-console-deployment exec cli "CERC_LACONICD_USER_KEY=${ALICE_PK} CERC_LACONICD_BOND_ID=${BOND_ID} CERC_LACONICD_GAS=900000 /app/create-config.sh"
# Note: Update the values in 'laconic-console-deployment/config.env' accordingly before restarting
```
## Run
2024-06-24 10:51:40 +00:00
* 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
2024-06-24 10:51:40 +00:00
# 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/
2024-06-21 09:17:27 +00:00
2024-06-24 10:51:40 +00:00
# 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/records"
```
2024-06-24 10:51:40 +00:00
OR
```bash
2024-06-24 10:51:40 +00:00
# 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/
2024-06-21 09:17:27 +00:00
# Publish repository records first
2024-06-21 10:25:53 +00:00
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"
2024-06-21 09:17:27 +00:00
# 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>
2024-06-24 10:51:40 +00:00
* 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
```
2024-06-21 10:25:53 +00:00
* Query for `bsc-node` stack:
2024-06-21 10:25:53 +00:00
* Find the `StackRecord` for `bsc-node` stack:
2024-06-21 10:25:53 +00:00
```bash
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry record list --all --type StackRecord --name bsc-node"
2024-06-21 10:25:53 +00:00
# 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'")
```
2024-06-21 10:25:53 +00:00
* 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'"
```