diff --git a/compose/docker-compose-watcher-mobymask.yml b/compose/docker-compose-watcher-mobymask.yml new file mode 100644 index 0000000..38ea0cc --- /dev/null +++ b/compose/docker-compose-watcher-mobymask.yml @@ -0,0 +1,61 @@ +version: '3.2' + +services: + + watcher-db: + restart: unless-stopped + image: postgres:14-alpine + environment: + - POSTGRES_USER=vdbm + - POSTGRES_MULTIPLE_DATABASES=mobymask-watcher,mobymask-watcher-job-queue + - POSTGRES_EXTENSION=mobymask-watcher-job-queue:pgcrypto + - POSTGRES_PASSWORD=password + volumes: + - ../common/initdb.d/multiple-postgressql-databases.sh:/docker-entrypoint-initdb.d/multiple-postgressql-databases.sh + - watcher_db_data:/var/lib/postgresql/data + ports: + - "0.0.0.0:15432:5432" + healthcheck: + test: ["CMD", "nc", "-v", "localhost", "5432"] + interval: 20s + timeout: 5s + retries: 15 + start_period: 10s + + mobymask-watcher-server: + restart: unless-stopped + depends_on: + watcher-db: + condition: service_healthy + image: cerc/watcher-mobymask:local + command: ["sh", "-c", "yarn server"] + volumes: + - ../common/watcher-ts/mobymask-watcher.toml:/app/packages/mobymask-watcher/environments/local.toml + ports: + - "0.0.0.0:3001:3001" + - "0.0.0.0:9001:9001" + healthcheck: + test: ["CMD", "nc", "-v", "localhost", "3001"] + interval: 20s + timeout: 5s + retries: 15 + start_period: 5s + + mobymask-watcher-job-runner: + restart: unless-stopped + depends_on: + mobymask-watcher-server: + condition: service_healthy + watcher-db: + condition: service_healthy + image: cerc/watcher-mobymask:local + command: ["sh", "-c", "yarn job-runner"] + volumes: + - ../common/watcher-ts/mobymask-watcher.toml:/app/packages/mobymask-watcher/environments/local.toml + ports: + - "0.0.0.0:9000:9000" + +volumes: + indexer_db_data: + watcher_db_data: + \ No newline at end of file diff --git a/container-build/cerc-watcher-mobymask/Dockerfile b/container-build/cerc-watcher-mobymask/Dockerfile new file mode 100644 index 0000000..b27c6f9 --- /dev/null +++ b/container-build/cerc-watcher-mobymask/Dockerfile @@ -0,0 +1,27 @@ +# TODO: move this into the cerc-io/mobymask-watcher repo +FROM node:16.17.1-alpine3.16 + +RUN apk --update --no-cache add git python3 alpine-sdk + +WORKDIR /app + +COPY assemblyscript assemblyscript +COPY watcher-ts watcher-ts + +# TODO: needs branch ng-integrate-asyncify +# We use a mixture of npm and yarn below because the upstream +# project checked in an npm package-log.json file +RUN echo "Building assemblyscript" && \ + cd assemblyscript && \ + npm install && npm run build && yarn link + +# TODO: needs branch v0.2.13 +# 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 diff --git a/container-build/cerc-watcher-mobymask/build.sh b/container-build/cerc-watcher-mobymask/build.sh new file mode 100755 index 0000000..a4a97cd --- /dev/null +++ b/container-build/cerc-watcher-mobymask/build.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# Build cerc/watcher-mobymask + +# See: https://stackoverflow.com/a/246128/1701505 +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} diff --git a/container-image-list.txt b/container-image-list.txt index 80cef72..65c1c54 100644 --- a/container-image-list.txt +++ b/container-image-list.txt @@ -12,4 +12,5 @@ cerc/laconicd cerc/laconic-cns-cli cerc/fixturenet-eth-geth cerc/fixturenet-eth-lighthouse +cerc/watcher-mobymask cerc/test-container diff --git a/repository-list.txt b/repository-list.txt index 01e178a..6bc5970 100644 --- a/repository-list.txt +++ b/repository-list.txt @@ -9,3 +9,6 @@ vulcanize/ipld-eth-beacon-indexer vulcanize/ipld-eth-beacon-db cerc-io/laconicd cerc-io/laconic-cns-cli +cerc-io/mobymask-watcher +cerc-io/watcher-ts +vulcanize/assemblyscript diff --git a/stacks/mobymask/README.md b/stacks/mobymask/README.md index 542064d..b3263d8 100644 --- a/stacks/mobymask/README.md +++ b/stacks/mobymask/README.md @@ -2,3 +2,22 @@ ## Set up a Mobymask Watcher +## Clone required repositories +``` +$ laconic-so setup-repositories +``` +Checkout required branches: +``` +$ cd ~/cerc/assemblyscript +$ git checkout ng-integrate-asyncify +$ cd ~/cerc/watcher-ts +$ git checkout v0.2.13 +``` +## Build the watcher container +``` +$ laconic-sh build-containers --include cerc/watcher-mobymask +``` +## Deploy the stack +``` +$ laconic-sh deploy-system --include watcher-mobymask +``` \ No newline at end of file diff --git a/stacks/mobymask/stack.yml b/stacks/mobymask/stack.yml new file mode 100644 index 0000000..c7b4eea --- /dev/null +++ b/stacks/mobymask/stack.yml @@ -0,0 +1,8 @@ +name: mobymask-watcher +repos: + - cerc-io/watcher-ts/v0.2.13 + - vulcanize/assemblyscript/ng-integrate-asyncify +containers: + - cerc/watcher-mobymask +pods: + - watcher-mobymask \ No newline at end of file