forked from cerc-io/stack-orchestrator
Add web-apps and laconicd in MobyMask v2 watcher stack (#226)
* Rename .env file * Add web app services to docker compose file * Add laconicd to deploy contract and send txs * Add demo with steps for running mobymask app with L2 chain * Add fix for yarn install on M1 platform in react-peer * Update multiaddrs to use websockets * Add notes in readmes --------- Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
This commit is contained in:
@@ -10,6 +10,30 @@ Clone required repositories:
|
||||
laconic-so --stack mobymask-v2 setup-repositories
|
||||
```
|
||||
|
||||
Checkout to the required versions and branches in repos
|
||||
|
||||
```bash
|
||||
# watcher-ts
|
||||
cd ~/cerc/watcher-ts
|
||||
git checkout v0.2.31
|
||||
|
||||
# react-peer
|
||||
cd ~/cerc/react-peer
|
||||
git checkout v0.2.29
|
||||
|
||||
# mobymask-ui
|
||||
cd ~/cerc/mobymask-ui
|
||||
git checkout laconic
|
||||
|
||||
# laconicd
|
||||
cd ~/cerc/laconicd
|
||||
git checkout v0.8.0
|
||||
|
||||
# MobyMask
|
||||
cd ~/cerc/MobyMask
|
||||
git checkout v0.1.1
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
|
||||
```bash
|
||||
@@ -20,25 +44,75 @@ This should create the required docker images in the local image registry.
|
||||
|
||||
Deploy the stack:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system up
|
||||
```
|
||||
* Deploy the laconic chain
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd up
|
||||
```
|
||||
|
||||
* Check that laconic chain status is healthy
|
||||
|
||||
```bash
|
||||
docker ps
|
||||
```
|
||||
|
||||
* Export the private key from laconicd
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd exec laconicd "echo y | laconicd keys export mykey --unarmored-hex --unsafe"
|
||||
```
|
||||
|
||||
* Set the private key in [secrets.json](../../config/watcher-mobymask-v2/secrets.json) file that will be used by mobymask container to deploy contract
|
||||
|
||||
* Create a new account
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd exec laconicd "laconicd keys add alice"
|
||||
```
|
||||
|
||||
* Transfer balance to new account
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd exec laconicd 'laconicd tx bank send $(laconicd keys show mykey -a) $(laconicd keys show alice -a) 1000000000000000000000000aphoton --fees 2000aphoton'
|
||||
```
|
||||
|
||||
* Export the private key of new account from laconicd
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd exec laconicd "echo y | laconicd keys export alice --unarmored-hex --unsafe"
|
||||
```
|
||||
|
||||
* Set the private key (`PRIVATE_KEY`) in [peer-start.sh](../../config/watcher-mobymask-v2/peer-start.sh) file that will be used to start the peer that sends txs to L2 chain
|
||||
|
||||
* Deploy the other containers
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 up
|
||||
```
|
||||
|
||||
* Check that all containers are healthy using `docker ps`
|
||||
|
||||
NOTE: The `mobymask-ui` container might not start. If mobymask-app is not running at http://localhost:3002, run command again to start the container
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 up
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
Find the watcher container's id:
|
||||
|
||||
```bash
|
||||
docker ps | grep "cerc/watcher-mobymask-v2:local"
|
||||
laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 ps | grep "mobymask-watcher-server"
|
||||
```
|
||||
|
||||
Example output
|
||||
|
||||
```
|
||||
8b38e9a64d7e cerc/watcher-mobymask-v2:local "sh -c 'yarn server'" 35 seconds ago Up 14 seconds (health: starting) 0.0.0.0:3001->3001/tcp, 0.0.0.0:9001->9001/tcp, 0.0.0.0:9090->9090/tcp laconic-aeb84676de2b0a7671ae90d537fc7d26-mobymask-watcher-server-1
|
||||
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 `8b38e9a64d7e`
|
||||
In above output the container ID is `5d3aae4b22039fcd1c9b18feeb91318ede1100581e75bb5ac54f9e436066b02c`
|
||||
|
||||
Export it for later use:
|
||||
|
||||
@@ -52,10 +126,51 @@ Run the peer tests:
|
||||
docker exec -w /app/packages/peer $CONTAINER_ID yarn test
|
||||
```
|
||||
|
||||
## Web Apps
|
||||
|
||||
Check that the status for web-app containers are healthy by using `docker ps`
|
||||
|
||||
### mobymask-app
|
||||
|
||||
The mobymask-app should be running at http://localhost:3002
|
||||
|
||||
### peer-test-app
|
||||
|
||||
The peer-test-app should be running at http://localhost:3003
|
||||
|
||||
## Details
|
||||
|
||||
* The relay node for p2p network is running at http://localhost:9090
|
||||
|
||||
* The [peer package](https://github.com/cerc-io/watcher-ts/tree/main/packages/peer) (published in [gitea](https://git.vdb.to/cerc-io/-/packages/npm/@cerc-io%2Fpeer)) can be used in client code for connecting to the network
|
||||
|
||||
* The [react-peer package](https://github.com/cerc-io/react-peer/tree/main/packages/react-peer) (published in [gitea](https://git.vdb.to/cerc-io/-/packages/npm/@cerc-io%2Freact-peer)) which uses the peer package can be used in react app for connecting to the network
|
||||
|
||||
## Demo
|
||||
|
||||
Follow the [demo](./demo.md) to try out the MobyMask app with L2 chain
|
||||
|
||||
## Clean up
|
||||
|
||||
To stop all the services running in background run:
|
||||
Stop all the services running in background run:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system down
|
||||
laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 down
|
||||
|
||||
laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd down
|
||||
```
|
||||
|
||||
Clear volumes:
|
||||
|
||||
* List all volumes
|
||||
|
||||
```bash
|
||||
docker volume ls
|
||||
```
|
||||
|
||||
* Remove volumes created by this stack
|
||||
|
||||
Example:
|
||||
```bash
|
||||
docker volume rm laconic-bfb01caf98b1b8f7c8db4d33f11b905a_moby_data_server
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user