2024-10-23 12:14:58 +00:00
## Set up a new service provider
2024-10-24 09:28:14 +00:00
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):
2024-10-23 12:14:58 +00:00
2024-10-24 09:28:14 +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-23 12:14:58 +00:00
2024-10-25 09:50:12 +00:00
## Update webapp deployer
2024-10-22 13:32:11 +00:00
* Stop the deployer
```bash
cd < path-to-deployments >
laconic-so deployment --dir webapp-deployer stop
laconic-so deployment --dir webapp-ui stop
```
2024-10-25 09:50:12 +00:00
* Fetch and build webapp deployer backend
2024-10-22 13:32:11 +00:00
```bash
# Update code for webapp-deployer backend
cd ~/cerc/webapp-deployment-status-api
# Pull latest changes, or checkout to the required branch
git pull
# Confirm the latest commit hash
git log
# Rebuild the containers
laconic-so --stack webapp-deployer-backend build-containers --force-rebuild
```
* Push images to the container registry
* login to the container registry
```bash
# Set required variables
CONTAINER_REGISTRY_URL=
CONTAINER_REGISTRY_USERNAME=
CONTAINER_REGISTRY_PASSWORD=
# login to container registry
docker login $CONTAINER_REGISTRY_URL --username $CONTAINER_REGISTRY_USERNAME --password $CONTAINER_REGISTRY_PASSWORD
# 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
# Login Succeeded
```
* Push images to container registry
```bash
laconic-so deployment --dir webapp-deployer push-images
```
* Update `webapp-deployer/data/config/laconic.yml` with the new endpoints
```bash
services:
registry:
rpcEndpoint: 'https://laconicd-sapo.laconic.com'
gqlEndpoint: 'https://laconicd-sapo.laconic.com/api'
userKey: "< userKey > "
bondId: "< bondId "
chainId: laconic-testnet-2
2024-10-25 09:50:12 +00:00
gasPrice: 0.001alnt
2024-10-22 13:32:11 +00:00
```
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
* Set the following variables
```bash
# Path to the webapp-deployer directory, e.g., /home/dev..
DEPLOYER_DIR=
# API URL of the webapp-deployer
API_URL=
# LRN (logical resource name) of the webapp-deployer
DEPLOYER_LRN=
# Name of the GPG public key file
GPG_PUB_KEY_FILE=
# Path of the GPG public key file
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.
```bash
cp $GPG_PUB_KEY_FILE_PATH webapp-deployer/data/config
```
* Publish the deployer record
```bash
docker run -i -t \
-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 0
```
* Update the webapp deployer config
```bash
# Update the webapp deployer lrn if it has changed
LRN=
# Add the following so the webapp deployer will support auction requests
export HANDLE_AUCTION_REQUESTS=true
# Amount that the webapp deployer will bid on auctions
export AUCTION_BID_AMOUNT=50000
```
* Start the webapp deployer
```bash
laconic-so deployment --dir webapp-deployer start
```
* Copy the GPG key file to the webapp-deployer container
```bash
# Get the webapp-deployer pod id
kubectl get pods --sort-by=.metadata.creationTimestamp -o jsonpath='{.items[-1].metadata.name}'
# laconic-ac473c31db9ac9fd-deployment-674bf7bf9f-529bs
# Copy the GPG key files to the pod
kubectl cp < path-to-your-gpg-private-key > laconic-ac473c31db9ac9fd-deployment-674bf7bf9f-529bs:/app
kubectl cp < path-to-your-gpg-public-key > laconic-ac473c31db9ac9fd-deployment-674bf7bf9f-529bs:/app
```
* Update the webapp ui config
```bash
# URL of the webapp deployer backend
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
```bash
laconic-so deployment --dir webapp-ui start
```
## 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
2024-10-24 09:28:14 +00:00
* Stop webapp deployer
2024-10-22 13:32:11 +00:00
```bash
laconic-so deployment --dir webapp-deployer stop
2024-10-24 09:28:14 +00:00
laconic-so deployment --dir webapp-ui stop
2024-10-22 13:32:11 +00:00
```
* 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=
2024-10-24 09:28:14 +00:00
# RPC endpoint of the chain, can be pointed to your validator node
# eg: http://console-testnet2.laconic.com
CERC_LACONICD_RPC_ENDPOINT=
2024-10-22 13:32:11 +00:00
2024-10-24 09:28:14 +00:00
# GQL endpoint of the chain, can be pointed to your validator node
# eg: https://laconicd-sapo.laconic.com/api
CERC_LACONICD_GQL_ENDPOINT=
2024-10-22 13:32:11 +00:00
# laconicd chain id
CERC_LACONICD_CHAIN_ID=laconic_9000-2
# Endpoint for the console
2024-10-24 09:28:14 +00:00
# eg: https://laconic-console.example.com
LACONIC_HOSTED_ENDPOINT=
2024-10-22 13:32:11 +00:00
```
* 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_9000-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_9000-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
* Update `webapp-deployer/data/config/laconic.yml` with the
```bash
services:
registry:
# laconicd RPC endpoint
2024-10-24 09:28:14 +00:00
rpcEndpoint:
2024-10-22 13:32:11 +00:00
# laconicd GQL endpoint
2024-10-24 09:28:14 +00:00
gqlEndpoint:
2024-10-22 13:32:11 +00:00
# Key to your funded account
userKey:
# bondId that you just created
bondId: a742489e5817ef274187611dadb0e4284a49c087608b545ab6bd990905fb61f3
# laconicd chain id
chainId: laconic_9000-2
2024-10-25 09:50:12 +00:00
gasPrice: 0.001alnt
2024-10-22 13:32:11 +00:00
```
2024-10-24 09:28:14 +00:00
* Publish the webapp deployer record on the chain
2024-10-22 13:32:11 +00:00
2024-10-24 09:28:14 +00:00
* Set the following variables
```bash
# Path to the webapp-deployer directory, e.g., /home/dev..
DEPLOYER_DIR=
# API URL of the webapp-deployer
API_URL=
# LRN (logical resource name) of the webapp-deployer
DEPLOYER_LRN=
# Name of the GPG public key file
GPG_PUB_KEY_FILE=
# Path of the GPG public key file
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.
```bash
cp $GPG_PUB_KEY_FILE_PATH webapp-deployer/data/config
```
* Publish the deployer record
```bash
docker run -i -t \
-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 0
```
< details open >
< summary > Update config for webapp deployer< / summary >
### Update config for webapp deployer
2024-10-22 13:32:11 +00:00
* Update `webapp-deployer/config.env` with the authority that you reserved
```bash
# Name of reserved authority
DEPLOYMENT_RECORD_NAMESPACE="< authority_name > "
```
2024-10-24 09:28:14 +00:00
* Update `webapp-ui/config.env` with the updated endpoints
```bash
# api url of webapp deployer
LACONIC_HOSTED_CONFIG_app_api_url=
# url of laconic console
2024-10-28 05:48:20 +00:00
LACONIC_HOSTED_CONFIG_app_console_link=https://console-sapo.laconic.com
2024-10-24 09:28:14 +00:00
```
2024-10-22 13:32:11 +00:00
< / details >
< details open >
< summary > Start the deployer< / summary >
### Start the deployer
2024-10-24 09:28:14 +00:00
* Start the webapp deployer backend
2024-10-22 13:32:11 +00:00
```bash
laconic-so deployment --dir webapp-deployer start
```
2024-10-28 05:48:20 +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=
# Example:
# export POD_ID=laconic-096fed46af974a47-deployment-644db859c7-snbq6
```
2024-10-22 13:32:11 +00:00
2024-10-28 05:48:20 +00:00
* 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
````
2024-10-24 09:28:14 +00:00
* 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
2024-10-22 13:32:11 +00:00
```
2024-10-24 09:28:14 +00:00
* Check logs
```bash
laconic-so deployment --dir webapp-ui logs webapp
```
2024-10-22 13:32:11 +00:00
< / details >