Add ability to run mobymask-v2 stack with external optimism endpoint (#279)

* Set optimism geth endpoint from env file

* Set L1 account private keys from env

* Only deploy contract and generate invite in mobymask container

* Add readme for running mobymask v2 stack independently

* Modify mobymask container to stop running server and update readmes

* Check deployer account balance before deploying contract

* Fix for checking account balance before deploying

* Update readme description

* Update MobyMask repo tag in readme

Former-commit-id: 94e38ceaba
This commit is contained in:
2023-04-05 17:26:38 +05:30
committed by GitHub
parent 464ef89a01
commit 63fbaa7ae3
16 changed files with 194 additions and 81 deletions
@@ -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
@@ -74,10 +74,10 @@ Clear volumes created by this stack:
```bash
# List all relevant volumes
docker volume ls -q --filter name=laconic*
docker volume ls -q --filter "name=.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data"
# Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter name=laconic*)
docker volume rm $(docker volume ls -q --filter "name=.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data")
```
## Troubleshooting
@@ -55,7 +55,7 @@ The `fixturenet-optimism-contracts` service may take a while (`~15 mins`) to com
To list down and monitor the running containers:
```bash
laconic-so --stack fixturenet-optimism deploy ps
laconic-so --stack fixturenet-optimism deploy --include fixturenet-optimism ps
# With status
docker ps
@@ -76,10 +76,10 @@ Clear volumes created by this stack:
```bash
# List all relevant volumes
docker volume ls -q --filter name=laconic*
docker volume ls -q --filter "name=.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data"
# Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter name=laconic*)
docker volume rm $(docker volume ls -q --filter "name=.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data")
```
## Troubleshooting
+8 -15
View File
@@ -1,6 +1,9 @@
# MobyMask v2 watcher
Instructions to deploy MobyMask v2 watcher stack using [laconic-stack-orchestrator](/README.md#install)
Instructions to setup and deploy an end-to-end MobyMask v2 stack ([L1](../fixturenet-eth/) + [L2](../fixturenet-optimism/) chains + watcher) using [laconic-stack-orchestrator](/README.md#install)
We support running just the watcher part of stack, given an external L2 Optimism endpoint.
Follow [mobymask-only](./mobymask-only.md) for the same.
## Setup
@@ -30,7 +33,7 @@ git checkout laconic
# MobyMask
cd ~/cerc/MobyMask
git checkout v0.1.1
git checkout v0.1.2
# Optimism
cd ~/cerc/optimism
@@ -68,19 +71,9 @@ Deploy the stack:
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"
export CONTAINER_ID=<CONTAINER_ID>
export CONTAINER_ID=$(docker ps -q --filter "name=mobymask-watcher-server")
```
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
@@ -128,11 +121,11 @@ Clear volumes:
* List all relevant volumes:
```bash
docker volume ls -q --filter name=laconic*
docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*moby_data_server|.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data"
```
* Remove all the listed volumes:
```bash
docker volume rm $(docker volume ls -q --filter name=laconic*)
docker volume rm $(docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*moby_data_server|.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data")
```
@@ -0,0 +1,85 @@
# 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
git checkout v0.1.2
```
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 --include watcher-mobymask-v2 ps
# With status
docker ps
# Check logs for a container
docker logs -f <CONTAINER_ID>
```
See [Tests](./README.md#tests) and [Demo](./README.md#demo) to interact with stack
## 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=.*mobymask_watcher_db_data|.*moby_data_server|.*fixturenet_geth_accounts"
# Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*moby_data_server|.*fixturenet_geth_accounts")
```