Merge branch 'main' into dboreham/add-console

This commit is contained in:
David Boreham 2023-03-29 22:50:22 -06:00
commit 8bfc97bfbe
7 changed files with 34 additions and 36 deletions

View File

@ -23,9 +23,6 @@ services:
mobymask:
restart: unless-stopped
depends_on:
mobymask-watcher-db:
condition: service_healthy
image: cerc/mobymask:local
working_dir: /app/packages/server
environment:
@ -46,12 +43,17 @@ services:
depends_on:
mobymask-watcher-db:
condition: service_healthy
mobymask:
condition: service_healthy
image: cerc/watcher-mobymask-v2:local
command: ["sh", "-c", "yarn server"]
command: ["sh", "server-start.sh"]
volumes:
- ../config/watcher-mobymask-v2/watcher.toml:/app/packages/mobymask-v2-watcher/environments/local.toml
- ../config/watcher-mobymask-v2/watcher-config-template.toml:/app/packages/mobymask-v2-watcher/environments/watcher-config-template.toml
- ../config/watcher-mobymask-v2/peer.env:/app/packages/peer/.env
- ../config/watcher-mobymask-v2/relay-id.json:/app/packages/mobymask-v2-watcher/relay-id.json
- ../config/watcher-mobymask-v2/peer-id.json:/app/packages/mobymask-v2-watcher/peer-id.json
- ../config/watcher-mobymask-v2/server-start.sh:/app/packages/mobymask-v2-watcher/server-start.sh
- moby_data_server:/server
ports:
- "0.0.0.0:3001:3001"
- "0.0.0.0:9001:9001"
@ -63,19 +65,6 @@ services:
retries: 15
start_period: 5s
mobymask-watcher-peer:
restart: unless-stopped
depends_on:
mobymask:
condition: service_healthy
image: cerc/watcher-mobymask-v2:local
command: ["sh", "peer-start.sh"]
volumes:
- ../config/watcher-mobymask-v2/watcher.toml:/app/packages/mobymask-v2-watcher/environments/local.toml
- ../config/watcher-mobymask-v2/peer-id.json:/app/packages/mobymask-v2-watcher/peer-id.json
- ../config/watcher-mobymask-v2/peer-start.sh:/app/packages/mobymask-v2-watcher/peer-start.sh
- moby_data_server:/server
mobymask-app:
depends_on:
mobymask-watcher-server:

View File

@ -1,10 +0,0 @@
#!/bin/sh
# Private key of account with balance
PRIVATE_KEY=
# Assign deployed contract address from server config
CONTRACT_ADDRESS=`jq '.address' /server/config.json`
echo 'yarn peer-listener --contract-address <CONTRACT_ADDRESS> --private-key <PRIVATE_KEY>'
yarn peer-listener --contract-address $CONTRACT_ADDRESS --private-key $PRIVATE_KEY

View File

@ -0,0 +1,9 @@
#!/bin/sh
# Assign deployed contract address from server config
CONTRACT_ADDRESS=`jq '.address' /server/config.json`
sed "s/REPLACE_WITH_CONTRACT_ADDRESS/${CONTRACT_ADDRESS}/" environments/watcher-config-template.toml > environments/local.toml
echo 'yarn server'
yarn server

View File

@ -21,7 +21,7 @@
[server.p2p]
enableRelay = true
enablePeer = false
enablePeer = true
[server.p2p.relay]
host = "0.0.0.0"
@ -36,6 +36,10 @@
peerIdFile = './peer-id.json'
enableDebugInfo = true
[server.p2p.peer.l2TxConfig]
privateKey = ''
contractAddress = REPLACE_WITH_CONTRACT_ADDRESS
[metrics]
host = "0.0.0.0"
port = 9000

View File

@ -18,8 +18,9 @@ fi
set -e
target_package=$1
local_npm_registry_url=$2
# TODO: use jq rather than sed here:
versioned_target_package=$(grep ${target_package} package.json | sed -e 's#[[:space:]]\{1,\}\"\('${target_package}'\)\":[[:space:]]\{1,\}\"\(.*\)\",#\1@\2#' )
# Extract the actual version pinned in yarn.lock
# See: https://stackoverflow.com/questions/60454251/how-to-know-the-version-of-currently-installed-package-from-yarn-lock
versioned_target_package=$(yarn list --pattern ${target_package} --depth=0 --json --non-interactive --no-progress | jq -r '.data.trees[].name')
# Use yarn info to get URL checksums etc from the new registry
yarn_info_output=$(yarn info --json $versioned_target_package 2>/dev/null)
# First check if the target version actually exists.

View File

@ -18,11 +18,11 @@ Checkout to the required versions and branches in repos
```bash
# watcher-ts
cd ~/cerc/watcher-ts
git checkout v0.2.31
git checkout v0.2.34
# react-peer
cd ~/cerc/react-peer
git checkout v0.2.29
git checkout v0.2.31
# mobymask-ui
cd ~/cerc/mobymask-ui
@ -67,7 +67,7 @@ Deploy the stack:
* 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
* Create a new account named `alice`
```bash
laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd exec laconicd "laconicd keys add alice"
@ -85,7 +85,12 @@ Deploy the stack:
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
* Set the private key (`server.p2p.peer.l2TxConfig.privateKey`) in [watcher.toml](../../config/watcher-mobymask-v2/watcher.toml) file that will be used to start the peer that sends txs to L2 chain
```toml
[server.p2p.peer.l2TxConfig]
privateKey = 'ALICE_PRIVATE_KEY'
```
* Deploy the other containers

View File

@ -34,7 +34,7 @@
* Get the container id
```bash
laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 ps | grep mobymask-watcher-peer
laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 ps | grep mobymask-watcher-server
```
* Check logs