Files
gor-deploy/deploy/publish-pricing.md

148 lines
3.6 KiB
Markdown

# publish-pricing
## Setup
- Clone the repo:
```bash
git clone git@git.vdb.to:LaconicNetwork/gor-deploy.git
cd gor-deploy/deploy
```
- Build the Docker container:
```bash
docker build -t cerc/laconic-registry-cli .
# Builds image cerc/laconic-registry-cli:latest
```
- Configure `userKey` in the [registry CLI config](./config.yml):
NOTE: The `laconic` authority is required to set the published record names so the user key should be of the account that owns the `laconic` authority (owner account address: `laconic13maulvmjxnyx3g855vk0lsv5aptf3rpxskynef`). If you don't have an authority check [steps to reserve a new authority](#reserve-a-new-authority-optional)
```bash
nano config.yml
```
## Publish Record and Set Record Name
Publishing record requires a bond with enough funds as rent is taken for each record from the bond every year
The rent amount taken is `1000000alnt` so maintaining a bond with about 10x the rent amount i.e `10000000alnt` is recommended
Make sure, the record names are under `laconic` authority
### Publish Record for Cost of alnt
- alnt price calculation (reference: <https://store.laconic.com>):
- Cost of 1 deployment is `12960` in terms of `alnt` or `5` in terms of `USD`
- Hence, cost of 1 `alnt` comes out be `0.000386 USD` rounded off to 6 decimals
- Publish the record:
```bash
./laconic-cli.sh record publish --filename records/alnt-pricing.yml --bond-id <bond-id>
```
- Get record info:
```bash
./laconic-cli.sh record get --id <record-id>
```
- Set record name for cost of alnt record:
```bash
./laconic-cli.sh name set lrn://laconic/pricing/alnt <record-id>
```
### Publish Record for Cost of Deployment
- Publish the record:
```bash
./laconic-cli.sh record publish --filename records/webapp-deployment-pricing.yml --bond-id <bond-id>
```
- Get record info:
```bash
./laconic-cli.sh record get --id <record-id>
```
- Set record name for cost of deployment record
```bash
./laconic-cli.sh name set lrn://laconic/pricing/webapp-deployment <record-id>
```
- Now you should be able to use these records in the app
- You can now continue with [steps to deploy the app](./README.md)
## Create Bond (optional)
- Create bond:
```bash
./laconic-cli.sh bond create --type alnt --quantity 10000000
```
- Get bond info:
```bash
./laconic-cli.sh bond get --id <bond-id>
```
## Reserve a New Authority (optional)
Below steps are used to reserve `laconic` authority
- Reserve authority:
```bash
./laconic-cli.sh authority reserve laconic
```
- After reserving authority, commit phase begins which lasts for 1 minute so please commit the bid following below steps within that time period
- Check authority info:
```bash
./laconic-cli.sh authority whois laconic
```
- Note down auction ID from authority info as it is required in next steps
- Get auction info:
```bash
./laconic-cli.sh auction get <auction-id>
```
- Commit an auction bid:
```bash
# 5000000 alnt is the minimum bid amount for authority auction
./laconic-cli.sh auction bid commit <auction-id> 5000000 alnt
# Example file path inside container
Reveal file: /app/deploy/out/bafyreiay2rccax64yn4ljhvzvm3jkbebvzheyucuma5jlbpzpzd5i5gjuy.json
```
- The reveal phase starts as soon as commit phase ends and lasts for 1 minute so please reveal the bid within this time period
- Reveal bid:
```bash
./laconic-cli.sh auction bid reveal <auction-id> /app/deploy/out/<reaveal-file>.json
```
- Set authority bond after winning auction as it is required to use the published authority:
```bash
./laconic-cli.sh authority bond set laconic <bond-id>
```