469 lines
12 KiB
Markdown
469 lines
12 KiB
Markdown
# Update deployments after code changes
|
|
|
|
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
|
|
```
|
|
|
|
## stage0 laconicd
|
|
|
|
* Deployment dir: `/srv/laconicd/stage0-deployment`
|
|
|
|
* If code has changed, fetch and build with updated source code:
|
|
|
|
```bash
|
|
# laconicd source
|
|
cd ~/cerc/laconicd
|
|
|
|
# Pull latest changes, or checkout to the required branch
|
|
git pull
|
|
|
|
# Confirm the latest commit hash
|
|
git log
|
|
|
|
# Rebuild the containers
|
|
cd /srv/laconicd
|
|
|
|
laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd build-containers --force-rebuild
|
|
```
|
|
|
|
* Optionally, reset the data directory (this will remove all stage0 data!):
|
|
|
|
```bash
|
|
# Stop the deployment
|
|
laconic-so deployment --dir stage0-deployment stop --delete-volumes
|
|
|
|
# Remove and recreate the required data dir
|
|
sudo rm -rf stage0-deployment/data/laconicd-data
|
|
mkdir stage0-deployment/data/laconicd-data
|
|
```
|
|
|
|
* Start the deployment:
|
|
|
|
```bash
|
|
laconic-so deployment --dir stage0-deployment start
|
|
|
|
# Follow logs for laconicd container, check that new blocks are getting created
|
|
laconic-so deployment --dir stage0-deployment logs laconicd -f
|
|
```
|
|
|
|
* If the stage0 laconicd chain has been reset, reset the faucet deployment too with new faucet key:
|
|
|
|
```bash
|
|
cd /srv/faucet
|
|
|
|
export FAUCET_ACCOUNT_PK=$(laconic-so deployment --dir /srv/laconicd/stage0-deployment exec laconicd "echo y | laconicd keys export alice --keyring-backend test --unarmored-hex --unsafe")
|
|
|
|
cat <<EOF > laconic-faucet-deployment/config.env
|
|
CERC_FAUCET_KEY=$FAUCET_ACCOUNT_PK
|
|
EOF
|
|
|
|
# Stop the deployment
|
|
laconic-so deployment --dir laconic-faucet-deployment stop --delete-volumes
|
|
|
|
# Remove and recreate the required data dir
|
|
sudo rm -rf laconic-faucet-deployment/data/faucet-data
|
|
mkdir laconic-faucet-deployment/data/faucet-data
|
|
|
|
# Start the deployment
|
|
laconic-so deployment --dir laconic-faucet-deployment start
|
|
```
|
|
|
|
## testnet-onboarding-app
|
|
|
|
* Deployment dir: `/srv/app/onboarding-app-deployment`
|
|
|
|
* If code has changed, fetch and build with updated source code:
|
|
|
|
```bash
|
|
# testnet-onboarding-app source
|
|
cd ~/cerc/testnet-onboarding-app
|
|
|
|
# Pull latest changes, or checkout to the required branch
|
|
git pull
|
|
|
|
# Confirm the latest commit hash
|
|
git log
|
|
|
|
# Rebuild the containers
|
|
cd /srv/app
|
|
|
|
laconic-so --stack ~/cerc/testnet-onboarding-app-stack/stack-orchestrator/stacks/onboarding-app build-containers --force-rebuild
|
|
```
|
|
|
|
* Update the configuration, if required in `onboarding-app-deployment/config.env`:
|
|
|
|
```bash
|
|
WALLET_CONNECT_ID=63...
|
|
|
|
CERC_REGISTRY_GQL_ENDPOINT="https://laconicd.laconic.com/api"
|
|
CERC_LACONICD_RPC_ENDPOINT="https://laconicd.laconic.com"
|
|
|
|
CERC_FAUCET_ENDPOINT="https://faucet.laconic.com"
|
|
|
|
CERC_WALLET_META_URL="https://loro-signup.laconic.com"
|
|
|
|
CERC_STAKING_AMOUNT=1000000000000000
|
|
````
|
|
|
|
* Restart the deployment:
|
|
|
|
```bash
|
|
laconic-so deployment --dir onboarding-app-deployment stop
|
|
|
|
laconic-so deployment --dir onboarding-app-deployment start
|
|
|
|
# Follow logs for testnet-onboarding-app container, wait for the build to finish
|
|
laconic-so deployment --dir onboarding-app-deployment logs testnet-onboarding-app -f
|
|
```
|
|
|
|
* The updated onboarding app can now be viewed at <https://loro-signup.laconic.com>
|
|
|
|
## 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, or checkout to the required branch
|
|
git pull
|
|
|
|
# Confirm the latest commit hash
|
|
git log
|
|
|
|
# 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, if required in `laconic-wallet-web-deployment/config.env`:
|
|
|
|
```bash
|
|
WALLET_CONNECT_ID=63...
|
|
```
|
|
|
|
* 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 <https://wallet.laconic.com>
|
|
|
|
## stage1 laconicd
|
|
|
|
* Deployment dir: `/srv/laconicd/stage1-deployment`
|
|
|
|
* If code has changed, fetch and build with updated source code:
|
|
|
|
```bash
|
|
# laconicd source
|
|
cd ~/cerc/laconicd
|
|
|
|
# Pull latest changes, or checkout to the required branch
|
|
git pull
|
|
|
|
# Confirm the latest commit hash
|
|
git log
|
|
|
|
# Rebuild the containers
|
|
cd /srv/laconicd
|
|
|
|
laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd build-containers --force-rebuild
|
|
```
|
|
|
|
* Optionally, reset the data directory:
|
|
|
|
```bash
|
|
# Stop the deployment
|
|
laconic-so deployment --dir stage1-deployment stop --delete-volumes
|
|
|
|
# Remove and recreate the required data dirs
|
|
sudo rm -rf stage1-deployment/data/laconicd-data stage1-deployment/data/genesis-config
|
|
|
|
mkdir stage1-deployment/data/laconicd-data
|
|
mkdir stage1-deployment/data/genesis-config
|
|
```
|
|
|
|
* Update the configuration, if required in `stage1-deployment/config.env`:
|
|
|
|
```bash
|
|
AUTHORITY_AUCTION_ENABLED=true
|
|
AUTHORITY_AUCTION_COMMITS_DURATION=3600
|
|
AUTHORITY_AUCTION_REVEALS_DURATION=3600
|
|
AUTHORITY_GRACE_PERIOD=7200
|
|
```
|
|
|
|
* Follow [stage0-to-stage1.md](./stage0-to-stage1.md) to generate the genesis file for stage1 and start the deployment
|
|
|
|
## 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, or checkout to the required branch
|
|
git pull
|
|
|
|
# Confirm the latest commit hash
|
|
git log
|
|
|
|
# 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.laconic.com
|
|
```
|
|
|
|
* 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 <https://loro-console.laconic.com>
|
|
|
|
## Connect webapp-deployer with stage2 laconicd chain
|
|
|
|
Follow the steps given below to connect the webapp-deployer to stage2 laconicd
|
|
|
|
<details open>
|
|
<summary>Update laconic console config</summary>
|
|
|
|
### 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
|
|
```
|
|
</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
|
|
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 <api-url-for-your-deployer>
|
|
--public-key-file <path-to-your-gpg-pub-key> \
|
|
--lrn <lrn-for-your-deployer> \
|
|
--min-required-payment 0
|
|
```
|
|
|
|
* Update `webapp-deployer/config.env` with the authority that you reserved
|
|
|
|
```bash
|
|
# Name of reserved authority
|
|
DEPLOYMENT_RECORD_NAMESPACE="<authority_name>"
|
|
```
|
|
</details>
|
|
|
|
<details open>
|
|
<summary>Start the deployer</summary>
|
|
|
|
### 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 <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
|
|
```
|
|
|
|
</details>
|