Add domain port mappings

This commit is contained in:
Shreerang Kale 2025-06-13 19:17:08 +05:30
parent 7b24731d70
commit 11921bc41c
3 changed files with 208 additions and 53 deletions

View File

@ -0,0 +1,15 @@
# Domains / Port Mappings
```bash
# Machine running the mainnet node should have following domain port mappings
https://laconicd-mainnet.laconic.com -> 26657
https://laconicd-mainnet.laconic.com/api -> 9473/api
https://laconicd-mainnet.laconic.com/console -> 9473/console
https://laconicd-mainnet.laconic.com/graphql -> 9473/graphql
Open p2p port:
26656
# Console app deployment already exists, point new domain to following port
https://console-mainnet.laconic.com -> 4001
```

View File

@ -8,6 +8,8 @@
- Machine 2: Where the mainnet first validator node is to be setup
- Check [domain port mappings](./domain-port-mappings.md) to ensure that required domains are pointing to correct ports
- Machine 3: Where the genesis file is to be generated
- Install `zstd` using `sudo apt install zstd`

View File

@ -1,4 +1,4 @@
# Update deployments after code changes
# Update Deployments
Instructions to reset / update the deployments
@ -22,9 +22,12 @@ Instructions to reset / update the deployments
# testnet-onboarding-app source
cd ~/cerc/laconic-wallet-web
# Pull latest changes, or checkout to the required branch
# Pull latest changes
git pull
# Checkout to the latest tag (https://git.vdb.to/LaconicNetwork/laconic-wallet-web/tags)
git checkout <tag>
# Confirm the latest commit hash
git log
@ -38,10 +41,10 @@ Instructions to reset / update the deployments
```bash
# URL for the deploy app so that wallet can work with it
CERC_ALLOWED_URLS=
CERC_ALLOWED_URLS=https://deploy.laconic.com,https://store.laconic.com
# RPC URL for the mainnet node
CERC_LACONICD_RPC_URL=
CERC_LACONICD_RPC_URL="https://laconicd-mainnet.laconic.com"
```
* Restart the deployment:
@ -69,11 +72,11 @@ Instructions to reset / update the deployments
# testnet-onboarding-app source
cd ~/cerc/laconic-console
# Pull latest changes, or checkout to the required branch
# Pull latest changes
git pull
# Confirm the latest commit hash
git log
# Checkout to the latest tag (https://git.vdb.to/cerc-io/laconic-console/tags)
git checkout <tag>
# Rebuild the containers
cd /srv/console
@ -85,7 +88,7 @@ Instructions to reset / update the deployments
```bash
# Laconicd (hosted) GQL endpoint
LACONIC_HOSTED_ENDPOINT=
LACONIC_HOSTED_ENDPOINT=https://laconicd-mainnet.laconic.com/graphql
```
* Restart the deployment:
@ -99,7 +102,7 @@ Instructions to reset / update the deployments
laconic-so deployment --dir laconic-console-deployment logs console -f
```
* The laconic console can now be viewed at <https://loro-console.laconic.com>
* The laconic console can now be viewed at <https://console-mainnet.laconic.com>
---
@ -128,42 +131,84 @@ Instructions to reset / update the deployments
laconic-so deployment --dir laconic-shopify-deployment start
```
## webapp-deployer
## Webapp Deployer
### Backend
* Deployment dir: `/srv/service-provider/webapp-deployer`
* If code has changed, fetch and build with updated source code:
* Fetch latest stack repos:
```bash
laconic-so --stack webapp-deployer-backend setup-repositories --git-ssh --pull
# 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
```
* Update the configuration, if required in :
* `/srv/service-provider/webapp-deployer/data/config/laconic.yml`
* `/srv/service-provider/webapp-deployer/config.env`
* Push stack images to the container registry:
* Restart the deployment:
* Login to the container registry:
```bash
# Set required variables
# eg: container-registry.pwa.laconic.com
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:
```bash
laconic-so deployment --dir webapp-deployer push-images
```
* Overwrite an existing compose file with the latest one:
```bash
laconic-so deployment --dir webapp-deployer stop
# In directory where webapp-deployer deployment folder exists
cp ~/cerc/webapp-deployment-status-api/docker-compose.yml webapp-deployer/compose/docker-compose-webapp-deployer-backend.yml
```
* Update deployer laconic registry config (`webapp-deployer/data/config/laconic.yml`) with new endpoints:
```bash
services:
registry:
rpcEndpoint: "https://laconicd-mainnet.laconic.com"
gqlEndpoint: "https://laconicd-mainnet.laconic.com/api"
userKey: "<userKey>"
bondId: "<bondId>"
chainId: laconic-mainnet
gasPrice: 0.001alnt
```
Note: Existing `userKey` and `bondId` can be used since they are carried over from SAPO testnet to mainnet
* Update any deployer config (`webapp-deployer/config.env`) if required
* Start the webapp deployer:
```bash
laconic-so deployment --dir webapp-deployer start
```
* Load context for k8s
* Get the webapp-deployer pod id:
```bash
kubie ctx vs-narwhal
```
* Copy the GPG key file to the webapp-deployer container
```bash
# Get the webapp-deployer pod id
laconic-so deployment --dir webapp-deployer ps
# Expected output
@ -172,42 +217,52 @@ Instructions to reset / update the deployments
# Set pod id
export POD_ID=
# Example:
# export POD_ID=laconic-096fed46af974a47-deployment-644db859c7-snbq6
# Copy GPG key files to the pod
kubectl cp webapp-deployer/webapp-deployer-api.apps.vaasl.io.pgp.key $POD_ID:/app
kubectl cp webapp-deployer/webapp-deployer-api.apps.vaasl.io.pgp.pub $POD_ID:/app
```
### Frontend
* Deployment dir: `/srv/service-provider/webapp-ui`
* If code has changed, fetch and build with updated source code:
* Copy over GPG keys files to the webapp-deployer container:
```bash
cd ~/cerc/webapp-deployment-status-ui
kubie ctx default
# Pull latest changes, or checkout to the required branch
git pull
# 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
# Confirm the latest commit hash
git log
laconic-so build-webapp --source-repo ~/cerc/webapp-deployment-status-ui
# Required everytime you stop and start the deployer
```
* Modify `/srv/service-provider/webapp-ui/config.env` like [this Pull Request](https://git.vdb.to/cerc-io/webapp-deployment-status-ui/pulls/6) but with your host details.
* Restart the deployment:
* Check logs:
```bash
laconic-so deployment --dir webapp-ui stop
# 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 laconic console
LACONIC_HOSTED_CONFIG_app_console_link=https://console-mainnet.laconic.com
```
* Start the webapp UI:
```bash
laconic-so deployment --dir webapp-ui start
```
* Check logs
```bash
laconic-so deployment --dir webapp-ui logs webapp
```
## Deploy Backend
* Deployment dir: `/srv/deploy-backend/laconic-backend-deployment`
@ -238,7 +293,23 @@ Instructions to reset / update the deployments
laconic-so deployment --dir laconic-backend-deployment push-images
```
* Update the configuration if required in `laconic-backend-deployment/configmaps/config/prod.toml`
* Update the configuration if required in `laconic-backend-deployment/configmaps/config/prod.toml`:
```toml
...
[registryConfig]
fetchDeploymentRecordDelay = 5000
checkAuctionStatusDelay = 5000
restEndpoint = "https://laconicd-mainnet.laconic.com"
gqlEndpoint = "https://laconicd-mainnet.laconic.com/api"
chainId = "laconic-mainnet"
privateKey = "<private-key>"
bondId = "<private-key>"
authority = "laconic-deploy"
[registryConfig.fee]
gasPrice = "0.001alnt"
...
```
* Restart the deployment:
@ -248,7 +319,74 @@ Instructions to reset / update the deployments
laconic-so deployment --dir laconic-backend-deployment start
```
## Deply Frontend
## Deploy Frontend
* Follow steps similar to [deployments-from-scratch.md](./deployments-from-scratch.md#deploy-frontend) to deploy the snowball frontend
* Use auhority `laconic-deploy` and the script `deploy-frontend.sh` instead
* Source repo: <https://git.vdb.to/cerc-io/snowballtools-base>
### Prerequisites
* Node.js
* Yarn
### Setup
* On your local machine, clone the `snowballtools-base` repo:
```bash
git clone git@git.vdb.to:cerc-io/snowballtools-base.git
```
* Install dependencies:
```bash
cd snowballtools-base
yarn install
```
* In the deployer package, create required env:
```bash
cd packages/deployer
cp .env.example .env
```
Set the required variables:
```bash
REGISTRY_BOND_ID=<bond-id>
DEPLOYER_LRN=lrn://vaasl-provider/deployers/webapp-deployer-api.apps.vaasl.io
AUTHORITY=laconic-deploy
```
Note: The bond id should be set to the `laconic-deploy` authority
* Update required laconic config. You can use the same `userKey` and `bondId` used for deploying backend:
```bash
# Replace <user-pk> and <bond-id>
cat <<EOF > config.yml
services:
registry:
rpcEndpoint: https://laconicd-mainnet.laconic.com
gqlEndpoint: https://laconicd-mainnet.laconic.com/api
userKey: <user-pk>
bondId: <bond-id>
chainId: laconic-mainnet
gasPrice: 0.001alnt
EOF
```
Note: The `userKey` account should own the authority `laconic-deploy`
### Run
* Run frontend deployment script:
```bash
./deploy-frontend.sh
```
Follow deployment logs on the deployer UI
* On a successful deployment, the frontend can be viewed at <https://deploy.laconic.com>