Support for complete laconic stack with console and test registration record #335

Merged
telackey merged 2 commits from dboreham/add-test-registry-data into main 2023-04-17 02:14:15 +00:00
9 changed files with 57 additions and 1 deletions

View File

@ -8,6 +8,7 @@ services:
# TODO: look at folding these scripts into the container
- ../config/fixturenet-laconicd/create-fixturenet.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh
- ../config/fixturenet-laconicd/export-mykey.sh:/docker-entrypoint-scripts.d/export-mykey.sh
- ../config/fixturenet-laconicd/export-myaddress.sh:/docker-entrypoint-scripts.d/export-myaddress.sh
# TODO: determine which of the ports below is really needed
ports:
- "6060"

View File

@ -0,0 +1,2 @@
#!/bin/sh
laconicd keys show mykey | grep address | cut -d ' ' -f 3

View File

@ -5,3 +5,5 @@ services:
userKey: REPLACE_WITH_MYKEY
bondId:
chainId: laconic_9000-1
gas: 250000
fees: 200000aphoton

View File

@ -55,7 +55,9 @@ RUN yarn global add @cerc-io/laconic-registry-cli
# Add scripts
RUN mkdir /scripts
ENV PATH="${PATH}:/scripts"
COPY ./create-demo-records.sh /scripts
COPY ./import-key.sh /scripts
COPY ./import-address.sh /scripts
# Default command sleeps forever so docker doesn't kill it
CMD ["sh", "-c", "while :; do sleep 600; done"]

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Create some demo/test records in the registry
set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
registry_command="laconic cns"
record_1_filename=demo-record-1.yml
cat <<EOF > ${record_1_filename}
record:
type: WebsiteRegistrationRecord
url: 'https://cerc.io'
repo_registration_record_cid: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
build_artifact_cid: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
tls_cert_cid: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
version: 1.0.23
EOF
# Check we have funds
funds_response=$(${registry_command} account get --address $(cat my-address.txt))
funds_balance=$(echo ${funds_response} | jq -r .[0].balance[0].quantity)
echo "Balance is: ${funds_balance}"
# Create a bond
bond_create_result=$(${registry_command} bond create --type aphoton --quantity 1000000000)
bond_id=$(echo ${bond_create_result} | jq -r .bondId)
echo "Created bond with id: ${bond_id}"
# Publish a demo record
publish_response=$(${registry_command} record publish --filename ${record_1_filename} --bond-id ${bond_id})
published_record_id=$(echo ${publish_response} | jq -r .id)
echo "Published ${record_1_filename} with id: ${published_record_id}"

View File

@ -0,0 +1,2 @@
#!/bin/sh
echo ${1} > my-address.txt

View File

@ -48,3 +48,18 @@ $ laconic-so --stack fixturenet-laconicd deploy logs
```
$ laconic-so --stack fixturenet-laconicd deploy exec cli "laconic cns status"
```
## 7. View the laconic console
Get the URL for the console web app with this command (the port number will be different for each deployment):
```
$ echo http://localhost:$(laconic-so --stack fixturenet-laconic-loaded deploy port laconic-console 80 | cut -d ':' -f 2)
http://localhost:58364
```
Open that address with a browser. The console should display
## 8. Load demo data into the registry
```
$ laconic-so --stack fixturenet-laconic-loaded deploy exec cli ./scripts/create-demo-records.sh
Balance is: 99998999999999998999600000
Created bond with id: dd88e8d6f9567b32b28e70552aea4419c5dd3307ebae85a284d1fe38904e301a
Published demo-record-1.yml with id: bafyreierh3xnfivexlscdwubvczmddsnf46uytyfvrbdhkjzztvsz6ruly
```
The published record should be visible in the console.

View File

@ -1,4 +1,4 @@
version: "1.0"
version: "1.1"
name: fixturenet-laconic-loaded
description: "A full featured laconic fixturenet"
repos:
@ -28,3 +28,5 @@ pods:
config:
cli:
key: laconicd.mykey
address: laconicd.myaddress

View File

@ -16,3 +16,4 @@ pods:
config:
cli:
key: laconicd.mykey
address: laconicd.myaddress