Add watcher-ts image for running peer tests

This commit is contained in:
nabarun 2023-04-14 11:28:05 +05:30
parent 178570f8f4
commit 2519376356
8 changed files with 32 additions and 13 deletions

View File

@ -54,16 +54,22 @@ services:
extra_hosts:
- "host.docker.internal:host-gateway"
# Creates peer-id files if they don't exist
# Container keeps running so that peer tests can be run
watcher-ts-peer:
# TODO: Use watcher-ts local container or publish watcher-ts image
image: ghcr.io/cerc-io/watcher-ts:v0.2.37
image: cerc/watcher-ts:local
restart: on-failure
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
working_dir: /app/packages/peer
command: ["sh", "start-watcher-ts-shell.sh"]
command:
- sh
- -c
- |
./start-watcher-ts-peer.sh && \
tail -f /dev/null
volumes:
- ../config/watcher-mobymask-v2/start-watcher-ts-shell.sh:/app/packages/peer/start-watcher-ts-shell.sh
- ../config/watcher-mobymask-v2/start-watcher-ts-peer.sh:/app/packages/peer/start-watcher-ts-peer.sh
- peers_ids:/app/packages/peer
healthcheck:
test: ["CMD", "ls", /app/packages/peer/peer-id.json]

View File

@ -4,10 +4,6 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
# TODO: Build in Dockerfile
apk --update --no-cache add jq
yarn build
# Check for peer ids in ./peers folder, create if not present
if [ -f ./relay-id.json ]; then
echo "Using peer id for relay node from the mounted volume"
@ -27,6 +23,3 @@ CERC_RELAY_MULTIADDR="/dns4/mobymask-watcher-server/tcp/9090/ws/p2p/$(jq -r '.id
# Write the relay node's multiaddr to /app/packages/peer/.env for running tests
echo "RELAY=\"$CERC_RELAY_MULTIADDR\"" > ./.env
# TODO: Discuss leave shell running
tail -f .env

View 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

View 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

View File

@ -14,6 +14,7 @@ cerc/laconic-registry-cli
cerc/laconic-console-host
cerc/fixturenet-eth-geth
cerc/fixturenet-eth-lighthouse
cerc/watcher-ts
cerc/watcher-mobymask
cerc/watcher-erc20
cerc/watcher-erc721

View File

@ -10,6 +10,7 @@ laconicd
fixturenet-laconicd
fixturenet-eth
fixturenet-eth-metrics
watcher-ts
watcher-mobymask
watcher-erc20
watcher-erc721

View File

@ -73,13 +73,13 @@ Deploy the stack:
Find the watcher container's id and export it for later use:
```bash
export CONTAINER_ID=$(docker ps -q --filter "name=mobymask-watcher-server")
export CONTAINER_ID=$(docker ps -q --filter "name=watcher-ts-peer")
```
Run the peer tests:
```bash
docker exec -w /app/packages/peer $CONTAINER_ID yarn test
docker exec $CONTAINER_ID yarn test
```
## Web Apps

View File

@ -19,6 +19,7 @@ containers:
- cerc/optimism-l2geth
- cerc/optimism-op-batcher
- cerc/optimism-op-node
- cerc/watcher-ts
- cerc/watcher-mobymask-v2
- cerc/react-peer
- cerc/mobymask-ui