Add readme for running mobymask v2 stack independently

This commit is contained in:
nabarun 2023-04-05 10:58:56 +05:30
parent 1c1a9d166d
commit dfaeb4a65a
4 changed files with 117 additions and 22 deletions

View File

@ -2,7 +2,7 @@
Instructions to setup and deploy an end-to-end L1+L2 stack with [fixturenet-eth](../fixturenet-eth/) (L1) and [Optimism](https://stack.optimism.io) (L2)
We support running just the L2 part of stack, given an external L1 endpoint. Follow [L2-ONLY](./L2-ONLY.md) for the same.
We support running just the L2 part of stack, given an external L1 endpoint. Follow [l2-only](./l2-only.md) for the same.
## Setup

View File

@ -2,15 +2,15 @@
Instructions to deploy MobyMask v2 watcher stack using [laconic-stack-orchestrator](/README.md#install)
We support running just the MobyMask v2 watcher part of stack, given an external L2 Optimism endpoint.
Follow [mobymask-only](./mobymask-only.md) for the same.
## Setup
Clone required repositories:
```bash
laconic-so --stack mobymask-v2 setup-repositories
# Include repositories required for MobyMask if running optimism separately
laconic-so --stack mobymask-v2 setup-repositories --include cerc-io/MobyMask,cerc-io/watcher-ts,cerc-io/react-peer,cerc-io/mobymask-ui
```
NOTE: If repositories already exist and are checked out to different versions, `setup-repositories` command will throw an error.
@ -33,6 +33,7 @@ git checkout laconic
# MobyMask
cd ~/cerc/MobyMask
# TODO: Checkout to updated version
git checkout v0.1.1
# Optimism
@ -44,28 +45,16 @@ Build the container images:
```bash
laconic-so --stack mobymask-v2 build-containers
# Only build containers required for MobyMask if running optimism separately
laconic-so --stack mobymask-v2 build-containers --include cerc/watcher-mobymask-v2,cerc/react-peer,cerc/mobymask-ui,cerc/mobymask
```
This should create the required docker images in the local image registry.
Deploy the stack:
* (Optional) Update the [optimism-params.env](../../config/watcher-mobymask-v2/optimism-params.env) file with optimism endpoints and other params if running optimism separately
NOTE:
* Stack Orchestrator needs to be run in [`dev`](/docs/CONTRIBUTING.md#install-developer-mode) mode to be able to edit the env file
* If optimism is running on the host machine, use `host.docker.internal` as the hostname to access the host port
* Deploy the containers:
```bash
laconic-so --stack mobymask-v2 deploy-system up
# Only start watcher-mobymask-v2 pod if running optimism separately
laconic-so --stack mobymask-v2 deploy --include watcher-mobymask-v2 up
```
* List and check the health status of all the containers using `docker ps` and wait for them to be `healthy`
@ -85,9 +74,6 @@ Find the watcher container's id and export it for later use:
```bash
laconic-so --stack mobymask-v2 deploy-system ps | grep "mobymask-watcher-server"
# If only running watcher-mobymask-v2 pod
laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 ps | grep "mobymask-watcher-server"
export CONTAINER_ID=<CONTAINER_ID>
```
@ -139,9 +125,6 @@ Stop all the services running in background run:
```bash
laconic-so --stack mobymask-v2 deploy-system down
# If only ran watcher-mobymask-v2 pod
laconic-so --stack mobymask-v2 deploy down --include watcher-mobymask-v2
```
Clear volumes:

View File

@ -0,0 +1,112 @@
# MobyMask v2 watcher
Instructions to setup and deploy MobyMask v2 watcher independently
## Setup
Prerequisite: An L2 Optimism RPC endpoint
Clone required repositories:
```bash
laconic-so --stack mobymask-v2 setup-repositories --include cerc-io/MobyMask,cerc-io/watcher-ts,cerc-io/react-peer,cerc-io/mobymask-ui
```
Checkout to the required versions and branches in repos:
```bash
```bash
# 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
# MobyMask
cd ~/cerc/MobyMask
# TODO: Checkout to updated version
git checkout v0.1.1
# Optimism
cd ~/cerc/optimism
git checkout @eth-optimism/sdk@0.0.0-20230329025055
```
Build the container images:
```bash
laconic-so --stack mobymask-v2 build-containers --include cerc/watcher-mobymask-v2,cerc/react-peer,cerc/mobymask-ui,cerc/mobymask
```
This should create the required docker images in the local image registry
## Deploy
Update the [optimism-params.env](../../config/watcher-mobymask-v2/optimism-params.env) file with Optimism endpoints and other params if running Optimism separately
* NOTE:
* Stack Orchestrator needs to be run in [`dev`](/docs/CONTRIBUTING.md#install-developer-mode) mode to be able to edit the env file
* If Optimism is running on the host machine, use `host.docker.internal` as the hostname to access the host port
Deploy the stack:
```bash
laconic-so --stack mobymask-v2 deploy --include watcher-mobymask-v2 up
```
To list down and monitor the running containers:
```bash
laconic-so --stack mobymask-v2 deploy ps
# With status
docker ps
# Check logs for a container
docker logs -f <CONTAINER_ID>
```
## Tests
Find the watcher container's id and export it for later use:
```bash
laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 ps | grep "mobymask-watcher-server"
export CONTAINER_ID=<CONTAINER_ID>
```
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`
Run the peer tests:
```bash
docker exec -w /app/packages/peer $CONTAINER_ID yarn test
```
## Clean up
Stop all services running in the background:
```bash
laconic-so --stack mobymask-v2 deploy down --include watcher-mobymask-v2
```
Clear volumes created by this stack:
```bash
# List all relevant volumes
docker volume ls -q --filter name=laconic*
# Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter name=laconic*)
```