mirror of
https://github.com/cerc-io/watcher-ts
synced 2024-11-19 20:36:19 +00:00
deduplicate into a docs/README
This commit is contained in:
parent
4080e2ded7
commit
4ee889eaa7
145
docs/README.md
145
docs/README.md
@ -1,34 +1,44 @@
|
||||
# Watcher Documentation
|
||||
|
||||
## Setting up without Stack Orchestrator
|
||||
This document is specifically focused on standing up a minimal core version of the Laconic Stack *without* using [Stack Orchestrator]( https://github.com/cerc-io/stack-orchestrator). If this is your first foray into the stack, start with Stack Orchestrator. To understand what is going on under the hood or to make contributions to this repo, this is a good place to start.
|
||||
|
||||
- requries the three services
|
||||
- setup postgres (incl. PG crypto)
|
||||
- then demo each watcher
|
||||
There are 3 main components to setting up an environment for running watchers:
|
||||
- core services
|
||||
- configure postgres
|
||||
- edit config file
|
||||
|
||||
## Setup
|
||||
After which you should be able to navigate to the `README.md` of any watcher and run through its demo using `yarn`. The common `yarn` CLI commands for watchers are documented [here](../cli.md).
|
||||
|
||||
* Create a postgres12 database for the watcher:
|
||||
## Core services
|
||||
|
||||
```bash
|
||||
sudo su - postgres
|
||||
The following core services should be setup and running on localhost:
|
||||
|
||||
# If database already exists
|
||||
# dropdb erc20-watcher
|
||||
* `cerc-io/go-ethereum` [v1.10.26-statediff-4.2.2-alpha](https://github.com/cerc-io/go-ethereum/releases/tag/v1.10.26-statediff-4.2.2-alpha)
|
||||
on port 8545
|
||||
|
||||
createdb erc20-watcher
|
||||
```
|
||||
* `cerc-io/ipld-eth-server` [v4.2.2-alpha](https://github.com/cerc-io/ipld-eth-server/releases/tag/v4.2.2-alpha) with native GQL API enabled, on port 8082
|
||||
|
||||
Create a postgres12 database for the job queue:
|
||||
* `cerc-io/ipld-eth-db` [v4.2.2-alpha](https://github.com/cerc-io/ipld-eth-db/releases/tag/v4.2.2-alpha) is the postgres schema required for `ipld-eth-server`
|
||||
|
||||
## Setup Postgres
|
||||
|
||||
In this example, we use the `erc20-watcher`; for another watcher substitute with its name.
|
||||
|
||||
Create a postgres database for the watcher:
|
||||
|
||||
```bash
|
||||
sudo su - postgres
|
||||
createdb erc20-watcher
|
||||
```
|
||||
|
||||
Create a postgres 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:
|
||||
Enable the `pgcrypto` [extension](https://github.com/timgit/pg-boss/tree/master/docs#database-install) on the job queue database.
|
||||
|
||||
```
|
||||
postgres@tesla:~$ psql -U postgres -h localhost erc20-watcher-job-queue
|
||||
@ -42,15 +52,19 @@ CREATE EXTENSION
|
||||
erc20-watcher-job-queue=# exit
|
||||
```
|
||||
|
||||
Create a postgres12 database for the erc20 watcher:
|
||||
## Config File
|
||||
|
||||
```
|
||||
sudo su - postgres
|
||||
createdb erc20-watcher
|
||||
```
|
||||
In each watchers' directory is a config file: `packages/<watcher>/environments/local.toml`:
|
||||
|
||||
Update `environments/local.toml` with database connection settings for both the databases.
|
||||
* Update the database connection settings.
|
||||
* Update the `upstream` config and provide the `ipld-eth-server` GraphQL API endpoint.
|
||||
* Select "active" vs. "lazy" watcher depending on its kind.
|
||||
|
||||
For example:
|
||||
```toml
|
||||
[server]
|
||||
kind = "active"
|
||||
|
||||
[database]
|
||||
type = "postgres"
|
||||
host = "localhost"
|
||||
@ -61,96 +75,11 @@ Update `environments/local.toml` with database connection settings for both the
|
||||
|
||||
[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.
|
||||
```toml
|
||||
[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.
|
||||
```toml
|
||||
[server]
|
||||
kind = "active"
|
||||
```
|
||||
|
||||
|
||||
### ERC721
|
||||
|
||||
* Create a postgres12 database for the watcher:
|
||||
|
||||
```bash
|
||||
sudo su - postgres
|
||||
createdb erc721-watcher
|
||||
```
|
||||
|
||||
* If the watcher is an `active` watcher:
|
||||
|
||||
Create database for the job queue and enable the `pgcrypto` extension on them (https://github.com/timgit/pg-boss/blob/master/docs/usage.md#intro):
|
||||
|
||||
```
|
||||
createdb erc721-watcher-job-queue
|
||||
```
|
||||
|
||||
```
|
||||
postgres@tesla:~$ psql -U postgres -h localhost erc721-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.
|
||||
|
||||
erc721-watcher-job-queue=# CREATE EXTENSION pgcrypto;
|
||||
CREATE EXTENSION
|
||||
erc721-watcher-job-queue=# exit
|
||||
```
|
||||
|
||||
* The following core services should be setup and running on localhost:
|
||||
|
||||
* `vulcanize/go-ethereum` [v1.10.18-statediff-4.0.2-alpha](https://github.com/vulcanize/go-ethereum/releases/tag/v1.10.18-statediff-4.0.2-alpha) on port 8545
|
||||
|
||||
* `vulcanize/ipld-eth-server` [v4.0.3-alpha](https://github.com/vulcanize/ipld-eth-server/releases/tag/v4.0.3-alpha) with native GQL API enabled, on port 8082
|
||||
|
||||
* In the [config file](./environments/local.toml):
|
||||
|
||||
* Update the database connection settings.
|
||||
|
||||
* Update the `upstream` config and provide the `ipld-eth-server` GQL API endpoint.
|
||||
|
||||
* Update the `server` config with state checkpoint settings.
|
||||
|
||||
## mm watcher
|
||||
|
||||
* Create a postgres12 database for the watcher:
|
||||
|
||||
```bash
|
||||
sudo su - postgres
|
||||
createdb mobymask-watcher
|
||||
```
|
||||
|
||||
* If the watcher is an `active` watcher:
|
||||
|
||||
Create database for the job queue and enable the `pgcrypto` extension on them (https://github.com/timgit/pg-boss/blob/master/docs/usage.md#intro):
|
||||
|
||||
```
|
||||
createdb mobymask-watcher-job-queue
|
||||
```
|
||||
|
||||
```
|
||||
postgres@tesla:~$ psql -U postgres -h localhost mobymask-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.
|
||||
|
||||
mobymask-watcher-job-queue=# CREATE EXTENSION pgcrypto;
|
||||
CREATE EXTENSION
|
||||
mobymask-watcher-job-queue=# exit
|
||||
```
|
||||
|
||||
|
||||
## Watcher CLI commands (yarn)
|
||||
|
||||
spot to explain core commands and flags so they aren't repeated in every tutorial
|
||||
Now that your environment is setup, you can test run any watcher!
|
||||
|
3
docs/cli.md
Normal file
3
docs/cli.md
Normal file
@ -0,0 +1,3 @@
|
||||
## Watcher CLI commands (yarn)
|
||||
|
||||
spot to explain core commands and flags so they aren't repeated in every tutorial
|
@ -2,39 +2,7 @@
|
||||
|
||||
## Setup
|
||||
|
||||
Create a postgres12 database for the job queue:
|
||||
|
||||
```
|
||||
sudo su - postgres
|
||||
createdb address-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 address-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.
|
||||
|
||||
address-watcher-job-queue=# CREATE EXTENSION pgcrypto;
|
||||
CREATE EXTENSION
|
||||
address-watcher-job-queue=# exit
|
||||
```
|
||||
|
||||
Create a postgres12 database for the address watcher:
|
||||
|
||||
```
|
||||
sudo su - postgres
|
||||
createdb address-watcher
|
||||
```
|
||||
|
||||
Update `environments/local.toml` with database connection settings for both the databases.
|
||||
|
||||
Update the `upstream` config in `environments/local.toml` and provide the `ipld-eth-server` GQL API and the tracing API (`debug_traceTransaction` RPC provider) endpoints.
|
||||
First try the [stack orchestrator](https://github.com/cerc-io/stack-orchestrator) to quickly get started. Advanced users can see [here](/docs/README.md) for instructions on setting up a local environment by hand.
|
||||
|
||||
## Run
|
||||
|
||||
|
@ -2,46 +2,7 @@
|
||||
|
||||
## Setup
|
||||
|
||||
* Run the following command to install required packages:
|
||||
|
||||
```bash
|
||||
yarn
|
||||
```
|
||||
|
||||
* Create a postgres12 database for the watcher:
|
||||
|
||||
```bash
|
||||
sudo su - postgres
|
||||
createdb eden-watcher
|
||||
```
|
||||
|
||||
* If the watcher is an `active` watcher:
|
||||
|
||||
Create database for the job queue and enable the `pgcrypto` extension on them (https://github.com/timgit/pg-boss/blob/master/docs/usage.md#intro):
|
||||
|
||||
```
|
||||
createdb eden-watcher-job-queue
|
||||
```
|
||||
|
||||
```
|
||||
postgres@tesla:~$ psql -U postgres -h localhost eden-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.
|
||||
|
||||
eden-watcher-job-queue=# CREATE EXTENSION pgcrypto;
|
||||
CREATE EXTENSION
|
||||
eden-watcher-job-queue=# exit
|
||||
```
|
||||
|
||||
* In the [config file](./environments/local.toml):
|
||||
|
||||
* Update the database connection settings.
|
||||
|
||||
* Update the `upstream` config and provide the `ipld-eth-server` GQL API endpoint.
|
||||
|
||||
* Update the `server` config with state checkpoint settings.
|
||||
First try the [stack orchestrator](https://github.com/cerc-io/stack-orchestrator) to quickly get started. Advanced users can see [here](/docs/README.md) for instructions on setting up a local environment by hand.
|
||||
|
||||
## Customize
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# ERC20 Watcher
|
||||
|
||||
To setup the stack required to run this demo, either [use stack-orchestrator](https://github.com/cerc-io/stack-orchestrator) or [do it manually](../../docs/README.md).
|
||||
First try the [stack orchestrator](https://github.com/cerc-io/stack-orchestrator) to quickly get started. Advanced users can see [here](/docs/README.md) for instructions on setting up a local environment by hand.
|
||||
|
||||
## Build
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# erc721-watcher
|
||||
|
||||
To setup the stack required to run this demo, either [use stack-orchestrator](https://github.com/cerc-io/stack-orchestrator) or [do it manually](../../docs/README.md).
|
||||
First try the [stack orchestrator](https://github.com/cerc-io/stack-orchestrator) to quickly get started. Advanced users can see [here](/docs/README.md) for instructions on setting up a local environment by hand.
|
||||
|
||||
## Setup
|
||||
|
||||
|
@ -8,41 +8,6 @@
|
||||
yarn
|
||||
```
|
||||
|
||||
* Create a postgres12 database for the watcher:
|
||||
|
||||
```bash
|
||||
sudo su - postgres
|
||||
createdb graph-test-watcher
|
||||
```
|
||||
|
||||
* If the watcher is an `active` watcher:
|
||||
|
||||
Create database for the job queue and enable the `pgcrypto` extension on them (https://github.com/timgit/pg-boss/blob/master/docs/usage.md#intro):
|
||||
|
||||
```
|
||||
createdb graph-test-watcher-job-queue
|
||||
```
|
||||
|
||||
```
|
||||
postgres@tesla:~$ psql -U postgres -h localhost graph-test-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.
|
||||
|
||||
graph-test-watcher-job-queue=# CREATE EXTENSION pgcrypto;
|
||||
CREATE EXTENSION
|
||||
graph-test-watcher-job-queue=# exit
|
||||
```
|
||||
|
||||
* In the [config file](./environments/local.toml):
|
||||
|
||||
* Update the database connection settings.
|
||||
|
||||
* Update the `upstream` config and provide the `ipld-eth-server` GQL API endpoint.
|
||||
|
||||
* Update the `server` config with state checkpoint settings.
|
||||
|
||||
## Customize
|
||||
|
||||
* Indexing on an event:
|
||||
|
@ -1,6 +1,6 @@
|
||||
# MobyMask Watcher
|
||||
|
||||
To setup the stack required to run this demo, either [use stack-orchestrator](https://github.com/cerc-io/stack-orchestrator) or [do it manually](../../docs/README.md).
|
||||
First try the [stack orchestrator](https://github.com/cerc-io/stack-orchestrator) to quickly get started. Advanced users can see [here](/docs/README.md) for instructions on setting up a local environment by hand.
|
||||
|
||||
## Setup
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user