testnet-laconicd-stack/ops/update-deployments.md

257 lines
6.6 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>