# Deploy
## Setup
### gor-deploy
- Clone the repo:
```bash
git clone git@git.vdb.to:LaconicNetwork/gor-deploy.git
cd gor-deploy/deploy
```
- Build registry CLI image:
```bash
docker build -t cerc/laconic-registry-cli .
# Builds image cerc/laconic-registry-cli:latest
```
- Configure `userKey` and `bondId` in the [registry CLI config](./config.yml):
- User key should be of the account that owns the `laconic-deploy` authority (owner account address: `laconic1kwx2jm6vscz38qlyujvq6msujmk8l3zangqahs`)
- The bond should also be owned by same user (owned bond's ID: `5d82586d156fb6671a9170d92f930a72a49a29afb45e30e16fff2100e30776e2`)
- If the authority is not available, follow [these steps to reserve a new authority](./publish-pricing.md#reserve-a-new-authority-optional)
```bash
nano config.yml
```
- This project requires pricing records for cost of deployment and cost of alnt to be published
- Check if these records are available by running following commands:
```bash
# Check if `lrn://laconic/pricing/webapp-deployment` is available
./laconic-cli.sh name resolve lrn://laconic/pricing/webapp-deployment
# Check if `lrn://laconic/pricing/alnt` is available
./laconic-cli.sh name resolve lrn://laconic/pricing/alnt
```
- If these records are not available, [follow these steps to publish them](./publish-pricing.md)
- Add configuration for registry operations:
```bash
cp .registry.env.example .registry.env
# Update values if required
nano .registry.env
```
- Add configuration for the app:
```bash
curl -s https://git.vdb.to/LaconicNetwork/gor-deploy/raw/branch/main/.env.example -o .app.env
# Fill in the required values
nano .app.env
```
- Required environment variables:
Client-side (must be prefixed with NEXT_PUBLIC_):
- `NEXT_PUBLIC_SOLANA_RPC_URL` - The RPC URL for the Solana blockchain (SPL token transactions)
- `NEXT_PUBLIC_GORBAGANA_RPC_URL` - The RPC URL for the Gorbagana blockchain (native GOR transactions)
- `NEXT_PUBLIC_ENABLE_NATIVE_GOR_TRANSFER` - Enable native GOR token transfers (true/false)
- `NEXT_PUBLIC_SOLANA_TOKEN_RECIPIENT_ADDRESS` - The Solana address that will receive token payments
- `NEXT_PUBLIC_ALNT_COST_LRN` - LRN for ALNT token pricing
- `NEXT_PUBLIC_DEPLOYMENT_COST_LRN` - LRN for deployment cost pricing
- `NEXT_PUBLIC_DOMAIN_SUFFIX` - Suffix to append to DNS names in the UI (e.g. ".example.com")
Server-side:
- `REGISTRY_BOND_ID` - The bond ID to use for Laconic Registry records
- `REGISTRY_AUTHORITY` - The authority for Laconic Registry LRNs
- `REGISTRY_USER_KEY` - The private key of account which will publish records
- The account should own the `laconic-deploy` authority which is set in `REGISTRY_AUTHORITY`
- `DEPLOYER_LRN` - The LRN of the deployer
## Run
- Deploy `gor-deploy` App:
```bash
# In gor-deploy/deploy dir
docker run -it \
-v ./:/app/deploy -w /app/deploy \
-e DEPLOYMENT_DNS=gor-deploy.laconic.com \
cerc/laconic-registry-cli:latest \
./deploy.sh
```
- Check deployment logs on deployer UI:
- Visit deployed app:
### Remove deployment
- Remove deployment:
```bash
# In gor-deploy/deploy dir
docker run -it \
-v ./:/app/deploy -w /app/deploy \
-e DEPLOYMENT_RECORD_ID= \
cerc/laconic-registry-cli:latest \
./remove-deployment.sh
```