testnet-laconicd-stack/ops/deployments-from-scratch.md
Nabarun 9df6a71145 Add monikers to laconicd stage0 and stage1 nodes (#20)
Part of [laconicd testnet validator enrollment](cerc-io/testnet-laconicd-stack#19)

Reviewed-on: cerc-io/testnet-laconicd-stack#20
Co-authored-by: Nabarun <nabarun@deepstacksoft.com>
Co-committed-by: Nabarun <nabarun@deepstacksoft.com>
2024-08-09 12:58:59 +00:00

16 KiB

Create deployments from scratch (for reference only)

Login

  • Log in as dev user on the deployments VM

  • All the deployments are placed in the /srv directory:

    cd /srv
    
stage0 laconicd

stage0 laconicd

Setup

  • Clone the stack repo:

    laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-laconicd-stack --pull
    
    # This should clone the fixturenet-laconicd-stack repo at `/home/dev/cerc/fixturenet-laconicd-stack`
    
  • Clone required repositories:

    laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd setup-repositories --pull
    
    # This should clone the laconicd repo at `/home/dev/cerc/laconicd`
    
  • Build the container images:

    laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd build-containers --force-rebuild
    
    # This should create the "cerc/laconicd" Docker image
    

Deployment

  • Create a spec file for the deployment:

    cd /srv/laconicd
    
    laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd deploy init --output stage0-spec.yml
    
  • Edit network in the spec file to map container ports to host ports:

    # stage0-spec.yml
    network:
      ports:
        laconicd:
          - '6060'
          - '127.0.0.1:26657:26657'
          - '26656'
          - '127.0.0.1:9473:9473'
          - '127.0.0.1:9090:9090'
          - '127.0.0.1:1317:1317'
    
  • Create a deployment from the spec file:

    laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd deploy create --spec-file stage0-spec.yml --deployment-dir stage0-deployment
    
  • Update the configuration:

    cat <<EOF > stage0-deployment/config.env
    # Set to true to enable adding participants functionality of the onboarding module
    ONBOARDING_ENABLED=true
    
    # A custom human readable name for this node
    MONIKER=LaconicStage0
    EOF
    

Start

  • Start the deployment:

    laconic-so deployment --dir stage0-deployment start
    
  • Check status:

    # List down the containers and check health status
    docker ps -a | grep laconicd
    
    # Follow logs for laconicd container, check that new blocks are getting created
    laconic-so deployment --dir stage0-deployment logs laconicd -f
    
  • Verify that endpoint is now publicly accessible:

    • https://laconicd.laconic.com is pointed to the node's RPC endpoint

    • Check status query:

      curl https://laconicd.laconic.com/status | jq
      
      # Expected output:
      # JSON with `node_info`, `sync_info` and `validator_info`
      
faucet

faucet

Setup

  • Clone the stack repo:

    laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack --pull
    
    # This should clone the testnet-laconicd-stack repo at `/home/dev/cerc/testnet-laconicd-stack`
    
  • Clone required repositories:

    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet setup-repositories --pull
    
    # This should clone the laconicd repo at `/home/dev/cerc/laconic-faucet
    
  • Build the container images:

    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet build-containers --force-rebuild
    
    # This should create the "cerc/laconic-faucet" Docker image
    

Deployment

  • Create a spec file for the deployment:

    cd /srv/faucet
    
    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet deploy init --output laconic-faucet-spec.yml
    
  • Edit network in the spec file to map container ports to host ports:

    # laconic-faucet-spec.yml
    network:
      ports:
        faucet:
          - '127.0.0.1:4000:3000'
    
  • Create a deployment from the spec file:

    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet deploy create --spec-file laconic-faucet-spec.yml --deployment-dir laconic-faucet-deployment
    
    # Place in the same namespace as stage0
    cp /srv/laconicd/stage0-deployment/deployment.yml laconic-faucet-deployment/deployment.yml
    
  • Update the configuration:

    # Get the faucet account key from stage0 deployment
    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
    

Start

  • Start the deployment:

    laconic-so deployment --dir laconic-faucet-deployment start
    
  • Check status:

    # List down the containers and check health status
    docker ps -a | grep faucet
    
    # Check logs for faucet container
    laconic-so deployment --dir laconic-faucet-deployment logs faucet -f
    
  • Verify that endpoint is now publicly accessible:

    • https://faucet.laconic.com is pointed to the faucet endpoint

    • Check faucet:

      curl -X POST https://faucet.laconic.com/faucet
      
      # Expected output:
      # {"error":"address is required"}
      
testnet-onboarding-app

testnet-onboarding-app

Setup

  • Clone the stack repo:

    laconic-so fetch-stack git.vdb.to/cerc-io/testnet-onboarding-app-stack --pull
    
    # This should clone the testnet-onboarding-app-stack repo at `/home/dev/cerc/testnet-onboarding-app-stack`
    
  • Clone required repositories:

    laconic-so --stack ~/cerc/testnet-onboarding-app-stack/stack-orchestrator/stacks/onboarding-app setup-repositories --pull
    
    # This should clone the testnet-onboarding-app repo at `/home/dev/cerc/testnet-onboarding-app`
    
  • Build the container images:

    laconic-so --stack ~/cerc/testnet-onboarding-app-stack/stack-orchestrator/stacks/onboarding-app build-containers --force-rebuild
    
    # This should create the Docker image "cerc/testnet-onboarding-app" locally
    

Deployment

  • Create a spec file for the deployment:

    cd /srv/app
    
    laconic-so --stack ~/cerc/testnet-onboarding-app-stack/stack-orchestrator/stacks/onboarding-app deploy init --output onboarding-app-spec.yml
    
  • Edit network in the spec file to map container ports to host ports:

    network:
      ports:
        testnet-onboarding-app:
          - '127.0.0.1:3000:80'
    
  • Create a deployment from the spec file:

    laconic-so --stack ~/cerc/testnet-onboarding-app-stack/stack-orchestrator/stacks/onboarding-app deploy create --spec-file onboarding-app-spec.yml --deployment-dir onboarding-app-deployment
    
  • Update the configuration:

    cat <<EOF > 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"
    EOF
    

Start

  • Start the deployment:

    laconic-so deployment --dir onboarding-app-deployment start
    
  • Check status:

    # List down the container
    docker ps -a | grep testnet-onboarding-app
    
    # 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 onboarding app can now be viewed at https://loro-signup.laconic.com

laconic-wallet-web

laconic-wallet-web

Setup

  • Clone the stack repo:

    laconic-so fetch-stack git.vdb.to/cerc-io/laconic-wallet-web --pull
    
    # This should clone the laconic-wallet-web repo at `/home/dev/cerc/laconic-wallet-web`
    
  • Build the container images:

    laconic-so --stack ~/cerc/laconic-wallet-web/stack/stack-orchestrator/stack/laconic-wallet-web build-containers --force-rebuild
    
    # This should create the Docker image "cerc/laconic-wallet-web" locally
    

Deployment

  • Create a spec file for the deployment:

    cd /srv/wallet
    
    laconic-so --stack ~/cerc/laconic-wallet-web/stack/stack-orchestrator/stack/laconic-wallet-web deploy init --output laconic-wallet-web-spec.yml
    
  • Edit network in the spec file to map container ports to host ports:

    network:
      ports:
        laconic-wallet-web:
          - '127.0.0.1:5000:80'
    
  • Create a deployment from the spec file:

    laconic-so --stack ~/cerc/laconic-wallet-web/stack/stack-orchestrator/stack/laconic-wallet-web deploy create --spec-file laconic-wallet-web-spec.yml --deployment-dir laconic-wallet-web-deployment
    
  • Update the configuration:

    cat <<EOF > laconic-wallet-web-deployment/config.env
    WALLET_CONNECT_ID=63...
    EOF
    

Start

  • Start the deployment:

    laconic-so deployment --dir laconic-wallet-web-deployment start
    
  • Check status:

    # List down the container
    docker ps -a | grep laconic-wallet-web
    
    # 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

stage1 laconicd

Setup

  • Same as that for stage0 laconicd, not required if already done for stage0

Deployment

  • Create a spec file for the deployment:

    cd /srv/laconicd
    
    laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd deploy init --output stage1-spec.yml
    
  • Edit network in the spec file to map container ports to host ports:

    # stage1-spec.yml
    network:
      ports:
        laconicd:
          - '6060'
          - '127.0.0.1:26657:26657'
          - '26656:26656'
          - '127.0.0.1:9473:9473'
          - '127.0.0.1:9090:9090'
          - '127.0.0.1:1317:1317'
    
  • Create a deployment from the spec file:

    laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd deploy create --spec-file stage1-spec.yml --deployment-dir stage1-deployment
    
  • Update the configuration:

    cat <<EOF > stage1-deployment/config.env
    AUTHORITY_AUCTION_ENABLED=true
    AUTHORITY_AUCTION_COMMITS_DURATION=3600
    AUTHORITY_AUCTION_REVEALS_DURATION=3600
    AUTHORITY_GRACE_PERIOD=7200
    
    MONIKER=LaconicStage1
    EOF
    

Start

  • Follow stage0-to-stage1.md to halt stage0 deployment, generate the genesis file for stage1 and start the stage1 deployment
laconic-console

laconic-console

Setup

  • Clone the stack repo:

    laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack --pull
    
    # This should clone the testnet-laconicd-stack repo at `/home/dev/cerc/testnet-laconicd-stack`
    
  • Clone required repositories:

    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console setup-repositories --pull
    
    # This should clone the laconic-registry-cli repo at `/home/dev/cerc/laconic-registry-cli`, laconic-console repo at `/home/dev/cerc/laconic-console`
    
  • Build the container images:

    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console build-containers --force-rebuild
    
    # This should create the Docker images: "cerc/laconic-registry-cli", "cerc/webapp-base", "cerc/laconic-console-host"
    

Deployment

  • Create a spec file for the deployment:

    cd /srv/console
    
    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console deploy init --output laconic-console-spec.yml
    
  • Edit network in the spec file to map container ports to host ports:

    network:
      ports:
        laconic-console:
          - '127.0.0.1:4001:80'
    
  • Create a deployment from the spec file:

    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console deploy create --spec-file laconic-console-spec.yml --deployment-dir laconic-console-deployment
    
  • Update the configuration:

    cat <<EOF > laconic-console-deployment/config.env
    # Laconicd (hosted) GQL endpoint
    LACONIC_HOSTED_ENDPOINT=https://laconicd.laconic.com
    EOF
    

Start

  • Start the deployment:

    laconic-so deployment --dir laconic-console-deployment start
    
  • Check status:

    # List down the container
    docker ps -a | grep console
    
    # 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

Domains / Port Mappings

laconicd.laconic.com        -> 26657
laconicd.laconic.com/api    -> 9473/api
faucet.laconic.com          -> 4000
loro-signup.laconic.com     -> 3000
wallet.laconic.com          -> 5000
loro-console.laconic.com    -> 4001