2023-04-05 11:56:38 +00:00
# MobyMask v2 watcher
Instructions to setup and deploy MobyMask v2 watcher independently
## Setup
2023-04-06 09:47:00 +00:00
Prerequisite: L2 Optimism Geth and Node RPC endpoints
2023-04-05 11:56:38 +00:00
Clone required repositories:
```bash
2023-04-06 09:47:00 +00:00
laconic-so --stack mobymask-v2 setup-repositories --include cerc-io/MobyMask,cerc-io/watcher-ts
2023-04-05 11:56:38 +00:00
```
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
2023-04-06 09:47:00 +00:00
laconic-so --stack mobymask-v2 build-containers --include cerc/watcher-mobymask-v2,cerc/mobymask
2023-04-05 11:56:38 +00:00
```
This should create the required docker images in the local image registry
## Deploy
2023-04-06 09:47:00 +00:00
### Configuration
2023-04-05 11:56:38 +00:00
2023-04-06 09:47:00 +00:00
* 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
2023-04-05 11:56:38 +00:00
* 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
2023-04-06 09:47:00 +00:00
### Deploy the stack
2023-04-05 11:56:38 +00:00
```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
2023-04-05 12:22:12 +00:00
2023-04-05 11:56:38 +00:00
# With status
docker ps
2023-04-05 12:22:12 +00:00
2023-04-05 11:56:38 +00:00
# Check logs for a container
docker logs -f < CONTAINER_ID >
```
2023-04-06 09:47:00 +00:00
## Tests
See [Tests ](./README.md#tests )
2023-04-05 11:56:38 +00:00
## Clean up
Stop all services running in the background:
```bash
2023-04-05 12:22:12 +00:00
laconic-so --stack mobymask-v2 deploy --include watcher-mobymask-v2 down
2023-04-05 11:56:38 +00:00
```
Clear volumes created by this stack:
```bash
# List all relevant volumes
2023-04-05 12:22:12 +00:00
docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*mobymask_deployment|.*fixturenet_geth_accounts"
2023-04-05 11:56:38 +00:00
# Remove all the listed volumes
2023-04-05 12:22:12 +00:00
docker volume rm $(docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*mobymask_deployment|.*fixturenet_geth_accounts")
2023-04-05 11:56:38 +00:00
```