Add instructions to run MobyMask app with a watcher on network

This commit is contained in:
Prathamesh Musale 2023-04-25 15:38:01 +05:30
parent a67a751661
commit da8294996f
3 changed files with 112 additions and 6 deletions

View File

@ -0,0 +1,104 @@
# MobyMask Watcher P2P Network - Web App
Instructions to setup and deploy the MobyMask app locally, pointed to a watcher on the p2p network
## Prerequisites
* Laconic Stack Orchestrator ([installation](/README.md#install))
* Watcher GQL endpoint
## Setup
Build the container images:
```bash
laconic-so --stack mobymask-v2 build-containers --include cerc/react-peer,cerc/mobymask-ui
```
Check that the required images are created in the local image registry:
```bash
docker image ls
# Expected output:
# REPOSITORY TAG IMAGE ID CREATED SIZE
# cerc/react-peer local d66b144dbb53 4 days ago 868MB
# cerc/mobymask-ui local e456bf9937ec 4 days ago 1.67GB
# .
# .
```
## Deploy
### Configuration
Create an env file `mobymask-app.env`:
```bash
touch mobymask-app.env
```
Add the following contents to `mobymask-app.env`:
```bash
# Watcher endpoint used by the app for GQL queries
CERC_APP_WATCHER_URL="http://127.0.0.1:3001"
# DO NOT CHANGE THESE VALUES
CERC_DEPLOYED_CONTRACT="0x2B6AFbd4F479cE4101Df722cF4E05F941523EaD9"
CERC_RELAY_PEERS=["/dns4/relay1.dev.vdb.to/tcp/443/wss/p2p/12D3KooWAx83SM9GWVPc9v9fNzLzftRX6EaAFMjhYiFxRYqctcW1", "/dns4/relay2.dev.vdb.to/tcp/443/wss/p2p/12D3KooWBycy6vHVEfUwwYRbPLBdb5gx9gtFSEMpErYPUjUkDNkm", "/dns4/relay3.dev.vdb.to/tcp/443/wss/p2p/12D3KooWARcUJsiGCgiygiRVVK94U8BNSy8DFBbzAF3B6orrabwn"]
```
Replace `CERC_APP_WATCHER_URL` with the watcher's GQL endpoint
### Deploy the stack
```bash
laconic-so --stack mobymask-v2 deploy --cluster mm_v2 --include mobymask-app --env-file mobymask-app.env up lxdao-mobymask-app
# Expected output:
```
This will run the `lxdao-mobymask-app` (at `http://localhost:3004`) pointed to `CERC_APP_WATCHER_URL` for GQL queries
To monitor the running container:
```bash
# With status
docker ps
# Expected output:
# Check logs for a container
docker logs -f mm_v2_lxdao-mobymask-app
```
Note: For opening an invite link on this deployed app, replace the URL part before `/#` with `http://localhost:3004`
For example: `http://localhost:3004/#/members?invitation=XYZ`
## Clean up
Stop all services running in the background:
```bash
laconic-so --stack mobymask-v2 deploy --cluster mm_v2 --include mobymask-app down
# Expected output:
```
Clear volumes created by this stack:
```bash
# List all relevant volumes
docker volume ls -q --filter "name=mm_v2"
# Expected output:
# Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter "name=mm_v2")
```

View File

@ -85,6 +85,7 @@ Add the following contents to `mobymask-watcher.env`:
# DO NOT CHANGE THESE VALUES
CERC_L2_GETH_RPC="https://mobymask-l2.dev.vdb.to"
CERC_DEPLOYED_CONTRACT="0x2B6AFbd4F479cE4101Df722cF4E05F941523EaD9"
CERC_ENABLE_PEER_L2_TXS=false
CERC_RELAY_PEERS=["/dns4/relay1.dev.vdb.to/tcp/443/wss/p2p/12D3KooWAx83SM9GWVPc9v9fNzLzftRX6EaAFMjhYiFxRYqctcW1", "/dns4/relay2.dev.vdb.to/tcp/443/wss/p2p/12D3KooWBycy6vHVEfUwwYRbPLBdb5gx9gtFSEMpErYPUjUkDNkm", "/dns4/relay3.dev.vdb.to/tcp/443/wss/p2p/12D3KooWARcUJsiGCgiygiRVVK94U8BNSy8DFBbzAF3B6orrabwn"]
@ -200,15 +201,16 @@ For example, a Nginx configuration for domain `example.com` would look something
}
```
To connect a browser peer to the watcher's relay node:
* Visit https://mobymask-lxdao-app.dev.vdb.to/
To test the web-app, either visit https://mobymask-lxdao-app.dev.vdb.to/ or follow [p2p-network-web-app.md](./p2p-network-web-app.md) to deploy the app locally that hits your watcher's GQL endpoint
Connect a browser peer to the watcher's relay node:
* Click on debug panel on bottom right of the homepage
* Select `<custom>` in `Primary Relay` dropdown on the right and enter the watcher relay node's multiaddr
* Click on `UPDATE` to refresh the page and connect to the watcher's relay node; you should see the relay node's multiaddr in `Self Node Info` on the debug panel
* Switch to the `GRAPH (PEERS)` tab to see peers connected to this browser node and the `GRAPH (NETWORK)` tab to see the whole MobyMask p2p network
Perform transactions (invite required):
* Open the invite link in a browser and open the debug panel
* Open the invite link in a fresh browser and open the debug panel
* Confirm that the browser peer is connected to at least one other peer, then close the debug panel
* Check the status for a phisher to be reported in the `Check Phisher Status` section on homepage
* Select `Report Phisher` option in the `Pending reports` section, enter multiple phisher records and click on the `Submit batch to p2p network` button; this broadcasts signed invocations to peers on the network, including the watcher peer
@ -286,7 +288,7 @@ Clear volumes created by this stack:
```bash
# List all relevant volumes
docker volume ls -q --filter "name=mobymask_v2*"
docker volume ls -q --filter "name=mobymask_v2"
# Expected output:
@ -296,7 +298,7 @@ Clear volumes created by this stack:
# Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter "name=mobymask_v2*")
docker volume rm $(docker volume ls -q --filter "name=mobymask_v2")
```
## Troubleshooting

View File

@ -46,7 +46,7 @@ For running mobymask-app
```bash
laconic-so --stack mobymask-v2 deploy --include mobymask-app --env-file <PATH_TO_ENV_FILE> up
# Runs on host port 3002
# Runs mobymask-app on host port 3002 and lxdao-mobymask-app on host port 3004
```
For running peer-test-app