testnet-laconicd-stack/ops/update-deployments.md
Prathamesh Musale 0d8628d7c3 Add steps to update testnet2 deployments (#38)
Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8)

Added steps to update deployments:
- stage2 laconicd
- laconic-console-testnet2
- laconic-shopify
- fixturenet-eth
- Nitro bridge
- Nitro nodes
- Snowball backend
- Snowball frontend

Co-authored-by: Adw8 <adwaitgharpure@gmail.com>
Reviewed-on: #38
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-10-30 13:59:56 +00:00

11 KiB

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:

    cd /srv
    

stage0 laconicd

  • Deployment dir: /srv/laconicd/stage0-deployment

  • If code has changed, fetch and build with updated source code:

    # 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!):

    # 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:

    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:

    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:

    # 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:

    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:

    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:

    # 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:

    WALLET_CONNECT_ID=63...
    
  • Restart the deployment:

    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:

    # 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:

    # 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:

    AUTHORITY_AUCTION_ENABLED=true
    AUTHORITY_AUCTION_COMMITS_DURATION=3600
    AUTHORITY_AUCTION_REVEALS_DURATION=3600
    AUTHORITY_GRACE_PERIOD=7200
    
  • Follow 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:

    # 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:

    # Laconicd (hosted) GQL endpoint
    LACONIC_HOSTED_ENDPOINT=https://laconicd.laconic.com
    
  • Restart the deployment:

    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


stage2 laconicd

  • Deployment dir: /srv/laconicd/stage2-deployment

  • If code has changed, fetch and build with updated source code:

    # 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:

    # Stop the deployment
    laconic-so deployment --dir stage2-deployment stop --delete-volumes
    
    # Remove and recreate the required data dirs
    sudo rm -rf stage2-deployment/data/laconicd-data stage2-deployment/data/genesis-config
    
    mkdir stage2-deployment/data/laconicd-data
    mkdir stage2-deployment/data/genesis-config
    
  • Follow stage1-to-stage2.md to reinitialize stage2 and start the deployment

laconic-console-testnet2

  • Deployment dir: /srv/console/laconic-console-testnet2-deployment

  • Steps to update the deployment similar as in laconic-console

Laconic Shopify

  • Deployment dir: /srv/shopify/laconic-shopify-deployment

  • If code has changed, fetch and build with updated source code:

    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-shopify setup-repositories --git-ssh --pull
    
    # rebuild containers
    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-shopify build-containers --force-rebuild
    
  • Update the configuration if required in laconic-shopify-deployment/config.env

  • Restart the deployment:

    cd /srv/shopify
    
    laconic-so deployment --dir laconic-shopify-deployment stop
    
    laconic-so deployment --dir laconic-shopify-deployment start
    

Fixturenet Eth

  • Deployment dir: /srv/fixturenet-eth/fixturenet-eth-deployment

  • If code has changed, fetch and build with updated source code:

    laconic-so --stack ~/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth setup-repositories --git-ssh --pull
    
    # Rebuild the containers
    laconic-so --stack ~/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth build-containers --force-rebuild
    
  • Update the configuration if required in fixturenet-eth-deployment/config.env:

    CERC_ALLOW_UNPROTECTED_TXS=true
    
  • Restart the deployment:

    cd /srv/fixturenet-eth
    
    laconic-so deployment --dir fixturenet-eth-deployment stop
    
    laconic-so deployment --dir fixturenet-eth-deployment start
    

Nitro Bridge

  • Deployment dir: /srv/bridge/bridge-deployment

  • Rebuild containers:

    # Rebuild the containers
    laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge build-containers --force-rebuild
    
  • Update the configuration if required in bridge-deployment/config.env

  • Restart the bridge deployment:

    cd /srv/bridge
    
    laconic-so deployment --dir bridge-deployment stop
    
    laconic-so deployment --dir bridge-deployment start
    

Backend Deployment

  • Deployment dir: /srv/deploy-backend/backend-deployment

  • If code has changed, fetch and build with updated source code:

    laconic-so --stack ~/cerc/snowballtools-base-api-stack/stack-orchestrator/stacks/snowballtools-base-backend setup-repositories --git-ssh --pull
    
    # rebuild containers
    laconic-so --stack ~/cerc/snowballtools-base-api-stack/stack-orchestrator/stacks/snowballtools-base-backend build-containers --force-rebuild
    
  • Push updated images to the container registry:

    cd /srv/deploy-backend
    
    # login to container registry
    CONTAINER_REGISTRY_URL=container-registry.apps.vaasl.io
    CONTAINER_REGISTRY_USERNAME=
    CONTAINER_REGISTRY_PASSWORD=
    
    docker login $CONTAINER_REGISTRY_URL --username $CONTAINER_REGISTRY_USERNAME --password $CONTAINER_REGISTRY_PASSWORD
    
    # Push backend images
    laconic-so deployment --dir backend-deployment push-images
    
  • Update the configuration if required in backend-deployment/configmaps/config/prod.toml

  • Restart the deployment:

    laconic-so deployment --dir backend-deployment stop
    
    laconic-so deployment --dir backend-deployment start
    

Frontend Deployment