stack-orchestrator/app/data/stacks/mobymask-v2/mobymask-only.md
Nabarun Gogoi 6f781ae303
Separate out watcher and web-apps in mobymask-v2 stack (#287)
* Separate out watcher and web-apps in mobymask stack

* Take L2 RPC endpoint from the env file

* Changes to run watcher and mobymask web-app separately

* Support running watcher without contract deployment and L2 txs

* Remove duplicate mobymask params env

* Add code comments

* Add instructions for running web-apps separately

* Self review fixes

* Fix timeout for mobymask-app on watcher server

---------

Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
2023-04-06 15:17:00 +05:30

86 lines
2.3 KiB
Markdown

# MobyMask v2 watcher
Instructions to setup and deploy MobyMask v2 watcher independently
## Setup
Prerequisite: L2 Optimism Geth and Node RPC endpoints
Clone required repositories:
```bash
laconic-so --stack mobymask-v2 setup-repositories --include cerc-io/MobyMask,cerc-io/watcher-ts
```
Checkout to the required versions and branches in repos:
```bash
# watcher-ts
cd ~/cerc/watcher-ts
git checkout v0.2.34
# MobyMask
cd ~/cerc/MobyMask
git checkout v0.1.2
```
Build the container images:
```bash
laconic-so --stack mobymask-v2 build-containers --include cerc/watcher-mobymask-v2,cerc/mobymask
```
This should create the required docker images in the local image registry
## Deploy
### Configuration
* In [mobymask-params.env](../../config/watcher-mobymask-v2/mobymask-params.env) file set `DEPLOYED_CONTRACT` to existing deployed mobymask contract address
* Setting `DEPLOYED_CONTRACT` will skip contract deployment when running stack
* Update the [optimism-params.env](../../config/watcher-mobymask-v2/optimism-params.env) file with Optimism endpoints and other params for the Optimism running separately
* If `PRIVATE_KEY_PEER` is not set the inline watcher peer will not send txs to L2 on receiving P2P network messages
* 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 --include watcher-mobymask-v2 ps
# With status
docker ps
# Check logs for a container
docker logs -f <CONTAINER_ID>
```
## Tests
See [Tests](./README.md#tests)
## Clean up
Stop all services running in the background:
```bash
laconic-so --stack mobymask-v2 deploy --include watcher-mobymask-v2 down
```
Clear volumes created by this stack:
```bash
# List all relevant volumes
docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*mobymask_deployment|.*fixturenet_geth_accounts"
# Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*mobymask_deployment|.*fixturenet_geth_accounts")
```