stack-orchestrator/app/data/stacks/mobymask-v2
prathamesh0 71aaa41069
Upgrade dependencies and start inline watcher peer in mobymask-v2 stack (#256)
* Upgrade dependencies in mobymask-v2 stack

* Run inline watcher peer in mobymask v2 stack

---------

Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2023-03-30 09:44:15 +05:30
..
demo.md Upgrade dependencies and start inline watcher peer in mobymask-v2 stack (#256) 2023-03-30 09:44:15 +05:30
README.md Upgrade dependencies and start inline watcher peer in mobymask-v2 stack (#256) 2023-03-30 09:44:15 +05:30
stack.yml Add web-apps and laconicd in MobyMask v2 watcher stack (#226) 2023-03-24 15:53:54 +04:00

MobyMask v2 watcher

Instructions to deploy MobyMask v2 watcher stack using laconic-stack-orchestrator

Setup

Clone required repositories:

laconic-so --stack mobymask-v2 setup-repositories

NOTE: If repositories already exist and are checked out to different versions, setup-repositories command will throw an error. For getting around this, the repositories mentioned below can be removed and then run the command.

Checkout to the required versions and branches in repos

# watcher-ts
cd ~/cerc/watcher-ts
git checkout v0.2.34

# react-peer
cd ~/cerc/react-peer
git checkout v0.2.31

# mobymask-ui
cd ~/cerc/mobymask-ui
git checkout laconic

# laconicd
cd ~/cerc/laconicd
git checkout v0.8.0

# MobyMask
cd ~/cerc/MobyMask
git checkout v0.1.1

Build the container images:

laconic-so --stack mobymask-v2 build-containers

This should create the required docker images in the local image registry.

Deploy the stack:

  • Deploy the laconic chain

    laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd up
    
  • Check that laconic chain status is healthy

    docker ps
    
  • Export the private key from laconicd

    laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd exec laconicd "echo y | laconicd keys export mykey --unarmored-hex --unsafe"
    
  • Set the private key in secrets.json file that will be used by mobymask container to deploy contract

  • Create a new account named alice

    laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd exec laconicd "laconicd keys add alice"
    
  • Transfer balance to new account

    laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd exec laconicd 'laconicd tx bank send $(laconicd keys show mykey -a) $(laconicd keys show alice -a) 1000000000000000000000000aphoton --fees 2000aphoton'
    
  • Export the private key of new account from laconicd

    laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd exec laconicd "echo y | laconicd keys export alice --unarmored-hex --unsafe"
    
  • Set the private key (server.p2p.peer.l2TxConfig.privateKey) in watcher.toml file that will be used to start the peer that sends txs to L2 chain

    [server.p2p.peer.l2TxConfig]
      privateKey = 'ALICE_PRIVATE_KEY'
    
  • Deploy the other containers

    laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 up
    
  • Check that all containers are healthy using docker ps

    NOTE: The mobymask-ui container might not start. If mobymask-app is not running at http://localhost:3002, run command again to start the container

    laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 up
    

Tests

Find the watcher container's id:

laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 ps | grep "mobymask-watcher-server"

Example output

id: 5d3aae4b22039fcd1c9b18feeb91318ede1100581e75bb5ac54f9e436066b02c, name: laconic-bfb01caf98b1b8f7c8db4d33f11b905a-mobymask-watcher-server-1, ports: 0.0.0.0:3001->3001/tcp, 0.0.0.0:9001->9001/tcp, 0.0.0.0:9090->9090/tcp

In above output the container ID is 5d3aae4b22039fcd1c9b18feeb91318ede1100581e75bb5ac54f9e436066b02c

Export it for later use:

export CONTAINER_ID=<CONTAINER_ID>

Run the peer tests:

docker exec -w /app/packages/peer $CONTAINER_ID yarn test

Web Apps

Check that the status for web-app containers are healthy by using docker ps

mobymask-app

The mobymask-app should be running at http://localhost:3002

peer-test-app

The peer-test-app should be running at http://localhost:3003

Details

Demo

Follow the demo to try out the MobyMask app with L2 chain

Clean up

Stop all the services running in background run:

laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 down

laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd down

Clear volumes:

  • List all volumes

    docker volume ls
    
  • Remove volumes created by this stack

    Example:

    docker volume rm laconic-bfb01caf98b1b8f7c8db4d33f11b905a_moby_data_server