diff --git a/ops/update-deployments.md b/ops/update-deployments.md index 5b31d33..3bfd3b1 100644 --- a/ops/update-deployments.md +++ b/ops/update-deployments.md @@ -254,215 +254,3 @@ Instructions to reset / update the deployments ``` * The laconic console can now be viewed at - -## Connect webapp-deployer with stage2 laconicd chain - -Follow the steps given below to connect the webapp-deployer to stage2 laconicd - -
- Update laconic console config - -### Update laconic console config - -* Stop webapp deployer backend - - ```bash - laconic-so deployment --dir webapp-deployer stop - ``` - -* 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 - CERC_LACONICD_RPC_ENDPOINT=https://laconicd.laconic.com - - # GQL endpoint of the chain - CERC_LACONICD_GQL_ENDPOINT=https://laconicd.laconic.com/api - - # laconicd chain id - CERC_LACONICD_CHAIN_ID=laconic_9000-2 - - # Endpoint for the console - LACONIC_HOSTED_ENDPOINT=https://laconicd.laconic.com - ``` - -* Start the `laconic-console-deployment`: - - ```bash - laconic-so deployment --dir laconic-console-deployment start - ``` -
- -
- Register an authority - -### 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 " - ``` - -* Obtain the auction ID - - ```bash - laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry authority whois " - # "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 a742489e5817ef274187611dadb0e4284a49c087608b545ab6bd990905fb61f3" - # {"success": true} - ``` - -* Verify the authority has been registered. - - ```bash - laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry authority whois " - ``` - -* 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 - ``` - -
- -
- Publish record for webapp-deployer - -### Publish record for webapp-deployer - -* Update `webapp-deployer/data/config/laconic.yml` with the - - ```bash - services: - registry: - # laconicd RPC endpoint - rpcEndpoint: 'https://laconicd.laconic.com' - - # laconicd GQL endpoint - gqlEndpoint: 'https://laconicd.laconic.com/api' - - # Key to your funded account - userKey: - - # bondId that you just created - bondId: a742489e5817ef274187611dadb0e4284a49c087608b545ab6bd990905fb61f3 - - # laconicd chain id - chainId: laconic_9000-2 - gas: 200000 - fees: 500000alnt - ``` - -* Publish the webapp deployer record using the publish-deployer-to-registry command - - ```bash - laconic-so publish-deployer-to-registry \ - --laconic-config webapp-deployer/data/config/laconic.yml \ - --api-url - --public-key-file \ - --lrn \ - --min-required-payment 0 - ``` - -* Update `webapp-deployer/config.env` with the authority that you reserved - - ```bash - # Name of reserved authority - DEPLOYMENT_RECORD_NAMESPACE="" - ``` -
- -
- Start the deployer - -### Start the deployer - -* Start the webapp deployer - - ```bash - laconic-so deployment --dir webapp-deployer start - ``` - -* Get the most recent pod id: - - ```bash - kubie ctx default - kubectl get pods - ``` - -* 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 laconic-ac473c31db9ac9fd-deployment-674bf7bf9f-529bs:/app - kubectl cp laconic-ac473c31db9ac9fd-deployment-674bf7bf9f-529bs:/app - ``` - -
diff --git a/ops/update-webapp-deployer.md b/ops/update-webapp-deployer.md new file mode 100644 index 0000000..58df9a2 --- /dev/null +++ b/ops/update-webapp-deployer.md @@ -0,0 +1,362 @@ +## Update webapp deployer after code changes + +* Stop the deployer + + ```bash + cd + laconic-so deployment --dir webapp-deployer stop + laconic-so deployment --dir webapp-ui stop + ``` + +* Fetch and build webapp deployer backend if the source code has changed + + ```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 + ``` + +* Fetch and build webapp-ui if the source code has changed + + ```bash + # Update code for webapp-deployer backend + cd ~/cerc/webapp-deployment-status-ui + + # Pull latest changes, or checkout to the required branch + git pull + + # Confirm the latest commit hash + git log + + # Rebuild the containers + laconic-so build-webapp --source-repo ~/cerc/webapp-deployment-status-ui build-containers --force-rebuild + cd + ``` + +* 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 + ``` + + * Push images to container registry + + ```bash + laconic-so deployment --dir webapp-deployer push-images + laconic-so deployment --dir webapp-ui 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: "" + bondId: " laconic-ac473c31db9ac9fd-deployment-674bf7bf9f-529bs:/app + kubectl cp 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 + +
+ Update laconic console config + +### Update laconic console config + +* Stop webapp deployer backend + + ```bash + laconic-so deployment --dir webapp-deployer stop + ``` + +* 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 + CERC_LACONICD_RPC_ENDPOINT=https://laconicd-sapo.laconic.com + + # GQL endpoint of the chain + CERC_LACONICD_GQL_ENDPOINT=https://laconicd-sapo.laconic.com/api + + # laconicd chain id + CERC_LACONICD_CHAIN_ID=laconic_9000-2 + + # Endpoint for the console + LACONIC_HOSTED_ENDPOINT=https://console-sapo.laconic.com + ``` + +* Start the `laconic-console-deployment` + + ```bash + laconic-so deployment --dir laconic-console-deployment start + ``` +
+ +
+ Register an authority + +### 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 " + ``` + +* Obtain the auction ID + + ```bash + laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry authority whois " + # "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 a742489e5817ef274187611dadb0e4284a49c087608b545ab6bd990905fb61f3" + # {"success": true} + ``` + +* Verify the authority has been registered. + + ```bash + laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry authority whois " + ``` + +* 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 + ``` + +
+ +
+ Publish record for webapp-deployer + +### Publish record for webapp-deployer + +* Update `webapp-deployer/data/config/laconic.yml` with the + + ```bash + services: + registry: + # laconicd RPC endpoint + rpcEndpoint: 'https://laconicd-sapo.laconic.com' + + # laconicd GQL endpoint + gqlEndpoint: 'https://laconicd-sapo.laconic.com/api' + + # Key to your funded account + userKey: + + # bondId that you just created + bondId: a742489e5817ef274187611dadb0e4284a49c087608b545ab6bd990905fb61f3 + + # laconicd chain id + chainId: laconic_9000-2 + gas: 200000 + fees: 500000alnt + ``` + +* Publish the webapp deployer record using the publish-deployer-to-registry command + + ```bash + laconic-so publish-deployer-to-registry \ + --laconic-config webapp-deployer/data/config/laconic.yml \ + --api-url + --public-key-file \ + --lrn \ + --min-required-payment 0 + ``` + +* Update `webapp-deployer/config.env` with the authority that you reserved + + ```bash + # Name of reserved authority + DEPLOYMENT_RECORD_NAMESPACE="" + ``` +
+ +
+ Start the deployer + +### Start the deployer + +* Start the webapp deployer + + ```bash + laconic-so deployment --dir webapp-deployer start + ``` + +* Get the most recent pod id + + ```bash + kubie ctx default + kubectl get pods + ``` + +* 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 laconic-ac473c31db9ac9fd-deployment-674bf7bf9f-529bs:/app + kubectl cp laconic-ac473c31db9ac9fd-deployment-674bf7bf9f-529bs:/app + ``` + +