1
0

Upgrade watcher-ts version in the mobymask stack (#83)

* Upgrade watcher-ts version in mobymask setup

* Change watcher db service name

* Add a clean-up step
This commit is contained in:
prathamesh0 2022-12-22 19:43:13 +05:30 committed by GitHub
parent d51508b01d
commit 3b031329b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 48 additions and 48 deletions

View File

@ -4,7 +4,7 @@ version: '3.2'
services: services:
watcher-db: mobymask-watcher-db:
restart: unless-stopped restart: unless-stopped
image: postgres:14-alpine image: postgres:14-alpine
environment: environment:
@ -14,7 +14,7 @@ services:
- POSTGRES_PASSWORD=password - POSTGRES_PASSWORD=password
volumes: volumes:
- ../config/postgresql/multiple-postgressql-databases.sh:/docker-entrypoint-initdb.d/multiple-postgressql-databases.sh - ../config/postgresql/multiple-postgressql-databases.sh:/docker-entrypoint-initdb.d/multiple-postgressql-databases.sh
- watcher_db_data:/var/lib/postgresql/data - mobymask_watcher_db_data:/var/lib/postgresql/data
ports: ports:
- "0.0.0.0:15432:5432" - "0.0.0.0:15432:5432"
healthcheck: healthcheck:
@ -27,12 +27,12 @@ services:
mobymask-watcher-server: mobymask-watcher-server:
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
watcher-db: mobymask-watcher-db:
condition: service_healthy condition: service_healthy
image: cerc/watcher-mobymask:local image: cerc/watcher-mobymask:local
command: ["sh", "-c", "yarn server"] command: ["sh", "-c", "yarn server"]
volumes: volumes:
- ../config/watcher-mobymask/mobymask-watcher.toml:/app/watcher-ts/packages/mobymask-watcher/environments/local.toml - ../config/watcher-mobymask/mobymask-watcher.toml:/app/packages/mobymask-watcher/environments/local.toml
ports: ports:
- "0.0.0.0:3001:3001" - "0.0.0.0:3001:3001"
- "0.0.0.0:9001:9001" - "0.0.0.0:9001:9001"
@ -50,18 +50,16 @@ services:
depends_on: depends_on:
mobymask-watcher-server: mobymask-watcher-server:
condition: service_healthy condition: service_healthy
watcher-db: mobymask-watcher-db:
condition: service_healthy condition: service_healthy
image: cerc/watcher-mobymask:local image: cerc/watcher-mobymask:local
command: ["sh", "-c", "yarn job-runner"] command: ["sh", "-c", "yarn job-runner"]
volumes: volumes:
- ../config/watcher-mobymask/mobymask-watcher.toml:/app/watcher-ts/packages/mobymask-watcher/environments/local.toml - ../config/watcher-mobymask/mobymask-watcher.toml:/app/packages/mobymask-watcher/environments/local.toml
ports: ports:
- "0.0.0.0:9000:9000" - "0.0.0.0:9000:9000"
extra_hosts: extra_hosts:
- "ipld-eth-server:host-gateway" - "ipld-eth-server:host-gateway"
volumes: volumes:
indexer_db_data: mobymask_watcher_db_data:
watcher_db_data:

View File

@ -27,7 +27,7 @@
[database] [database]
type = "postgres" type = "postgres"
host = "watcher-db" host = "mobymask-watcher-db"
port = 5432 port = 5432
database = "mobymask-watcher" database = "mobymask-watcher"
username = "vdbm" username = "vdbm"
@ -37,8 +37,8 @@
[upstream] [upstream]
[upstream.ethServer] [upstream.ethServer]
gqlApiEndpoint = "http://ipld-eth-server:8082/graphql" gqlApiEndpoint = "http://ipld-eth-server:8083/graphql"
rpcProviderEndpoint = "http://ipld-eth-server:8081" rpcProviderEndpoint = "http://ipld-eth-server:8082"
blockDelayInMilliSecs = 60000 blockDelayInMilliSecs = 60000
[upstream.cache] [upstream.cache]
@ -47,7 +47,7 @@
deleteOnStart = false deleteOnStart = false
[jobQueue] [jobQueue]
dbConnectionString = "postgres://vdbm:password@watcher-db/mobymask-watcher-job-queue" dbConnectionString = "postgres://vdbm:password@mobymask-watcher-db/mobymask-watcher-job-queue"
maxCompletionLagInSecs = 300 maxCompletionLagInSecs = 300
jobDelayInMilliSecs = 100 jobDelayInMilliSecs = 100
eventsInBatch = 50 eventsInBatch = 50

View File

@ -5,23 +5,10 @@ RUN apk --update --no-cache add git python3 alpine-sdk
WORKDIR /app WORKDIR /app
COPY assemblyscript assemblyscript COPY . .
COPY watcher-ts watcher-ts
# TODO: needs branch ng-integrate-asyncify RUN echo "Building watcher-ts" && \
# We use a mixture of npm and yarn below because the upstream git checkout v0.2.19 && \
# project checked in an npm package-log.json file yarn && yarn build
RUN echo "Building assemblyscript" && \
cd assemblyscript && \
npm install && npm run build && yarn link
# TODO: needs branch v0.2.13 WORKDIR /app/packages/mobymask-watcher
# The shenanigans below is due to yarn and lerna being a dumpster-fire
RUN echo "Linking watcher-ts to local assemblyscript" && \
cd watcher-ts/packages/graph-node && yarn remove @vulcanize/assemblyscript && \
yarn add https://github.com/vulcanize/assemblyscript.git#ng-integrate-asyncify
RUN echo "Building watcher-tst" && \
cd watcher-ts && yarn && yarn link "@vulcanize/assemblyscript" && yarn build
WORKDIR /app/watcher-ts/packages/mobymask-watcher

View File

@ -4,5 +4,6 @@
# 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 )
# TODO: add a mechanism to pass two repos into a container rather than the parent directory as below docker build -t cerc/watcher-mobymask:local -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}/watcher-ts
docker build -t cerc/watcher-mobymask:local -f ${SCRIPT_DIR}/Dockerfile ${CERC_REPO_BASE_DIR}
# TODO: add a mechanism to pass two repos into a container rather than the parent directory

View File

@ -3,36 +3,51 @@
The MobyMask watcher is a Laconic Network component that provides efficient access to MobyMask contract data from Ethereum, along with evidence allowing users to verify the correctness of that data. The watcher source code is available in [this repository](https://github.com/cerc-io/watcher-ts/tree/main/packages/mobymask-watcher) and a developer-oriented Docker Compose setup for the watcher can be found [here](https://github.com/cerc-io/mobymask-watcher). The watcher can be deployed automatically using the Laconic Stack Orchestrator tool as detailed below: The MobyMask watcher is a Laconic Network component that provides efficient access to MobyMask contract data from Ethereum, along with evidence allowing users to verify the correctness of that data. The watcher source code is available in [this repository](https://github.com/cerc-io/watcher-ts/tree/main/packages/mobymask-watcher) and a developer-oriented Docker Compose setup for the watcher can be found [here](https://github.com/cerc-io/mobymask-watcher). The watcher can be deployed automatically using the Laconic Stack Orchestrator tool as detailed below:
## Deploy the MobyMask Watcher ## Deploy the MobyMask Watcher
The instructions below show how to deploy a MobyMask watcher using laconic-stack-orchestrator (the installation of which is covered [here](https://github.com/cerc-io/stack-orchestrator#user-mode)). The instructions below show how to deploy a MobyMask watcher using laconic-stack-orchestrator (the installation of which is covered [here](https://github.com/cerc-io/stack-orchestrator#user-mode)).
This deployment expects that ipld-eth-server's endpoints are available on the local machine at http://ipld-eth-server.example.com:8083/graphql and http://ipld-eth-server.example.com:8082. More advanced configurations are supported by modifying the watcher's [config file](../../config/watcher-mobymask/mobymask-watcher.toml). This deployment expects that ipld-eth-server's endpoints are available on the local machine at http://ipld-eth-server.example.com:8083/graphql and http://ipld-eth-server.example.com:8082. More advanced configurations are supported by modifying the watcher's [config file](../../config/watcher-mobymask/mobymask-watcher.toml).
## Clone required repositories ## Clone required repositories
``` ```
$ laconic-so setup-repositories --include vulcanize/assemblyscript,cerc-io/watcher-ts $ laconic-so setup-repositories --include cerc-io/watcher-ts
```
Checkout required branches for the current release:
```
$ cd ~/cerc/assemblyscript
$ git checkout ng-integrate-asyncify
$ cd ~/cerc/watcher-ts
$ git checkout v0.2.13
``` ```
## Build the watcher container ## Build the watcher container
``` ```
$ laconic-sh build-containers --include cerc/watcher-mobymask $ laconic-so build-containers --include cerc/watcher-mobymask
``` ```
This should create a container with tag `cerc/watcher-mobymask` in the local image registry. This should create a container with tag `cerc/watcher-mobymask` in the local image registry.
## Deploy the stack ## Deploy the stack
First the watcher database has to be initialized. Start only the watcher-db service:
First the watcher database has to be initialized. Start only the mobymask-watcher-db service:
``` ```
$ laconic-so deploy-system --include watcher-mobymask up watcher-db $ laconic-so deploy-system --include watcher-mobymask up mobymask-watcher-db
``` ```
Next find the container's id using `docker ps` then run the following command to initialize the database: Next find the container's id using `docker ps` then run the following command to initialize the database:
``` ```
$ docker exec -i <watcher-db-container> psql -U vdbm mobymask-watcher < config/watcher-mobymask/mobymask-watcher-db.sql $ docker exec -i <mobymask-watcher-db-container> psql -U vdbm mobymask-watcher < config/watcher-mobymask/mobymask-watcher-db.sql
``` ```
Finally start the remaining containers: Finally start the remaining containers:
``` ```
$ laconic-so deploy-system --include watcher-mobymask $ laconic-so deploy-system --include watcher-mobymask up
``` ```
Correct operation should be verified by following the instructions [here](https://github.com/cerc-io/mobymask-watcher/tree/main/mainnet-watcher-only#run), checking GraphQL queries return valid results in the watcher's [playground](http://127.0.0.1:3001/graphql). Correct operation should be verified by following the instructions [here](https://github.com/cerc-io/mobymask-watcher/tree/main/mainnet-watcher-only#run), checking GraphQL queries return valid results in the watcher's [playground](http://127.0.0.1:3001/graphql).
## Clean up
Stop all the services running in background:
```bash
$ laconic-so deploy-system --include watcher-mobymask down
```

View File

@ -1,8 +1,7 @@
version: "1.0" version: "1.0"
name: mobymask-watcher name: mobymask-watcher
repos: repos:
- cerc-io/watcher-ts/v0.2.13 - cerc-io/watcher-ts/v0.2.19
- vulcanize/assemblyscript/ng-integrate-asyncify
containers: containers:
- cerc/watcher-mobymask - cerc/watcher-mobymask
pods: pods: