2024-10-30 07:05:39 +00:00
# Service Provider
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
* 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
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
## Set up a new service provider
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
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):
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
* 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 >
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
Follow the steps below to point your deployer to the SAPO testnet
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
## Update service provider for SAPO testnet
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
### Prerequisites
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
* A SAPO testnet node (see [Join SAPO testnet ](./README.md#join-sapo-testnet ))
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
### Stop services
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
* Stop a laconic-console deployment:
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
```bash
# In directory where laconic-console deployment was created
laconic-so deployment --dir laconic-console-deployment stop --delete-volumes
```
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
* Stop webapp deployer:
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
```bash
# In directory where webapp-deployer deployment was created
laconic-so deployment --dir webapp-deployer stop
laconic-so deployment --dir webapp-ui stop
```
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
### Update laconic console
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
* Remove an existing console deployment:
2024-10-22 13:32:11 +00:00
```bash
2024-10-30 07:05:39 +00:00
# In directory where laconic-console deployment was created
# Backup the config if required
rm -rf laconic-console-deployment
2024-10-22 13:32:11 +00:00
```
2024-10-30 07:05:39 +00:00
* Follow [laconic-console ](stack-orchestrator/stacks/laconic-console/README.md ) stack instructions to setup a new laconic-console deployment
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
* Example configuration:
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
```bash
# CLI configuration
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
# laconicd RPC endpoint (can be pointed to your node)
CERC_LACONICD_RPC_ENDPOINT=https://laconicd-sapo.laconic.com
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
# laconicd GQL endpoint (can be pointed to your node)
CERC_LACONICD_GQL_ENDPOINT=https://laconicd-sapo.laconic.com/api
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
CERC_LACONICD_CHAIN_ID=laconic-testnet-2
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
# your private key
CERC_LACONICD_USER_KEY=
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
# your bond id (optional)
CERC_LACONICD_BOND_ID=
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
# 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=
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
# Console configuration
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
# Laconicd (hosted) GQL endpoint (can be pointed to your node)
LACONIC_HOSTED_ENDPOINT=https://laconicd-sapo.laconic.com
2024-10-22 13:32:11 +00:00
```
2024-10-30 07:05:39 +00:00
### Check authority and deployer record
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
* 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
2024-10-29 13:06:17 +00:00
2024-10-30 07:05:39 +00:00
* Check authority:
2024-10-29 13:06:17 +00:00
2024-10-30 07:05:39 +00:00
```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"
2024-10-29 13:06:17 +00:00
```
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
* Check deployer record:
2024-10-29 13:06:17 +00:00
```bash
2024-10-30 07:05:39 +00:00
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"
2024-10-22 13:32:11 +00:00
```
2024-10-30 07:05:39 +00:00
### (Optional) Reserve a new authority
2024-10-29 13:06:17 +00:00
2024-10-30 07:05:39 +00:00
* Follow steps if you want to reserve a new authority
2024-10-29 13:06:17 +00:00
2024-10-30 07:05:39 +00:00
* Create a bond:
2024-10-22 13:32:11 +00:00
```bash
2024-10-30 07:05:39 +00:00
# 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=
2024-10-22 13:32:11 +00:00
```
2024-10-30 07:05:39 +00:00
* Reserve an authority:
2024-10-22 13:32:11 +00:00
```bash
2024-10-30 07:05:39 +00:00
AUTHORITY=< your-authority >
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry authority reserve $AUTHORITY"
# Triggers an authority auction
2024-10-22 13:32:11 +00:00
```
2024-10-30 07:05:39 +00:00
* Obtain the authority auction id:
2024-10-29 13:06:17 +00:00
2024-10-30 07:05:39 +00:00
```bash
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry authority whois $AUTHORITY"
# "auction": {
# "id": "73e0b082a198c396009ce748804a9060c674a10045365d262c1584f99d2771c1"
2024-10-29 13:06:17 +00:00
2024-10-30 07:05:39 +00:00
# Set auction id
AUCTION_ID=
```
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
* Commit a bid to the auction:
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
```bash
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry auction bid commit $AUCTION_ID 5000000 alnt --chain-id laconic-testnet-2"
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
# {"reveal_file":"/app/out/bafyreiewi4osqyvrnljwwcb36fn6sr5iidfpuznqkz52gxc5ztt3jt4zmy.json"}
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
# Set reveal file
REVEAL_FILE=
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
# 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"
2024-10-22 13:32:11 +00:00
```
2024-10-30 07:05:39 +00:00
* Reveal your bid using reveal file generated while commiting the bid:
2024-10-22 13:32:11 +00:00
```bash
2024-10-30 07:05:39 +00:00
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}
2024-10-22 13:32:11 +00:00
```
2024-10-30 07:05:39 +00:00
* Verify auction status and winner address after auction completion:
2024-10-22 13:32:11 +00:00
```bash
2024-10-30 07:05:39 +00:00
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry auction get $AUCTION_ID"
2024-10-22 13:32:11 +00:00
```
2024-10-30 07:05:39 +00:00
* Set the authority with a bond:
2024-10-22 13:32:11 +00:00
```bash
2024-10-30 07:05:39 +00:00
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry authority bond set $AUTHORITY $BOND_ID"
# {"success": true}
2024-10-22 13:32:11 +00:00
```
2024-10-30 07:05:39 +00:00
* Verify the authority has been registered:
2024-10-22 13:32:11 +00:00
```bash
2024-10-30 07:05:39 +00:00
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry authority whois $AUTHORITY"
2024-10-22 13:32:11 +00:00
```
2024-10-30 07:05:39 +00:00
* Update laconic-console-deployment config (`laconic-console-deployment/config.env`) with created bond:
2024-10-22 13:32:11 +00:00
```bash
2024-10-30 07:05:39 +00:00
...
CERC_LACONICD_BOND_ID=a742489e5817ef274187611dadb0e4284a49c087608b545ab6bd990905fb61f3
...
2024-10-22 13:32:11 +00:00
```
2024-10-30 07:05:39 +00:00
* Restart the console deployment:
2024-10-22 13:32:11 +00:00
```bash
2024-10-30 07:05:39 +00:00
laconic-so deployment --dir laconic-console-deployment stop & & laconic-so deployment --dir laconic-console-deployment start
2024-10-22 13:32:11 +00:00
```
2024-10-30 07:05:39 +00:00
### Update webapp deployer
* Fetch latest stack repos:
2024-10-22 13:32:11 +00:00
```bash
2024-10-30 07:05:39 +00:00
# In directory where webapp-deployer deployment was created
laconic-so --stack webapp-deployer-backend setup-repositories --pull
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
# Confirm latest commit hash in the ~/cerc/webapp-deployment-status-api repo
2024-10-22 13:32:11 +00:00
```
2024-10-30 07:05:39 +00:00
* Rebuild container images:
2024-10-22 13:32:11 +00:00
```bash
2024-10-30 07:05:39 +00:00
laconic-so --stack webapp-deployer-backend build-containers --force-rebuild
2024-10-22 13:32:11 +00:00
```
2024-10-30 07:05:39 +00:00
* Push stack images to the container registry:
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
* Login to the container registry:
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
```bash
# Set required variables
# eg: container-registry.pwa.laconic.com
CONTAINER_REGISTRY_URL=
CONTAINER_REGISTRY_USERNAME=
CONTAINER_REGISTRY_PASSWORD=
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
# login to container registry
docker login $CONTAINER_REGISTRY_URL --username $CONTAINER_REGISTRY_USERNAME --password $CONTAINER_REGISTRY_PASSWORD
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
# WARNING! Using --password via the CLI is insecure. Use --password-stdin.
# WARNING! Your password will be stored unencrypted in /home/dev2/.docker/config.json.
# Configure a credential helper to remove this warning. See
# https://docs.docker.com/engine/reference/commandline/login/#credential-stores
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
# Login Succeeded
```
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
* Push images:
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
```bash
laconic-so deployment --dir webapp-deployer push-images
```
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
* Update deployer laconic registry config (`webapp-deployer/data/config/laconic.yml`) with new endpoints:
2024-10-22 13:32:11 +00:00
```bash
2024-10-30 07:05:39 +00:00
services:
registry:
rpcEndpoint: 'https://laconicd-sapo.laconic.com'
gqlEndpoint: 'https://laconicd-sapo.laconic.com/api'
userKey: "< userKey > "
bondId: "< bondId "
chainId: laconic-testnet-2
gasPrice: 0.001alnt
2024-10-22 13:32:11 +00:00
```
2024-10-30 07:05:39 +00:00
Note: Existing `userKey` and `bondId` can be used since they are carried over from laconicd stage1 to testnet2
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
* Publish a new webapp deployer record:
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
* Required if it doesn't already exist or some attribute needs to be updated
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
* Set the following variables:
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
```bash
# Path to the webapp-deployer directory
# eg: /home/dev/webapp-deployer
DEPLOYER_DIR=
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
# Deployer LRN (logical resource name)
# eg: "lrn://laconic/deployers/webapp-deployer-api.laconic.com"
DEPLOYER_LRN=
2024-10-24 09:28:14 +00:00
2024-10-30 07:05:39 +00:00
# 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=
2024-10-24 09:28:14 +00:00
2024-10-30 07:05:39 +00:00
GPG_PUB_KEY_FILE=$(basename $GPG_PUB_KEY_FILE_PATH)
```
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
* Delete the LRN if it currently resolves to an existing record:
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
```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
```
2024-10-24 09:28:14 +00:00
2024-10-30 07:05:39 +00:00
* Publish the deployer record:
```bash
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 \
--api-url $API_URL \
--public-key-file /home/root/config/$GPG_PUB_KEY_FILE \
--lrn $DEPLOYER_LRN \
--min-required-payment 9500
```
* Update deployer config (`webapp-deployer/config.env`):
2024-10-24 09:28:14 +00:00
```bash
2024-10-30 07:05:39 +00:00
# Update the deployer LRN if it has changed
export LRN=
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
# Min payment to require for performing deployments
export MIN_REQUIRED_PAYMENT=9500
# Handle deployment auction requests
export HANDLE_AUCTION_REQUESTS=true
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
# Amount that the deployer will bid on deployment auctions
export AUCTION_BID_AMOUNT=9500
```
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
* Start the webapp deployer:
2024-10-22 13:32:11 +00:00
```bash
laconic-so deployment --dir webapp-deployer start
```
2024-10-30 07:05:39 +00:00
* Get the webapp-deployer pod id:
2024-10-22 13:32:11 +00:00
2024-10-28 05:48:20 +00:00
```bash
laconic-so deployment --dir webapp-deployer ps
2024-10-22 13:32:11 +00:00
2024-10-28 05:48:20 +00:00
# Expected output
# Running containers:
# id: default/laconic-096fed46af974a47-deployment-644db859c7-snbq6, name: laconic-096fed46af974a47-deployment-644db859c7-snbq6, ports: 10.42.2.11:9555->9555
2024-10-22 13:32:11 +00:00
2024-10-28 05:48:20 +00:00
# Set pod id
export POD_ID=
2024-10-30 07:05:39 +00:00
2024-10-28 05:48:20 +00:00
# Example:
# export POD_ID=laconic-096fed46af974a47-deployment-644db859c7-snbq6
```
2024-10-22 13:32:11 +00:00
2024-10-30 07:05:39 +00:00
* Copy over GPG keys files to the webapp-deployer container:
2024-10-28 05:48:20 +00:00
```bash
2024-10-30 07:05:39 +00:00
kubie ctx default
2024-10-28 05:48:20 +00:00
# Copy the GPG key files to the pod
2024-10-29 13:06:17 +00:00
kubectl cp < path-to-your-gpg-private-key > $POD_ID:/app
kubectl cp < path-to-your-gpg-public-key > $POD_ID:/app
2024-10-24 09:28:14 +00:00
2024-10-30 07:05:39 +00:00
# Required everytime you stop and start the deployer
```
2024-10-24 09:28:14 +00:00
2024-10-30 07:05:39 +00:00
* Check logs:
```bash
# Deployer
kubectl logs -f $POD_ID
# Deployer auction handler
kubectl logs -f $POD_ID -c cerc-webapp-auction-handler
```
2024-10-24 09:28:14 +00:00
2024-10-30 07:05:39 +00:00
* Update deployer UI config (`webapp-ui/config.env`):
2024-10-24 09:28:14 +00:00
```bash
2024-10-30 07:05:39 +00:00
# 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
2024-10-22 13:32:11 +00:00
```
2024-10-30 07:05:39 +00:00
* Start the webapp UI:
2024-10-24 09:28:14 +00:00
2024-10-30 07:05:39 +00:00
```bash
laconic-so deployment --dir webapp-ui start
```
2024-10-24 09:28:14 +00:00
2024-10-30 07:05:39 +00:00
* Check logs
```bash
laconic-so deployment --dir webapp-ui logs webapp
```