Use standalone mobymask-v2-watcher-ts for running watcher server #327
@ -10,8 +10,12 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||||
CERC_RELAY_NODES: ${CERC_RELAY_NODES}
|
CERC_RELAY_NODES: ${CERC_RELAY_NODES}
|
||||||
command: ["sh", "./test-app-start.sh"]
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- ./wait-for-it.sh -h ${CERC_WATCHER_HOST:-$${DEFAULT_CERC_WATCHER_HOST}} -p ${CERC_WATCHER_PORT:-$${DEFAULT_CERC_WATCHER_PORT}} -s -t 0 -- ./test-app-start.sh
|
||||||
volumes:
|
volumes:
|
||||||
|
- ../config/wait-for-it.sh:/scripts/wait-for-it.sh
|
||||||
- ../config/watcher-mobymask-v2/test-app-start.sh:/scripts/test-app-start.sh
|
- ../config/watcher-mobymask-v2/test-app-start.sh:/scripts/test-app-start.sh
|
||||||
- peers_ids:/peers
|
- peers_ids:/peers
|
||||||
ports:
|
ports:
|
||||||
|
@ -54,6 +54,18 @@ services:
|
|||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
|
|
||||||
|
# Creates peer-id files if they don't exist
|
||||||
|
peer-ids-gen:
|
||||||
|
image: cerc/watcher-ts:local
|
||||||
|
restart: on-failure
|
||||||
|
environment:
|
||||||
|
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||||
|
working_dir: /app/packages/peer
|
||||||
|
command: ["sh", "generate-peer-ids.sh"]
|
||||||
|
volumes:
|
||||||
|
- ../config/watcher-mobymask-v2/generate-peer-ids.sh:/app/packages/peer/generate-peer-ids.sh
|
||||||
|
- peers_ids:/peer-ids
|
||||||
|
|
||||||
# Starts the mobymask-v2-watcher server
|
# Starts the mobymask-v2-watcher server
|
||||||
mobymask-watcher-server:
|
mobymask-watcher-server:
|
||||||
image: cerc/watcher-mobymask-v2:local
|
image: cerc/watcher-mobymask-v2:local
|
||||||
@ -61,6 +73,8 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
mobymask-watcher-db:
|
mobymask-watcher-db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
peer-ids-gen:
|
||||||
|
condition: service_completed_successfully
|
||||||
mobymask:
|
mobymask:
|
||||||
condition: service_completed_successfully
|
condition: service_completed_successfully
|
||||||
env_file:
|
env_file:
|
||||||
@ -76,9 +90,9 @@ services:
|
|||||||
CERC_DEPLOYED_CONTRACT: ${CERC_DEPLOYED_CONTRACT}
|
CERC_DEPLOYED_CONTRACT: ${CERC_DEPLOYED_CONTRACT}
|
||||||
command: ["sh", "start-server.sh"]
|
command: ["sh", "start-server.sh"]
|
||||||
volumes:
|
volumes:
|
||||||
- ../config/watcher-mobymask-v2/watcher-config-template.toml:/app/packages/mobymask-v2-watcher/environments/watcher-config-template.toml
|
- ../config/watcher-mobymask-v2/watcher-config-template.toml:/app/environments/watcher-config-template.toml
|
||||||
- ../config/watcher-mobymask-v2/start-server.sh:/app/packages/mobymask-v2-watcher/start-server.sh
|
- ../config/watcher-mobymask-v2/start-server.sh:/app/start-server.sh
|
||||||
- peers_ids:/app/packages/mobymask-v2-watcher/peers
|
- peers_ids:/app/peers
|
||||||
- mobymask_deployment:/server
|
- mobymask_deployment:/server
|
||||||
- fixturenet_geth_accounts:/geth-accounts:ro
|
- fixturenet_geth_accounts:/geth-accounts:ro
|
||||||
# Expose GQL, metrics and relay node ports
|
# Expose GQL, metrics and relay node ports
|
||||||
@ -95,6 +109,28 @@ services:
|
|||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
|
|
||||||
|
# Container to run peer tests
|
||||||
|
peer-tests:
|
||||||
|
image: cerc/watcher-ts:local
|
||||||
|
restart: on-failure
|
||||||
|
depends_on:
|
||||||
|
mobymask-watcher-server:
|
||||||
|
condition: service_healthy
|
||||||
|
peer-ids-gen:
|
||||||
|
condition: service_completed_successfully
|
||||||
|
environment:
|
||||||
|
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||||
|
working_dir: /app/packages/peer
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
./set-tests-env.sh && \
|
||||||
|
tail -f /dev/null
|
||||||
|
volumes:
|
||||||
|
- ../config/watcher-mobymask-v2/set-tests-env.sh:/app/packages/peer/set-tests-env.sh
|
||||||
|
- peers_ids:/peer-ids
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
mobymask_watcher_db_data:
|
mobymask_watcher_db_data:
|
||||||
peers_ids:
|
peers_ids:
|
||||||
|
20
app/data/config/watcher-mobymask-v2/generate-peer-ids.sh
Executable file
20
app/data/config/watcher-mobymask-v2/generate-peer-ids.sh
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check for peer ids in ./peers folder, create if not present
|
||||||
|
if [ -f /peer-ids/relay-id.json ]; then
|
||||||
|
echo "Using peer id for relay node from the mounted volume"
|
||||||
|
else
|
||||||
|
echo "Creating a new peer id for relay node"
|
||||||
|
yarn create-peer -f /peer-ids/relay-id.json
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f /peer-ids/peer-id.json ]; then
|
||||||
|
echo "Using peer id for peer node from the mounted volume"
|
||||||
|
else
|
||||||
|
echo "Creating a new peer id for peer node"
|
||||||
|
yarn create-peer -f /peer-ids/peer-id.json
|
||||||
|
fi
|
10
app/data/config/watcher-mobymask-v2/set-tests-env.sh
Executable file
10
app/data/config/watcher-mobymask-v2/set-tests-env.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
|
CERC_RELAY_MULTIADDR="/dns4/mobymask-watcher-server/tcp/9090/ws/p2p/$(jq -r '.id' /peer-ids/relay-id.json)"
|
||||||
|
|
||||||
|
# Write the relay node's multiaddr to /app/packages/peer/.env for running tests
|
||||||
|
echo "RELAY=\"$CERC_RELAY_MULTIADDR\"" > ./.env
|
@ -14,26 +14,7 @@ CERC_DEPLOYED_CONTRACT="${CERC_DEPLOYED_CONTRACT:-${DEFAULT_CERC_DEPLOYED_CONTRA
|
|||||||
|
|
||||||
echo "Using L2 RPC endpoint ${CERC_L2_GETH_RPC}"
|
echo "Using L2 RPC endpoint ${CERC_L2_GETH_RPC}"
|
||||||
|
|
||||||
# Check for peer ids in ./peers folder, create if not present
|
CERC_RELAY_MULTIADDR="/dns4/mobymask-watcher-server/tcp/9090/ws/p2p/$(jq -r '.id' /app/peers/relay-id.json)"
|
||||||
if [ -f ./peers/relay-id.json ]; then
|
|
||||||
echo "Using peer id for relay node from the mounted volume"
|
|
||||||
else
|
|
||||||
echo "Creating a new peer id for relay node"
|
|
||||||
cd ../peer
|
|
||||||
yarn create-peer -f ../mobymask-v2-watcher/peers/relay-id.json
|
|
||||||
cd ../mobymask-v2-watcher
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f ./peers/peer-id.json ]; then
|
|
||||||
echo "Using peer id for peer node from the mounted volume"
|
|
||||||
else
|
|
||||||
echo "Creating a new peer id for peer node"
|
|
||||||
cd ../peer
|
|
||||||
yarn create-peer -f ../mobymask-v2-watcher/peers/peer-id.json
|
|
||||||
cd ../mobymask-v2-watcher
|
|
||||||
fi
|
|
||||||
|
|
||||||
CERC_RELAY_MULTIADDR="/dns4/mobymask-watcher-server/tcp/9090/ws/p2p/$(jq -r '.id' ./peers/relay-id.json)"
|
|
||||||
|
|
||||||
# Use contract address from environment variable or set from config.json in mounted volume
|
# Use contract address from environment variable or set from config.json in mounted volume
|
||||||
if [ -n "$CERC_DEPLOYED_CONTRACT" ]; then
|
if [ -n "$CERC_DEPLOYED_CONTRACT" ]; then
|
||||||
@ -65,8 +46,5 @@ WATCHER_CONFIG=$(echo "$WATCHER_CONFIG_TEMPLATE" | \
|
|||||||
# Write the modified content to a new file
|
# Write the modified content to a new file
|
||||||
echo "$WATCHER_CONFIG" > environments/local.toml
|
echo "$WATCHER_CONFIG" > environments/local.toml
|
||||||
|
|
||||||
# Write the relay node's multiaddr to /app/packages/peer/.env for running tests
|
|
||||||
echo "RELAY=\"$CERC_RELAY_MULTIADDR\"" > /app/packages/peer/.env
|
|
||||||
|
|
||||||
echo 'yarn server'
|
echo 'yarn server'
|
||||||
yarn server
|
yarn server
|
||||||
|
@ -17,4 +17,4 @@ COPY . .
|
|||||||
RUN echo "Building watcher-ts" && \
|
RUN echo "Building watcher-ts" && \
|
||||||
yarn && yarn build
|
yarn && yarn build
|
||||||
|
|
||||||
WORKDIR /app/packages/mobymask-v2-watcher
|
WORKDIR /app
|
||||||
|
@ -6,4 +6,4 @@ source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
|||||||
# See: https://stackoverflow.com/a/246128/1701505
|
# See: https://stackoverflow.com/a/246128/1701505
|
||||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
|
|
||||||
docker build -t cerc/watcher-mobymask-v2:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/watcher-ts
|
docker build -t cerc/watcher-mobymask-v2:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/mobymask-v2-watcher-ts
|
||||||
|
10
app/data/container-build/cerc-watcher-ts/Dockerfile
Normal file
10
app/data/container-build/cerc-watcher-ts/Dockerfile
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
FROM node:16.17.1-alpine3.16
|
||||||
|
|
||||||
|
RUN apk --update --no-cache add git python3 alpine-sdk jq
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN echo "Building watcher-ts" && \
|
||||||
|
yarn && yarn build
|
7
app/data/container-build/cerc-watcher-ts/build.sh
Executable file
7
app/data/container-build/cerc-watcher-ts/build.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Build cerc/watcher-erc20
|
||||||
|
|
||||||
|
# See: https://stackoverflow.com/a/246128/1701505
|
||||||
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
|
|
||||||
|
docker build -t cerc/watcher-ts:local -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/watcher-ts
|
@ -14,6 +14,7 @@ cerc/laconic-registry-cli
|
|||||||
cerc/laconic-console-host
|
cerc/laconic-console-host
|
||||||
cerc/fixturenet-eth-geth
|
cerc/fixturenet-eth-geth
|
||||||
cerc/fixturenet-eth-lighthouse
|
cerc/fixturenet-eth-lighthouse
|
||||||
|
cerc/watcher-ts
|
||||||
cerc/watcher-mobymask
|
cerc/watcher-mobymask
|
||||||
cerc/watcher-erc20
|
cerc/watcher-erc20
|
||||||
cerc/watcher-erc721
|
cerc/watcher-erc721
|
||||||
|
@ -10,6 +10,7 @@ laconicd
|
|||||||
fixturenet-laconicd
|
fixturenet-laconicd
|
||||||
fixturenet-eth
|
fixturenet-eth
|
||||||
fixturenet-eth-metrics
|
fixturenet-eth-metrics
|
||||||
|
watcher-ts
|
||||||
watcher-mobymask
|
watcher-mobymask
|
||||||
watcher-erc20
|
watcher-erc20
|
||||||
watcher-erc721
|
watcher-erc721
|
||||||
|
@ -12,6 +12,7 @@ cerc-io/laconic-registry-cli
|
|||||||
cerc-io/laconic-console
|
cerc-io/laconic-console
|
||||||
cerc-io/mobymask-watcher
|
cerc-io/mobymask-watcher
|
||||||
cerc-io/watcher-ts
|
cerc-io/watcher-ts
|
||||||
|
cerc-io/mobymask-v2-watcher-ts
|
||||||
cerc-io/react-peer
|
cerc-io/react-peer
|
||||||
cerc-io/mobymask-ui
|
cerc-io/mobymask-ui
|
||||||
cerc-io/MobyMask
|
cerc-io/MobyMask
|
||||||
|
@ -23,15 +23,7 @@ Checkout to the required versions and branches in repos
|
|||||||
```bash
|
```bash
|
||||||
# watcher-ts
|
# watcher-ts
|
||||||
cd ~/cerc/watcher-ts
|
cd ~/cerc/watcher-ts
|
||||||
git checkout v0.2.35
|
git checkout v0.2.39
|
||||||
|
|
||||||
# react-peer
|
|
||||||
cd ~/cerc/react-peer
|
|
||||||
git checkout v0.2.32
|
|
||||||
|
|
||||||
# mobymask-ui
|
|
||||||
cd ~/cerc/mobymask-ui
|
|
||||||
git checkout v0.1.2
|
|
||||||
|
|
||||||
# MobyMask
|
# MobyMask
|
||||||
cd ~/cerc/MobyMask
|
cd ~/cerc/MobyMask
|
||||||
@ -73,13 +65,13 @@ Deploy the stack:
|
|||||||
Find the watcher container's id and export it for later use:
|
Find the watcher container's id and export it for later use:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export CONTAINER_ID=$(docker ps -q --filter "name=mobymask-watcher-server")
|
export CONTAINER_ID=$(docker ps -q --filter "name=peer-tests")
|
||||||
```
|
```
|
||||||
|
|
||||||
Run the peer tests:
|
Run the peer tests:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker exec -w /app/packages/peer $CONTAINER_ID yarn test
|
docker exec $CONTAINER_ID yarn test
|
||||||
```
|
```
|
||||||
|
|
||||||
## Web Apps
|
## Web Apps
|
||||||
|
@ -66,7 +66,7 @@
|
|||||||
* Get the deployed contract address:
|
* Get the deployed contract address:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker exec -it $(docker ps -aq --filter name="mobymask-app") cat src/config.json
|
docker exec -it $(docker ps -aq --filter name="mobymask-app") cat /config/config.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
The value of `address` field is the deployed contract address
|
The value of `address` field is the deployed contract address
|
||||||
|
@ -6,8 +6,7 @@ repos:
|
|||||||
- ethereum-optimism/optimism
|
- ethereum-optimism/optimism
|
||||||
- ethereum-optimism/op-geth
|
- ethereum-optimism/op-geth
|
||||||
- cerc-io/watcher-ts
|
- cerc-io/watcher-ts
|
||||||
- cerc-io/react-peer
|
- cerc-io/mobymask-v2-watcher-ts
|
||||||
- cerc-io/mobymask-ui
|
|
||||||
- cerc-io/MobyMask
|
- cerc-io/MobyMask
|
||||||
containers:
|
containers:
|
||||||
- cerc/go-ethereum
|
- cerc/go-ethereum
|
||||||
@ -19,6 +18,7 @@ containers:
|
|||||||
- cerc/optimism-l2geth
|
- cerc/optimism-l2geth
|
||||||
- cerc/optimism-op-batcher
|
- cerc/optimism-op-batcher
|
||||||
- cerc/optimism-op-node
|
- cerc/optimism-op-node
|
||||||
|
- cerc/watcher-ts
|
||||||
- cerc/watcher-mobymask-v2
|
- cerc/watcher-mobymask-v2
|
||||||
- cerc/react-peer
|
- cerc/react-peer
|
||||||
- cerc/mobymask-ui
|
- cerc/mobymask-ui
|
||||||
|
@ -6,26 +6,6 @@ Instructions to setup and deploy MobyMask and Peer Test web apps
|
|||||||
|
|
||||||
Prerequisite: Watcher with GQL and relay node endpoints
|
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
|
|
||||||
|
|
||||||
# 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
|
|
||||||
```
|
|
||||||
|
|
||||||
Checkout to the required versions and branches in repos:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# react-peer
|
|
||||||
cd ~/cerc/react-peer
|
|
||||||
git checkout v0.2.32
|
|
||||||
|
|
||||||
# mobymask-ui
|
|
||||||
cd ~/cerc/mobymask-ui
|
|
||||||
git checkout v0.1.2
|
|
||||||
```
|
|
||||||
|
|
||||||
Build the container images:
|
Build the container images:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
Loading…
Reference in New Issue
Block a user