Update service provider instructions

This commit is contained in:
Prathamesh Musale 2024-10-30 12:35:39 +05:30
parent 4d0da5669a
commit 0ec4a37a39
3 changed files with 262 additions and 282 deletions

View File

@ -26,6 +26,6 @@ Follow steps in [Upgrade to SAPO testnet](./testnet-onboarding-validator.md#upgr
Follow steps in [testnet-nitro-node.md](./testnet-nitro-node.md) to run your Nitro node for the testnet
## Set up a Service provider
## Setup a Service Provider
Follow steps from [service-provider.md](./service-provider.md) to set up a service provider
Follow steps in [service-provider.md](./service-provider.md) to setup / update your service provider

View File

@ -1,50 +1,219 @@
# Service Provider
* Follow [Set up a new service provider](#set-up-a-new-service-provider) to setup a new service provider (SP)
* If you already have a SP setup for stage1, follow [Update service provider for SAPO testnet](#update-service-provider-for-sapo-testnet) to update it for testnet2
## Set up a new service provider
Follow steps from <https://git.vdb.to/cerc-io/testnet-ops/src/branch/main/service-provider-setup#service-provider-setup> to setup a service provider. After setup, the following services will be running (your configuration will look similar to the examples listed below):
Follow steps from [service-provider-setup](<https://git.vdb.to/cerc-io/testnet-ops/src/branch/main/service-provider-setup#service-provider-setup>). After setup, you will have the following services running (your configuration will look similar to the examples listed below):
* laconicd chain RPC endpoint: http://lcn-daemon.laconic.com:26657
* laconicd GQL endpoint: http://lcn-daemon.laconic.com:9473/api
* laconic console: http://lcn-console.laconic.com:8080/registry
* webapp deployer API: https://webapp-deployer-api.pwa.laconic.com
* webapp deployer UI: https://webapp-deployer-ui.pwa.laconic.com
* laconicd chain RPC endpoint: <http://lcn-daemon.laconic.com:26657>
* laconicd GQL endpoint: <http://lcn-daemon.laconic.com:9473/api>
* laconic console: <http://lcn-console.laconic.com:8080/registry>
* webapp deployer API: <https://webapp-deployer-api.pwa.laconic.com>
* webapp deployer UI: <https://webapp-deployer-ui.pwa.laconic.com>
## Update webapp deployer
Follow the steps below to point your deployer to the SAPO testnet
* Stop the deployer
## Update service provider for SAPO testnet
### Prerequisites
* A SAPO testnet node (see [Join SAPO testnet](./README.md#join-sapo-testnet))
### Stop services
* Stop a laconic-console deployment:
```bash
cd <path-to-deployments>
# In directory where laconic-console deployment was created
laconic-so deployment --dir laconic-console-deployment stop --delete-volumes
```
* Stop webapp deployer:
```bash
# In directory where webapp-deployer deployment was created
laconic-so deployment --dir webapp-deployer stop
laconic-so deployment --dir webapp-ui stop
```
* Fetch and build webapp deployer backend
### Update laconic console
* Remove an existing console deployment:
```bash
# Update code for webapp-deployer backend
cd ~/cerc/webapp-deployment-status-api
# In directory where laconic-console deployment was created
# Backup the config if required
rm -rf laconic-console-deployment
```
# Pull latest changes, or checkout to the required branch
git pull
* Follow [laconic-console](stack-orchestrator/stacks/laconic-console/README.md) stack instructions to setup a new laconic-console deployment
# Confirm the latest commit hash
git log
* Example configuration:
# Rebuild the containers
```bash
# CLI configuration
# laconicd RPC endpoint (can be pointed to your node)
CERC_LACONICD_RPC_ENDPOINT=https://laconicd-sapo.laconic.com
# laconicd GQL endpoint (can be pointed to your node)
CERC_LACONICD_GQL_ENDPOINT=https://laconicd-sapo.laconic.com/api
CERC_LACONICD_CHAIN_ID=laconic-testnet-2
# your private key
CERC_LACONICD_USER_KEY=
# your bond id (optional)
CERC_LACONICD_BOND_ID=
# Gas price to use for txs (default: 0.001alnt)
# Use for auto fees calculation, gas and fees not required to be set in that case
# Reference: https://git.vdb.to/cerc-io/laconic-registry-cli#gas-and-fees
CERC_LACONICD_GASPRICE=
# Console configuration
# Laconicd (hosted) GQL endpoint (can be pointed to your node)
LACONIC_HOSTED_ENDPOINT=https://laconicd-sapo.laconic.com
```
### Check authority and deployer record
* The stage1 testnet state has been carried over to testnet2, if you had authority and records on stage1, they should be present in testnet2 as well
* Check authority:
```bash
# In directory where laconic-console deployment was created
AUTHORITY=<your-authority>
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry authority whois $AUTHORITY"
```
* Check deployer record:
```bash
PAYMENT_ADDRESS=<your-deployers-payment-address>
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry record list --all --type WebappDeployer --paymentAddress $PAYMENT_ADDRESS"
```
### (Optional) Reserve a new authority
* Follow steps if you want to reserve a new authority
* Create a bond:
```bash
# An existing bond can also be used
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry bond create --type alnt --quantity 100000000000"
# {"bondId":"a742489e5817ef274187611dadb0e4284a49c087608b545ab6bd990905fb61f3"}
# Set bond id
BOND_ID=
```
* Reserve an authority:
```bash
AUTHORITY=<your-authority>
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry authority reserve $AUTHORITY"
# Triggers an authority auction
```
* Obtain the authority auction id:
```bash
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry authority whois $AUTHORITY"
# "auction": {
# "id": "73e0b082a198c396009ce748804a9060c674a10045365d262c1584f99d2771c1"
# Set auction id
AUCTION_ID=
```
* Commit a bid to the auction:
```bash
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry auction bid commit $AUCTION_ID 5000000 alnt --chain-id laconic-testnet-2"
# {"reveal_file":"/app/out/bafyreiewi4osqyvrnljwwcb36fn6sr5iidfpuznqkz52gxc5ztt3jt4zmy.json"}
# Set reveal file
REVEAL_FILE=
# Wait for the auction to move from commit to reveal phase
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry auction get $AUCTION_ID"
```
* Reveal your bid using reveal file generated while commiting the bid:
```bash
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry auction bid reveal $AUCTION_ID $REVEAL_FILE --chain-id laconic-testnet-2"
# {"success": true}
```
* Verify auction status and winner address after auction completion:
```bash
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry auction get $AUCTION_ID"
```
* Set the authority with a bond:
```bash
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry authority bond set $AUTHORITY $BOND_ID"
# {"success": true}
```
* Verify the authority has been registered:
```bash
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry authority whois $AUTHORITY"
```
* Update laconic-console-deployment config (`laconic-console-deployment/config.env`) with created bond:
```bash
...
CERC_LACONICD_BOND_ID=a742489e5817ef274187611dadb0e4284a49c087608b545ab6bd990905fb61f3
...
```
* Restart the console deployment:
```bash
laconic-so deployment --dir laconic-console-deployment stop && laconic-so deployment --dir laconic-console-deployment start
```
### Update webapp deployer
* Fetch latest stack repos:
```bash
# In directory where webapp-deployer deployment was created
laconic-so --stack webapp-deployer-backend setup-repositories --pull
# Confirm latest commit hash in the ~/cerc/webapp-deployment-status-api repo
```
* Rebuild container images:
```bash
laconic-so --stack webapp-deployer-backend build-containers --force-rebuild
```
* Push images to the container registry
* Push stack images to the container registry:
* Login to the container registry
* Login to the container registry:
```bash
# Set required variables
# eg: container-registry.pwa.laconic.com
CONTAINER_REGISTRY_URL=
# eg: dev
CONTAINER_REGISTRY_USERNAME=
# eg: password
CONTAINER_REGISTRY_PASSWORD=
# login to container registry
@ -58,13 +227,13 @@ Follow steps from <https://git.vdb.to/cerc-io/testnet-ops/src/branch/main/servic
# Login Succeeded
```
* Push images to container registry
* Push images:
```bash
laconic-so deployment --dir webapp-deployer push-images
```
* Update `webapp-deployer/data/config/laconic.yml` with the new endpoints
* Update deployer laconic registry config (`webapp-deployer/data/config/laconic.yml`) with new endpoints:
```bash
services:
@ -76,40 +245,58 @@ Follow steps from <https://git.vdb.to/cerc-io/testnet-ops/src/branch/main/servic
chainId: laconic-testnet-2
gasPrice: 0.001alnt
```
Note: Same `userKey` and `bondId` can be used since they are carried over from laconicd stage1 to testnet2
* Publish the webapp deployer record on the chain if it doesn't already exist
Note: Existing `userKey` and `bondId` can be used since they are carried over from laconicd stage1 to testnet2
* Set the following variables
* Publish a new webapp deployer record:
* Required if it doesn't already exist or some attribute needs to be updated
* Set the following variables:
```bash
# Path to the webapp-deployer directory
# eg: /home/dev/webapp-deployer
DEPLOYER_DIR=
# API URL of the webapp-deployer
# eg: "https://webapp-deployer-api.pwa.laconic.com"
API_URL=
# LRN (logical resource name) of the webapp-deployer
# Deployer LRN (logical resource name)
# eg: "lrn://laconic/deployers/webapp-deployer-api.laconic.com"
DEPLOYER_LRN=
# Name of the GPG public key file
# eg: "webapp-deployer-api.laconic.com.pgp.pub"
GPG_PUB_KEY_FILE=
# Path of the GPG public key file
# Deployer API URL
# eg: "https://webapp-deployer-api.pwa.laconic.com"
API_URL=
# Deployer GPG public key file path
# eg: "/home/dev/webapp-deployer-api.laconic.com.pgp.pub"
GPG_PUB_KEY_FILE_PATH=
GPG_PUB_KEY_FILE=$(basename $GPG_PUB_KEY_FILE_PATH)
```
* Copy the GPG pub key file used while setting up the webapp-deployer to the `webapp-deployer/data/config` directory. This ensures the Docker container has access to the key during the publish process.
* Delete the LRN if it currently resolves to an existing record:
```bash
# In directory where laconic-console deployment was created
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry name resolve $DEPLOYER_LRN"
# Delete the name
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry name delete $DEPLOYER_LRN"
# Confirm deletion
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry name resolve $DEPLOYER_LRN"
```
* Copy over the GPG pub key file to webapp-deployer:
```bash
cp $GPG_PUB_KEY_FILE_PATH webapp-deployer/data/config
```
* Publish the deployer record
* Publish the deployer record:
```bash
docker run -i -t \
docker run -it \
-v $DEPLOYER_DIR/data/config:/home/root/config \
cerc/webapp-deployer-backend:local laconic-so publish-deployer-to-registry \
--laconic-config /home/root/config/laconic.yml \
@ -119,24 +306,29 @@ Follow steps from <https://git.vdb.to/cerc-io/testnet-ops/src/branch/main/servic
--min-required-payment 9500
```
* Update `webapp-deployer/config.env`
* Update deployer config (`webapp-deployer/config.env`):
```bash
# Update the webapp deployer lrn if it has changed
LRN=
# Add the following so the webapp deployer will support auction requests
# Update the deployer LRN if it has changed
export LRN=
# Min payment to require for performing deployments
export MIN_REQUIRED_PAYMENT=9500
# Handle deployment auction requests
export HANDLE_AUCTION_REQUESTS=true
# Amount that the webapp deployer will bid on auctions
# Amount that the deployer will bid on deployment auctions
export AUCTION_BID_AMOUNT=9500
```
* Start the webapp deployer
* Start the webapp deployer:
```bash
laconic-so deployment --dir webapp-deployer start
```
* Get the webapp-deployer pod id
* Get the webapp-deployer pod id:
```bash
laconic-so deployment --dir webapp-deployer ps
@ -147,264 +339,52 @@ Follow steps from <https://git.vdb.to/cerc-io/testnet-ops/src/branch/main/servic
# Set pod id
export POD_ID=
# Example:
# export POD_ID=laconic-096fed46af974a47-deployment-644db859c7-snbq6
```
* Copy the GPG key file to the webapp-deployer container
* Copy over GPG keys files to the webapp-deployer container:
```bash
kubie ctx default
# Copy the GPG key files to the pod
kubectl cp <path-to-your-gpg-private-key> $POD_ID:/app
kubectl cp <path-to-your-gpg-public-key> $POD_ID:/app
# Required everytime you stop and start the deployer
```
* Check logs
```bash
laconic-so deployment --dir webapp-deployer logs cerc-webapp-deployer
```
* Update `webapp-ui/config.env`
* Check logs:
```bash
# URL of the webapp deployer backend
# Deployer
kubectl logs -f $POD_ID
# Deployer auction handler
kubectl logs -f $POD_ID -c cerc-webapp-auction-handler
```
* Update deployer UI config (`webapp-ui/config.env`):
```bash
# URL of the webapp deployer backend API
# eg: https://webapp-deployer-api.pwa.laconic.com
LACONIC_HOSTED_CONFIG_app_api_url=
# URL of the laconic console
LACONIC_HOSTED_CONFIG_app_console_link=https://console-sapo.laconic.com
```
* Start the webapp ui
* Start the webapp UI:
```bash
laconic-so deployment --dir webapp-ui start
```
* Check logs
```bash
laconic-so deployment --dir webapp-ui logs webapp -f
```
## Connect webapp-deployer to testnet2
Follow the steps given below to connect the webapp-deployer to testnet2
<details open>
<summary>Update laconic console config</summary>
### Update laconic console config
* Stop webapp deployer
* Check logs
```bash
laconic-so deployment --dir webapp-deployer stop
laconic-so deployment --dir webapp-ui stop
laconic-so deployment --dir webapp-ui logs webapp
```
* Stop laconic-console and fixturenet-laconicd deployment
```bash
laconic-so deployment --dir fixturenet-laconicd-deployment stop
laconic-so deployment --dir laconic-console-deployment stop
```
* Update `laconic-console-deployment/config.env` with the following config
```bash
# private key to your funded account
CERC_LACONICD_USER_KEY=
# This will be updated later
CERC_LACONICD_BOND_ID=
# RPC endpoint of the chain, can be pointed to your validator node
# eg: https://laconicd-sapo.laconic.com
CERC_LACONICD_RPC_ENDPOINT=
# GQL endpoint of the chain, can be pointed to your validator node
# eg: https://laconicd-sapo.laconic.com/api
CERC_LACONICD_GQL_ENDPOINT=
# laconicd chain id
CERC_LACONICD_CHAIN_ID=laconic-testnet-2
# Endpoint for the console
# eg: https://laconic-console.example.com
LACONIC_HOSTED_ENDPOINT=
```
Note: Follow steps from [Join as a validator on stage1](./testnet-onboarding-validator.md#join-as-a-validator-on-stage1) to setup your validator node
* Start the `laconic-console-deployment`
```bash
laconic-so deployment --dir laconic-console-deployment start
```
</details>
<details open>
<summary>Register an authority</summary>
### Register an authority
* Create a bond
```bash
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry bond create --type alnt --quantity 100000000000"
# {"bondId":"a742489e5817ef274187611dadb0e4284a49c087608b545ab6bd990905fb61f3"}
```
* Register an authority
```bash
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry authority reserve <authority_name>"
```
* Obtain the auction ID
```bash
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry authority whois <authority_name>"
# "auction": {
# "id": "73e0b082a198c396009ce748804a9060c674a10045365d262c1584f99d2771c1"
```
* Commit a bid using the auction ID. A reveal file will be generated
```bash
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry auction bid commit 73e0b082a198c396009ce748804a9060c674a10045365d262c1584f99d2771c1 5000000 alnt --chain-id laconic-testnet-2"
# {"reveal_file":"/app/out/bafyreiewi4osqyvrnljwwcb36fn6sr5iidfpuznqkz52gxc5ztt3jt4zmy.json"}
```
* Reveal a bid using the auction ID and the reveal file generated from the bid commit
```bash
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry auction bid reveal 73e0b082a198c396009ce748804a9060c674a10045365d262c1584f99d2771c1 /app/out/bafyreiewi4osqyvrnljwwcb36fn6sr5iidfpuznqkz52gxc5ztt3jt4zmy.json --chain-id laconic-testnet-2"
# {"success": true}
```
* Verify status after the auction ends. It should list a completed status and a winner
```
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry auction get 73e0b082a198c396009ce748804a9060c674a10045365d262c1584f99d2771c1"
```
* Set the authority using a bond ID.
```bash
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry authority bond set <authority_name> a742489e5817ef274187611dadb0e4284a49c087608b545ab6bd990905fb61f3"
# {"success": true}
```
* Verify the authority has been registered.
```bash
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry authority whois <authority_name>"
```
* Stop the laconic-console-deployment
```bash
laconic-so deployment --dir laconic-console-deployment stop
```
* Update `CERC_LACONICD_BOND_ID` in `laconic-console-deployment/config.env` with the bond that was created
```bash
...
CERC_LACONICD_BOND_ID=a742489e5817ef274187611dadb0e4284a49c087608b545ab6bd990905fb61f3
...
```
* Start the `laconic-console-deployment`
```bash
laconic-so deployment --dir laconic-console-deployment start
```
</details>
<details open>
<summary>Publish record for webapp-deployer</summary>
### Publish record for webapp-deployer
Follow steps from [Update webapp deployer](#update-webapp-deployer) to publish the deployer record to the chain
<details open>
<summary>Update config for webapp deployer</summary>
### Update config for webapp deployer
* Update `webapp-deployer/config.env` with the authority that you reserved
```bash
# Name of reserved authority
DEPLOYMENT_RECORD_NAMESPACE="<authority_name>"
```
* Update `webapp-ui/config.env` with the updated endpoints
```bash
# api url of webapp deployer
# eg: https://webapp-deployer-api.pwa.laconic.com
LACONIC_HOSTED_CONFIG_app_api_url=
# url of laconic console
LACONIC_HOSTED_CONFIG_app_console_link=https://console-sapo.laconic.com
```
</details>
<details open>
<summary>Start the deployer</summary>
### Start the deployer
* Start the webapp deployer backend
```bash
laconic-so deployment --dir webapp-deployer start
```
* Get the webapp-deployer pod id
```bash
laconic-so deployment --dir webapp-deployer ps
# Expected output
# Running containers:
# id: default/laconic-096fed46af974a47-deployment-644db859c7-snbq6, name: laconic-096fed46af974a47-deployment-644db859c7-snbq6, ports: 10.42.2.11:9555->9555
# Set pod id
export POD_ID=
# Example:
# export POD_ID=laconic-096fed46af974a47-deployment-644db859c7-snbq6
```
* Copy the GPG key file to the webapp-deployer container
```bash
# Copy the GPG key files to the pod
kubectl cp <path-to-your-gpg-private-key> $POD_ID:/app
kubectl cp <path-to-your-gpg-public-key> $POD_ID:/app
````
* Check logs
```bash
laconic-so deployment --dir webapp-deployer logs cerc-webapp-deployer
```
* Start the webapp deployer ui
```bash
laconic-so deployment --dir webapp-ui start
```
* Check logs
```bash
laconic-so deployment --dir webapp-ui logs webapp
```
</details>

View File

@ -17,13 +17,13 @@ Instructions for running laconic registry CLI and console
* Clone required repositories:
```bash
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console setup-repositories
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console setup-repositories --pull
```
* Build the container images:
```bash
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console build-containers
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console build-containers --force-rebuild
```
This should create the following docker images locally: