watcher-ts/docs
2023-01-16 07:40:38 -05:00
..
README.md combine demo & readme, erc20-watcher 2023-01-16 07:40:38 -05:00
watchers-graphic.png update readmes 2023-01-16 07:40:23 -05:00

Watcher Documentation

Setting up without Stack Orchestrator

  • requries the three services
  • setup postgres (incl. PG crypto)
  • then demo each watcher

Setup

  • Create a postgres12 database for the watcher:

    sudo su - postgres
    
    # If database already exists
    # dropdb erc20-watcher
    
    createdb erc20-watcher
    

Create a postgres12 database for the job queue:

sudo su - postgres
createdb erc20-watcher-job-queue

Enable the pgcrypto extension on the job queue database (https://github.com/timgit/pg-boss/blob/master/docs/usage.md#intro).

Example:

postgres@tesla:~$ psql -U postgres -h localhost erc20-watcher-job-queue
Password for user postgres:
psql (12.7 (Ubuntu 12.7-1.pgdg18.04+1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.

erc20-watcher-job-queue=# CREATE EXTENSION pgcrypto;
CREATE EXTENSION
erc20-watcher-job-queue=# exit

Create a postgres12 database for the erc20 watcher:

sudo su - postgres
createdb erc20-watcher

Update environments/local.toml with database connection settings for both the databases.

[database]
  type = "postgres"
  host = "localhost"
  port = 5432
  database = "erc20-watcher"
  username = "postgres"
  password = "postgres"

[jobQueue]
  dbConnectionString = "postgres://postgres:postgres@localhost/erc20-watcher-job-queue"

Update the upstream config in environments/local.toml. Provide the ipld-eth-server GQL and RPC API endpoints.

[upstream]
  [upstream.ethServer]
    gqlApiEndpoint = "http://127.0.0.1:8082/graphql"
    rpcProviderEndpoint = "http://127.0.0.1:8081"

Ensure that watcher is of active kind. Update the kind in server config to active.

[server]
  kind = "active"