diff --git a/README.md b/README.md index 71402e1..91d8036 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,18 @@ - It allows you to export SAPO testnet state and start mainnet nodes +## Mainnet OPS + - To launch Laconic mainnet, follow these steps: - **Run the First Validator Node:** Begin by setting up and running the initial validator node as detailed in [run-first-validator.md](docs/run-first-validator.md) - **Deploy Cosmos Multisig App:** Integrate and run the Cosmos Multisig app using the playbook available at [cosmos-multisig-app playbook](./playbooks/cosmos-multisig-app/README.md) - - **Run Subsequent Validator Nodes:** Run subsequent validator nodes by following the instructions in [run-validator.md](docs/run-validator.md) +- To migrate existing deployments from SAPO testnet to mainnet, refer to [update-deployments.md](docs/update-deployments.md) + +## Join Mainnet + +- **Run A Validator Node:** Follow steps in [run-validator.md](docs/run-validator.md) to run a mainnet validator node + +- **Update Service Provider:** Follow steps in [update-service-provider.md](docs/update-service-provider.md) to migrate your service provider from SAPO testnet to mainnet diff --git a/docs/domain-port-mappings.md b/docs/domain-port-mappings.md new file mode 100644 index 0000000..cae28b2 --- /dev/null +++ b/docs/domain-port-mappings.md @@ -0,0 +1,18 @@ +# 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 + +Open port for TMKMS: +26659 + +# Console app deployment already exists, point new domain to following port +https://console-mainnet.laconic.com -> 4001 +``` diff --git a/docs/run-first-validator.md b/docs/run-first-validator.md index fe8e71f..42dad20 100644 --- a/docs/run-first-validator.md +++ b/docs/run-first-validator.md @@ -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` @@ -220,7 +222,7 @@ priv_validator_key_file_path: "" # Set the IP address of the machine where the laconicd node is setup - node_ip: "" + node_ip: "laconicd-mainnet.laconic.com" # Set the port of the laconicd node node_port: "26659" @@ -378,7 +380,7 @@ - Get your node's address by running following command in the machine where the mainnet node is running (machine 2): ```bash - laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'echo $(laconicd cometbft show-node-id)@YOUR_PUBLIC_IP_ADDRESS:26656' + laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'echo $(laconicd cometbft show-node-id)@laconicd-mainnet.laconic.com:26656' ``` - Add your node's address to [node-addresses.yml](./node-addresses.yml) diff --git a/docs/update-deployments.md b/docs/update-deployments.md new file mode 100644 index 0000000..0a6aa42 --- /dev/null +++ b/docs/update-deployments.md @@ -0,0 +1,390 @@ +# Update Deployments + +Instructions to reset / update the deployments + +## Login + +* Log in as `dev` user on the deployments VM + +* All the deployments are placed in the `/srv` directory: + + ```bash + cd /srv + ``` + +## laconic-wallet-web + +* Deployment dir: `/srv/wallet/laconic-wallet-web-deployment` + +* If code has changed, fetch and build with updated source code: + + ```bash + # testnet-onboarding-app source + cd ~/cerc/laconic-wallet-web + + # Pull latest changes + git pull + + # Checkout to the latest tag (https://git.vdb.to/LaconicNetwork/laconic-wallet-web/tags) + git checkout + + # Rebuild the containers + cd /srv/wallet + + laconic-so --stack ~/cerc/laconic-wallet-web/stack/stack-orchestrator/stack/laconic-wallet-web build-containers --force-rebuild + ``` + +* Update the configuration `laconic-wallet-web-deployment/config.env`: + + ```bash + # URL for the deploy app so that wallet can work with it + CERC_ALLOWED_URLS=https://deploy.laconic.com,https://store.laconic.com + + # RPC URL for the mainnet node + CERC_LACONICD_RPC_URL="https://laconicd-mainnet.laconic.com" + ``` + +* Restart the deployment: + + ```bash + laconic-so deployment --dir laconic-wallet-web-deployment stop + + laconic-so deployment --dir laconic-wallet-web-deployment start + + # Follow logs for laconic-wallet-web container, wait for the build to finish + laconic-so deployment --dir laconic-wallet-web-deployment logs laconic-wallet-web -f + ``` + +* The web wallet can now be viewed at + +* Add `laconic-mainnet` network by clicking on `Add Network` and filling in required details + +## laconic-console + +* Deployment dir: `/srv/console/laconic-console-deployment` + +* If code has changed, fetch and build with updated source code: + + ```bash + # testnet-onboarding-app source + cd ~/cerc/laconic-console + + # Pull latest changes + git pull + + # Checkout to the latest tag (https://git.vdb.to/cerc-io/laconic-console/tags) + git checkout + + # Rebuild the containers + cd /srv/console + + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console build-containers --force-rebuild + ``` + +* Update the configuration, if required in `laconic-console-deployment/config.env`: + + ```bash + # Laconicd (hosted) GQL endpoint + LACONIC_HOSTED_ENDPOINT=https://laconicd-mainnet.laconic.com/graphql + ``` + +* Restart the deployment: + + ```bash + laconic-so deployment --dir laconic-console-deployment stop + + laconic-so deployment --dir laconic-console-deployment start + + # Follow logs for console container + laconic-so deployment --dir laconic-console-deployment logs console -f + ``` + +* The laconic console can now be viewed at + +--- + +## Laconic Shopify + +* Deployment dir: `/srv/shopify/laconic-shopify-deployment` + +* If code has changed, fetch and build with updated source code: + + ```bash + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-shopify setup-repositories --git-ssh --pull + + # rebuild containers + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-shopify build-containers --force-rebuild + ``` + +* Update the configuration if required in `laconic-shopify-deployment/config.env`: + + ```bash + # laconicd RPC endpoint + CERC_LACONICD_RPC_ENDPOINT=https://laconicd-mainnet.laconic.com + + # laconicd chain id + CERC_LACONICD_CHAIN_ID=laconic-mainnet + ``` + +* Restart the deployment: + + ```bash + cd /srv/shopify + + laconic-so deployment --dir laconic-shopify-deployment stop + + laconic-so deployment --dir laconic-shopify-deployment start + ``` + +## 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 if there are any changes: + + ```bash + laconic-so --stack webapp-deployer-backend build-containers --force-rebuild + ``` + +* Push stack images to the container registry: + + * Login to the container registry: + + ```bash + # Set required variables + CONTAINER_REGISTRY_URL=container-registry.apps.vaasl.io + # For credentials: "cat /srv/service-provider/webapp-deployer/config.env | grep IMAGE_REGISTRY" + 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 + ``` + +* 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: "" + 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 + ``` + +* 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 over GPG keys files to the webapp-deployer container: + + ```bash + kubie ctx default + + # Copy the GPG key files to the pod + kubectl cp $POD_ID:/app + kubectl cp $POD_ID:/app + + # Required everytime you stop and start the deployer + ``` + +* Check logs: + + ```bash + # 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` + +* If code has changed, fetch and build with updated source code: + + ```bash + laconic-so --stack ~/cerc/snowballtools-base-api-stack/stack-orchestrator/stacks/snowballtools-base-backend setup-repositories --git-ssh --pull + + # rebuild containers + laconic-so --stack ~/cerc/snowballtools-base-api-stack/stack-orchestrator/stacks/snowballtools-base-backend build-containers --force-rebuild + ``` + +* Push updated images to the container registry: + + ```bash + cd /srv/deploy-backend + + # login to container registry + CONTAINER_REGISTRY_URL=container-registry.apps.vaasl.io + # For credentials: "cat /srv/service-provider/webapp-deployer/config.env | grep IMAGE_REGISTRY" + CONTAINER_REGISTRY_USERNAME= + CONTAINER_REGISTRY_PASSWORD= + + docker login $CONTAINER_REGISTRY_URL --username $CONTAINER_REGISTRY_USERNAME --password $CONTAINER_REGISTRY_PASSWORD + + # Push backend images + laconic-so deployment --dir laconic-backend-deployment push-images + ``` + +* 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 = "" + bondId = "" + authority = "laconic-deploy" + [registryConfig.fee] + gasPrice = "0.001alnt" + ... + ``` + +* Restart the deployment: + + ```bash + laconic-so deployment --dir laconic-backend-deployment stop + + laconic-so deployment --dir laconic-backend-deployment start + ``` + +## Deploy Frontend + +* Source repo: + +### 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= + 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 and + cat < config.yml + services: + registry: + rpcEndpoint: https://laconicd-mainnet.laconic.com + gqlEndpoint: https://laconicd-mainnet.laconic.com/api + userKey: + bondId: + 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 diff --git a/docs/update-service-provider.md b/docs/update-service-provider.md new file mode 100644 index 0000000..7edc4da --- /dev/null +++ b/docs/update-service-provider.md @@ -0,0 +1,178 @@ +# Update Service Provider + +## Prerequisites + +A Laconic mainnet node (see [run-validator.md](./run-validator.md)) + +## Stop services + +* Stop laconic-console deployment: + + ```bash + # In directory where laconic-console deployment was created + laconic-so deployment --dir laconic-console-deployment stop + ``` + +* 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 + ``` + +## Update laconic console + +* Update the console config (`laconic-console-deployment/config.env`) if required: + + ```bash + # CLI configuration + + # laconicd RPC endpoint (can be pointed to your node) + CERC_LACONICD_RPC_ENDPOINT=https://laconicd-mainnet.laconic.com + + # laconicd GQL endpoint (can be pointed to your node) + CERC_LACONICD_GQL_ENDPOINT=https://laconicd-mainnet.laconic.com/api + + CERC_LACONICD_CHAIN_ID=laconic-mainnet + + # Console configuration + + # Laconicd (hosted) GQL endpoint (can be pointed to your node) + LACONIC_HOSTED_ENDPOINT=https://laconicd-mainnet.laconic.com + ``` + + * Update any other config values as required + +* Start the deployment: + + ```bash + laconic-so deployment --dir laconic-console-deployment start + ``` + +* Use the cli service for any registry CLI operations: + + ```bash + # Example + laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry status" + ``` + +## Check authority and deployer record + +* The state has been carried over from SAPO testnet to the mainnet, if you had authority and records on the SAPO testnet, they should be present on mainnet as well + +* Check authority: + + ```bash + # In directory where laconic-console deployment was created + AUTHORITY= + laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry authority whois $AUTHORITY" + ``` + +* Check deployer record: + + ```bash + PAYMENT_ADDRESS= + laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry record list --all --type WebappDeployer --paymentAddress $PAYMENT_ADDRESS" + ``` + +## Update webapp deployer + +* Update deployer laconic registry config (`webapp-deployer/data/config/laconic.yml`) with new endpoints: + + ```bash + services: + registry: + rpcEndpoint: "" # Eg. https://laconicd-mainnet.laconic.com + gqlEndpoint: "" # Eg. https://laconicd-mainnet.laconic.com/api + userKey: "" + bondId: "9555 + + # Set pod id + export POD_ID= + + # Example: + # export POD_ID=laconic-096fed46af974a47-deployment-644db859c7-snbq6 + ``` + +* Copy over GPG keys files to the webapp-deployer container: + + ```bash + kubie ctx default + + # Copy the GPG key files to the pod + kubectl cp $POD_ID:/app + kubectl cp $POD_ID:/app + + # Required everytime you stop and start the deployer + ``` + +* Check logs: + + ```bash + # 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 + # eg: https://console-mainnet.laconic.com + LACONIC_HOSTED_CONFIG_app_console_link= + ``` + +* Start the webapp UI: + + ```bash + laconic-so deployment --dir webapp-ui start + ``` + +* Check logs + + ```bash + laconic-so deployment --dir webapp-ui logs webapp + ```