Add instructions for running web-apps separately

This commit is contained in:
nabarun 2023-04-06 12:27:03 +05:30
parent e223db7599
commit 42401ee26d
2 changed files with 102 additions and 14 deletions

View File

@ -9,25 +9,16 @@ Prerequisite: L2 Optimism Geth and Node RPC endpoints
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
laconic-so --stack mobymask-v2 setup-repositories --include cerc-io/MobyMask,cerc-io/watcher-ts
```
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
@ -36,20 +27,24 @@ 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
laconic-so --stack mobymask-v2 build-containers --include cerc/watcher-mobymask-v2,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
### Configuration
* 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
* 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:
### Deploy the stack
```bash
laconic-so --stack mobymask-v2 deploy --include watcher-mobymask-v2 up
@ -67,7 +62,9 @@ docker ps
docker logs -f <CONTAINER_ID>
```
See [Tests](./README.md#tests) and [Demo](./README.md#demo) to interact with stack
## Tests
See [Tests](./README.md#tests)
## Clean up

View File

@ -0,0 +1,91 @@
# 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
```
Checkout to the required versions and branches in repos:
```bash
# react-peer
cd ~/cerc/react-peer
git checkout v0.2.31
# mobymask-ui
cd ~/cerc/mobymask-ui
git checkout laconic
```
Build the container images:
```bash
laconic-so --stack mobymask-v2 build-containers --include cerc/react-peer-v2,cerc/mobymask-ui
```
This should create the required docker images in the local image registry
## Deploy
### Configuration
* Update the [mobymask-params.env](../../config/watcher-mobymask-v2/mobymask-params.env) file with watcher endpoints and other params required by the web-apps
* `WATCHER_HOST` and `WATCHER_PORT` is used to check if watcher is up before building and deploying mobymask-app
* `APP_WATCHER_URL` is used by mobymask-app to make GQL queries
* `DEPLOYED_CONTRACT` and `CHAIN_ID` is used by mobymask-app in app config when creating messgaes for L2 txs
* `RELAY_NODES` is used by the web-apps to connect to the relay nodes (run in watcher)
* 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 watcher is running on the host machine, use `host.docker.internal` as the hostname to access the host port
### Deploy the stack
For running mobymask-app
```bash
laconic-so --stack mobymask-v2 deploy --include mobymask-app up
```
For running peer-test-app
```bash
laconic-so --stack mobymask-v2 deploy --include peer-test-app up
```
To list down and monitor the running containers:
```bash
docker ps
# Check logs for a container
docker logs -f <CONTAINER_ID>
```
## 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
docker volume ls -q --filter "name=.*mobymask_deployment"
# Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter "name=.*mobymask_deployment")
```