1
0

Merge pull request #44 from cerc-io/dboreham/build-mobymask-watcher

Build watcher container
This commit is contained in:
David Boreham 2022-11-07 20:24:25 -07:00 committed by GitHub
commit cc491263f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 127 additions and 0 deletions

View File

@ -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:

View File

@ -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

View File

@ -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}

View File

@ -12,4 +12,5 @@ cerc/laconicd
cerc/laconic-cns-cli cerc/laconic-cns-cli
cerc/fixturenet-eth-geth cerc/fixturenet-eth-geth
cerc/fixturenet-eth-lighthouse cerc/fixturenet-eth-lighthouse
cerc/watcher-mobymask
cerc/test-container cerc/test-container

View File

@ -9,3 +9,6 @@ vulcanize/ipld-eth-beacon-indexer
vulcanize/ipld-eth-beacon-db vulcanize/ipld-eth-beacon-db
cerc-io/laconicd cerc-io/laconicd
cerc-io/laconic-cns-cli cerc-io/laconic-cns-cli
cerc-io/mobymask-watcher
cerc-io/watcher-ts
vulcanize/assemblyscript

View File

@ -2,3 +2,22 @@
## Set up a Mobymask Watcher ## 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
```

View File

@ -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