2023-03-20 12:55:39 +00:00
# MobyMask v2 watcher
2023-04-11 10:51:03 +00:00
Instructions to setup and deploy an end-to-end MobyMask v2 stack ([L1](../fixturenet-eth/) + [L2 ](../fixturenet-optimism/ ) chains + watcher + web-app(s)) using [laconic-stack-orchestrator ](/README.md#install )
2023-04-05 11:56:38 +00:00
We support running just the watcher part of stack, given an external L2 Optimism endpoint.
Follow [mobymask-only ](./mobymask-only.md ) for the same.
2023-03-20 12:55:39 +00:00
2023-04-11 10:51:03 +00:00
We also support running just the web-app(s), given external watcher GQL (for mobymask-app) and relay node endpoints. Follow [web-apps.md ](./web-apps.md ) for the same.
2023-03-20 12:55:39 +00:00
## 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-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-06-26 10:07:08 +00:00
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 up
2023-03-24 11:53:54 +00:00
```
2023-06-26 10:07:08 +00:00
NOTE: The `fixturenet-optimism-contracts` service takes a while to run to completion and it may restart a few times after running into errors.
2023-03-24 11:53:54 +00:00
2023-06-26 10:07:08 +00:00
* To list down and monitor the running containers:
2023-03-24 11:53:54 +00:00
```bash
2023-06-26 10:07:08 +00:00
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 ps
2023-04-04 09:23:28 +00:00
2023-06-26 10:07:08 +00:00
# With status
docker ps -a
# Check logs for a container
docker logs -f < 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-19 08:18:51 +00:00
export CONTAINER_ID=$(docker ps -q --filter "name=peer-tests")
2023-03-20 12:55:39 +00:00
```
Run the peer tests:
```bash
2023-04-19 08:18:51 +00:00
docker exec $CONTAINER_ID yarn test
2023-03-20 12:55:39 +00:00
```
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
2023-06-26 10:07:08 +00:00
* The mobymask-app should be running at http://localhost:3002
* The lxdao-mobymask-app should be running at http://localhost:3004
2023-03-24 11:53:54 +00:00
### peer-test-app
2023-06-26 10:07:08 +00:00
* The peer-test-app should be running at http://localhost:3003
2023-03-24 11:53:54 +00:00
## 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-08-14 07:16:04 +00:00
Stop all the services running in background:
2023-03-20 12:55:39 +00:00
```bash
2023-06-26 10:07:08 +00:00
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 down 30
2023-03-20 12:55:39 +00:00
```
2023-03-24 11:53:54 +00:00
2023-04-05 12:22:12 +00:00
Clear volumes created by this stack:
2023-03-24 11:53:54 +00:00
2023-04-05 12:22:12 +00:00
```bash
# List all relevant volumes
2023-06-26 10:07:08 +00:00
docker volume ls -q --filter "name=mobymask_v2"
2023-03-24 11:53:54 +00:00
2023-04-05 12:22:12 +00:00
# Remove all the listed volumes
2023-06-26 10:07:08 +00:00
docker volume rm $(docker volume ls -q --filter "name=mobymask_v2")
2023-04-05 12:22:12 +00:00
```