# This will clone the required repositories at ~/cerc
# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories mentioned in the next step and re-run the command
# Expected output:
# Dev Root is: /home/xyz/cerc
# Checking: /home/xyz/cerc/watcher-ts: Needs to be fetched
# ✔ Container mobymask_v2-peer-tests-1 Started 44.5s
```
This will run the `mobymask-v2-watcher` including:
* A relay node which is in a federated setup with relay nodes set in the env file
* A peer node which connects to the watcher relay node as an entrypoint to the MobyMask watcher p2p network. This peer listens for messages from other peers on the network and logs them out to the console
The watcher endpoint is exposed on host port `3001` and the relay node endpoint is exposed on host port `9090`
# The multiaddr will be of form /dns4/<CERC_RELAY_ANNOUNCE_DOMAIN>/tcp/443/wss/p2p/<RELAY_PEER_ID>
# Expected output:
# mobymask_v2-mobymask-watcher-server-1 | 2023-04-20T04:22:57.069Z laconic:relay Relay node started with id 12D3KooWKef84LAcBNb9wZNs6jC5kQFXjddo47hK6AGHD2dSvGai (characteristic-black-pamella)
# mobymask_v2-mobymask-watcher-server-1 | 2023-04-20T04:22:57.069Z laconic:relay Listening on:
To be able to connect to the relay node from remote peers, it needs to be publicly reachable. Configure your website with SSL and the `https` traffic forwarded to port `9090`.
For example, a Nginx configuration for domain `example.com` would look something like:
```bash
server {
server_name example.com;
# https://nginx.org/en/docs/http/websocket.html
location / {
proxy_pass http://127.0.0.1:9090;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# set a large timeout to avoid websocket disconnects
proxy_read_timeout 86400;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name example.com;
return 404; # managed by Certbot
}
```
To connect a browser peer to the watcher's relay node:
* Visit https://mobymask-lxdao-app.dev.vdb.to/
* 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
* 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
* Check the watcher container logs to see the message received:
# 2023-04-20T04:42:01.072Z vulcanize:libp2p-utils [4:42:1] Received a message on mobymask P2P network from peer: 12D3KooWDKCke8hrjm4evwc9HzUzPZXeVTEQqmfLCkdNaXQ7efAZ
# 2023-04-20T04:42:01.072Z vulcanize:libp2p-utils Signed invocations:
docker volume rm $(docker volume ls -q --filter "name=mobymask_v2*")
```
## Troubleshooting
* If you don't see any peer connections being formed in the debug panel on https://mobymask-lxdao-app.dev.vdb.to/, try clearing out the website's local storage and refreshing the page