Improve ops instructions for snowball backend deployment (#40)

Part of [Service provider auctions for web deployments](https://www.notion.so/Service-provider-auctions-for-web-deployments-104a6b22d47280dbad51d28aa3a91d75)

Reviewed-on: #40
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
This commit is contained in:
Prathamesh Musale 2024-11-07 07:23:07 +00:00 committed by nabarun
parent dca0d1b38a
commit b4c272254f

View File

@ -1032,18 +1032,12 @@ Follow [sp-deployment-from-scratch.md](./sp-deployment-from-scratch.md)
# This should create the Docker images: "cerc/snowballtools-base-backend" and "cerc/snowballtools-base-backend-base"
```
* Push the images to the container registry. The container registry will be set up while setting up a service provider
```bash
laconic-so deployment --dir backend-deployment push-images
```
### Deployment
* Create a spec file for the deployment:
```bash
cd /srv/backend-deployment
cd /srv/deploy-backend
laconic-so --stack ~/cerc/snowballtools-base-api-stack/stack-orchestrator/stacks/snowballtools-base-backend deploy init --output backend-deployment-spec.yml --config SNOWBALL_BACKEND_CONFIG_FILE_PATH=/config/prod.toml
```
@ -1080,7 +1074,15 @@ Follow [sp-deployment-from-scratch.md](./sp-deployment-from-scratch.md)
# This should create the deployment directory at `/srv/deploy-backend/backend-deployment`
```
* Modify file `backend-deployment/kubeconfig.yml` if required:
* Push the images to the container registry. The container registry is set up as part of service provider:
```bash
docker login <container-registry-url> --username <username> --password <password>
laconic-so deployment --dir backend-deployment push-images
```
* Modify file `backend-deployment/kubeconfig.yml`:
```bash
apiVersion: v1
@ -1099,98 +1101,115 @@ Follow [sp-deployment-from-scratch.md](./sp-deployment-from-scratch.md)
```bash
# Place in snowball deployment directory
wget -O /srv/deploy-backend/backend-deployment/configmaps/config/prod.toml https://git.vdb.to/cerc-io/testnet-laconicd-stack/raw/branch/main/ops/configs/backend-deployment.toml
wget -O /srv/deploy-backend/backend-deployment/configmaps/config/prod.toml https://git.vdb.to/cerc-io/testnet-laconicd-stack/raw/branch/main/ops/configs/backend-config.toml
```
* Setup private key and bond. If not already setup, execute the following commands in the directory containing `stage2-deployment`
* Setup private key and bond; run following steps if not already created:
* Create a new account and fetch the private key
* Create a new account and get the private key:
```bash
# Switch to laconicd deployments directory
cd /srv/laconicd
laconic-so deployment --dir stage2-deployment exec laconicd "laconicd keys add deploy"
# - address: laconic1yr758d5vkg28text073vlzdjdgd7ud6w729tww
...
export deployKey=$(laconic-so deployment --dir stage2-deployment exec laconicd "echo y | laconicd keys export deploy --keyring-backend test --unarmored-hex --unsafe")
# ...
# txhash: 262D380259AC06024F87C909EB0BF7814CEC26CDF527B003C4C10631E1DB5893
deployAddress=<address>
deployKey=$(laconic-so deployment --dir stage2-deployment exec laconicd "echo y | laconicd keys export deploy --keyring-backend test --unarmored-hex --unsafe")
```
* Send tokens to this account
* Send tokens to the new account:
```bash
laconic-so deployment --dir stage2-deployment exec laconicd "laconicd tx bank send alice laconic1yr758d5vkg28text073vlzdjdgd7ud6w729tww 1000000000000000000alnt --from alice --fees 200000alnt -y"
laconic-so deployment --dir stage2-deployment exec laconicd "laconicd tx bank send alice $deployAddress 1000000000000000000alnt --from alice --fees 200000alnt -y"
```
* Create a bond using this account
* Create a bond using this account:
```bash
laconic-so deployment --dir laconic-console-testnet2-deployment exec cli "laconic registry bond create --type alnt --quantity 1000000000000 --user-key $deployKey" | jq -r '.bondId'
# 15e5bc37c40f67adc9ab498fa3fa50b090770f9bb56b27d71714a99138df9a22
```
* Set bond id
* Set bond id:
```bash
export bondId=15e5bc37c40f67adc9ab498fa3fa50b090770f9bb56b27d71714a99138df9a22
bondId=<bond-id>
```
* Register authority. Execute the following commands in the directory containing `laconic-console-testnet2-deployment`
* Register authority:
* Reserve an authority
* Reserve an authority:
```bash
laconic-so deployment --dir laconic-console-testnet2-deployment exec cli "laconic registry authority reserve deploy-vaasl --txKey $deployKey"
# Switch to console deployments directory
cd /srv/console
authority=vaasl
laconic-so deployment --dir laconic-console-testnet2-deployment exec cli "laconic registry authority reserve $authority --txKey $deployKey"
```
* Obtain the auction ID
* Obtain the authority auction ID:
```bash
laconic-so deployment --dir laconic-console-testnet2-deployment exec cli "laconic registry authority whois deploy-vaasl --txKey $deployKey"
laconic-so deployment --dir laconic-console-testnet2-deployment exec cli "laconic registry authority whois $authority"
# "auction": {
# "id": "73e0b082a198c396009ce748804a9060c674a10045365d262c1584f99d2771c1"
# Set auction id in a variable
auction=<auction-id>
```
* Commit a bid using the auction ID. A reveal file will be generated
* Commit a bid using the auction ID, a reveal file will be generated:
```bash
laconic-so deployment --dir laconic-console-testnet2-deployment exec cli "laconic registry auction bid commit 73e0b082a198c396009ce748804a9060c674a10045365d262c1584f99d2771c1 5000000 alnt --chain-id laconic-testnet-2 --txKey $deployKey"
laconic-so deployment --dir laconic-console-testnet2-deployment exec cli "laconic registry auction bid commit $auction 5000000 alnt --chain-id laconic-testnet-2 --txKey $deployKey"
# {"reveal_file":"/app/out/bafyreiewi4osqyvrnljwwcb36fn6sr5iidfpuznqkz52gxc5ztt3jt4zmy.json"}
# Set reveal file path in a variable
revealFile=/app/out/bafyreiewi4osqyvrnljwwcb36fn6sr5iidfpuznqkz52gxc5ztt3jt4zmy.json
```
* Reveal a bid using the auction ID and the reveal file generated from the bid commit
* Reveal a bid using the auction ID and the reveal file generated from the bid commit:
```bash
laconic-so deployment --dir laconic-console-testnet2-deployment exec cli "laconic registry auction bid reveal 73e0b082a198c396009ce748804a9060c674a10045365d262c1584f99d2771c1 /app/out/bafyreiewi4osqyvrnljwwcb36fn6sr5iidfpuznqkz52gxc5ztt3jt4zmy.json --chain-id laconic-testnet-2 --txKey $deployKey"
laconic-so deployment --dir laconic-console-testnet2-deployment exec cli "laconic registry auction bid reveal $auction $revealFile --chain-id laconic-testnet-2 --txKey $deployKey"
# {"success": true}
```
* Verify status after the auction ends. It should list a completed status and a winner
* Verify status after the auction ends. It should list a completed status and a winner:
```bash
laconic-so deployment --dir laconic-console-testnet2-deployment exec cli "laconic registry auction get 73e0b082a198c396009ce748804a9060c674a10045365d262c1584f99d2771c1 -txKey $deployKey"
laconic-so deployment --dir laconic-console-testnet2-deployment exec cli "laconic registry auction get $auction"
```
* Set the authority using a bond ID.
* Set the authority using a bond ID:
```bash
laconic-so deployment --dir laconic-console-testnet2-deployment exec cli "laconic registry authority bond set deploy-vaasl $bondId --txKey $deployKey"
laconic-so deployment --dir laconic-console-testnet2-deployment exec cli "laconic registry authority bond set $authority $bondId --txKey $deployKey"
# {"success": true}
```
* Verify the authority has been registered.
* Verify the authority has been registered:
```bash
laconic-so deployment --dir laconic-console-testnet2-deployment exec cli "laconic registry authority whois deploy-vaasl --txKey $deployKey"
laconic-so deployment --dir laconic-console-testnet2-deployment exec cli "laconic registry authority whois $authority"
```
* Update `/srv/snowball/snowball-deployment/data/config/prod.toml`. Replace `<redacted>` with your credentials. Use the `userKey`, `bondId` and `authority` that you set up
* Update `/srv/deploy-backend/backend-deployment/data/config/prod.toml`. Replace `<redacted>` with your credentials; use the `userKey`, `bondId` and `authority` that you set up
### Start
* Start the deployment:
```bash
cd /srv/deploy-backend
laconic-so deployment --dir backend-deployment start
```
@ -1271,7 +1290,7 @@ Follow [sp-deployment-from-scratch.md](./sp-deployment-from-scratch.md)
* Run frontend deployment script:
```bash
./deploy-frontend.sh
./deploy-frontend.vaasl.sh
```
Follow deployment logs on the deployer UI