2023-04-06 09:47:00 +00:00
# Web Apps
Instructions to setup and deploy MobyMask and Peer Test web apps
## Setup
Prerequisite: Watcher with GQL and relay node endpoints
Clone required repositories:
```bash
laconic-so --stack mobymask-v2 setup-repositories --include cerc-io/react-peer,cerc-io/mobymask-ui
2023-04-11 10:51:03 +00:00
# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories mentioned below and re-run the command
2023-04-06 09:47:00 +00:00
```
Checkout to the required versions and branches in repos:
```bash
# react-peer
cd ~/cerc/react-peer
2023-04-18 12:55:58 +00:00
git checkout v0.2.32
2023-04-06 09:47:00 +00:00
# mobymask-ui
cd ~/cerc/mobymask-ui
2023-04-18 12:55:58 +00:00
git checkout v0.1.2
2023-04-06 09:47:00 +00:00
```
Build the container images:
```bash
2023-04-18 12:55:58 +00:00
laconic-so --stack mobymask-v2 build-containers --include cerc/react-peer,cerc/mobymask-ui
2023-04-06 09:47:00 +00:00
```
This should create the required docker images in the local image registry
## Deploy
### Configuration
2023-04-11 10:51:03 +00:00
Create and update an env file to be used in the next step ([defaults](../../config/watcher-mobymask-v2/mobymask-params.env)):
```bash
2023-04-12 12:47:13 +00:00
# Set of relay nodes to be used by the web-app
# (use double quotes " for strings)
# Eg. CERC_RELAY_NODES=["/dns4/example.com/tcp/443/wss/p2p/12D3KooWGHmDDCc93XUWL16FMcTPCGu2zFaMkf67k8HZ4gdQbRDr"]
CERC_RELAY_NODES=[]
2023-04-11 10:51:03 +00:00
# Also add if running MobyMask app:
# External watcher endpoint (to check if watcher is up)
CERC_WATCHER_HOST=
CERC_WATCHER_PORT=
# Watcher endpoint used by the app for GQL queries
CERC_APP_WATCHER_URL="http://127.0.0.1:3001"
# Set deployed MobyMask contract address to be used in MobyMask app's config
CERC_DEPLOYED_CONTRACT=
# L2 Chain ID used by mobymask web-app for L2 txs
CERC_CHAIN_ID=42069
```
* NOTE: If watcher 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
For running mobymask-app
```bash
2023-04-11 10:51:03 +00:00
laconic-so --stack mobymask-v2 deploy --include mobymask-app --env-file < PATH_TO_ENV_FILE > up
# Runs on host port 3002
2023-04-06 09:47:00 +00:00
```
For running peer-test-app
```bash
2023-04-11 10:51:03 +00:00
laconic-so --stack mobymask-v2 deploy --include peer-test-app --env-file < PATH_TO_ENV_FILE > up
# Runs on host port 3003
2023-04-06 09:47:00 +00:00
```
To list down and monitor the running containers:
```bash
2023-04-11 10:51:03 +00:00
laconic-so --stack mobymask-v2 deploy --include [mobymask-app | peer-test-app] ps
2023-04-06 09:47:00 +00:00
docker ps
# Check logs for a container
docker logs -f < CONTAINER_ID >
```
2023-04-11 10:51:03 +00:00
## Demo
Follow the [demo ](./demo.md ) to try out the MobyMask app with L2 chain
2023-04-06 09:47:00 +00:00
## Clean up
Stop all services running in the background:
For mobymask-app
```bash
laconic-so --stack mobymask-v2 deploy --include mobymask-app down
```
For peer-test-app
```bash
laconic-so --stack mobymask-v2 deploy --include peer-test-app down
```
Clear volumes created by this stack:
```bash
# List all relevant volumes
2023-04-12 12:47:13 +00:00
docker volume ls -q --filter "name=.*mobymask_deployment|.*peers_ids"
2023-04-06 09:47:00 +00:00
# Remove all the listed volumes
2023-04-12 12:47:13 +00:00
docker volume rm $(docker volume ls -q --filter "name=.*mobymask_deployment|.*peers_ids")
2023-04-06 09:47:00 +00:00
```