2023-03-20 12:55:39 +00:00
# MobyMask v2 watcher
Instructions to deploy MobyMask v2 watcher stack using [laconic-stack-orchestrator ](/README.md#install )
## Setup
Clone required repositories:
```bash
laconic-so --stack mobymask-v2 setup-repositories
```
2023-03-27 05:47:12 +00:00
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.
2023-03-24 11:53:54 +00:00
Checkout to the required versions and branches in repos
```bash
# watcher-ts
cd ~/cerc/watcher-ts
2023-03-30 04:14:15 +00:00
git checkout v0.2.34
2023-03-24 11:53:54 +00:00
# react-peer
cd ~/cerc/react-peer
2023-03-30 04:14:15 +00:00
git checkout v0.2.31
2023-03-24 11:53:54 +00:00
# mobymask-ui
cd ~/cerc/mobymask-ui
git checkout laconic
# MobyMask
cd ~/cerc/MobyMask
git checkout v0.1.1
2023-04-04 09:23:28 +00:00
# Optimism
cd ~/cerc/optimism
git checkout @eth -optimism/sdk@0.0.0-20230329025055
2023-03-24 11:53:54 +00:00
```
2023-03-20 12:55:39 +00:00
Build the container images:
```bash
laconic-so --stack mobymask-v2 build-containers
```
This should create the required docker images in the local image registry.
Deploy the stack:
2023-04-04 09:23:28 +00:00
* Deploy the containers:
2023-03-24 11:53:54 +00:00
```bash
2023-04-03 12:43:29 +00:00
laconic-so --stack mobymask-v2 deploy-system up
2023-03-24 11:53:54 +00:00
```
2023-04-04 09:23:28 +00:00
* List and check the health status of all the containers using `docker ps` and wait for them to be `healthy`
2023-03-24 11:53:54 +00:00
2023-04-04 09:23:28 +00:00
NOTE: The `mobymask-app` container might not start; if the app is not running at http://localhost:3002, restart the container using it's id:
2023-03-24 11:53:54 +00:00
```bash
2023-04-04 09:23:28 +00:00
docker ps -a | grep "mobymask-app"
docker restart < CONTAINER_ID >
2023-03-24 11:53:54 +00:00
```
2023-03-20 12:55:39 +00:00
## Tests
2023-04-04 09:23:28 +00:00
Find the watcher container's id and export it for later use:
2023-03-20 12:55:39 +00:00
```bash
2023-04-03 12:43:29 +00:00
laconic-so --stack mobymask-v2 deploy-system ps | grep "mobymask-watcher-server"
2023-04-04 09:23:28 +00:00
export CONTAINER_ID=< CONTAINER_ID >
2023-03-20 12:55:39 +00:00
```
2023-04-04 09:23:28 +00:00
Example output:
2023-03-20 12:55:39 +00:00
```
2023-03-24 11:53:54 +00:00
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
2023-03-20 12:55:39 +00:00
```
2023-03-24 11:53:54 +00:00
In above output the container ID is `5d3aae4b22039fcd1c9b18feeb91318ede1100581e75bb5ac54f9e436066b02c`
2023-03-20 12:55:39 +00:00
Run the peer tests:
```bash
docker exec -w /app/packages/peer $CONTAINER_ID yarn test
```
2023-03-24 11:53:54 +00:00
## Web Apps
2023-04-04 09:23:28 +00:00
Check that the web-app containers are healthy:
```bash
docker ps | grep -E 'mobymask-app|peer-test-app'
```
2023-03-24 11:53:54 +00:00
### 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
* The relay node for p2p network is running at http://localhost:9090
* The [peer package ](https://github.com/cerc-io/watcher-ts/tree/main/packages/peer ) (published in [gitea ](https://git.vdb.to/cerc-io/-/packages/npm/@cerc-io%2Fpeer )) can be used in client code for connecting to the network
* The [react-peer package ](https://github.com/cerc-io/react-peer/tree/main/packages/react-peer ) (published in [gitea ](https://git.vdb.to/cerc-io/-/packages/npm/@cerc-io%2Freact-peer )) which uses the peer package can be used in react app for connecting to the network
## Demo
Follow the [demo ](./demo.md ) to try out the MobyMask app with L2 chain
2023-03-20 12:55:39 +00:00
## Clean up
2023-03-24 11:53:54 +00:00
Stop all the services running in background run:
2023-03-20 12:55:39 +00:00
```bash
2023-04-03 12:43:29 +00:00
laconic-so --stack mobymask-v2 deploy-system down
2023-03-20 12:55:39 +00:00
```
2023-03-24 11:53:54 +00:00
Clear volumes:
2023-04-04 09:23:28 +00:00
* List all relevant volumes:
2023-03-24 11:53:54 +00:00
```bash
2023-04-04 09:23:28 +00:00
docker volume ls -q --filter name=laconic*
2023-03-24 11:53:54 +00:00
```
2023-04-04 09:23:28 +00:00
* Remove all the listed volumes:
2023-03-24 11:53:54 +00:00
```bash
2023-04-04 09:23:28 +00:00
docker volume rm $(docker volume ls -q --filter name=laconic*)
2023-03-24 11:53:54 +00:00
```