Compare commits

...

21 Commits

Author SHA1 Message Date
IshaVenikar
d570655cc5 Add config template for sushiswap watcher 2024-06-14 14:38:47 +05:30
IshaVenikar
b17608f6a4 Add compose file and stack instructions for sushiswap 2024-06-14 14:38:30 +05:30
IshaVenikar
beb14ab9c8 Add job runner and server scripts in common folder 2024-06-14 14:15:54 +05:30
IshaVenikar
117d67a135 Add v2 watcher stack instructions 2024-06-14 12:31:23 +05:30
IshaVenikar
053c46b086 Add config template and scripts for v3 watcher 2024-06-14 11:06:43 +05:30
IshaVenikar
8777ae778d Add docker compose file for v2 2024-06-14 11:00:59 +05:30
IshaVenikar
33af360b06 Fix mount paths for mounted files 2024-06-14 10:47:14 +05:30
IshaVenikar
bb64e99d51 Set working_dir to v3 watcher in compose file 2024-06-13 19:02:26 +05:30
IshaVenikar
eada17f594 Update mount paths for mounted files 2024-06-13 18:53:22 +05:30
IshaVenikar
b2a4b8b0fd Update port mapping and stack path in readme 2024-06-13 18:47:25 +05:30
IshaVenikar
dc9eba3d6a Update sushiswap watcher image name 2024-06-13 17:44:10 +05:30
IshaVenikar
02f5ec9c97 Make volume names consistent 2024-06-13 17:34:20 +05:30
IshaVenikar
8e4d8fa382 Update stack repo URL in instructions 2024-06-13 17:34:05 +05:30
IshaVenikar
30d4b311e1 Add v3 watcher stack instructions 2024-06-13 17:33:51 +05:30
IshaVenikar
27498c4d76 Add container build script 2024-06-13 17:33:35 +05:30
IshaVenikar
86454e4629 Modify config template for v3 watcher 2024-06-13 17:33:10 +05:30
IshaVenikar
973a9a4006 Use sushiswap prefix for stack components 2024-06-13 17:30:13 +05:30
IshaVenikar
076c0da300 Exclude stacks folder in docker image 2024-06-13 17:29:37 +05:30
IshaVenikar
9b10dc8980 Update stack name 2024-06-13 17:28:36 +05:30
IshaVenikar
e48e677d02 Add config template and scripts for v3 watcher 2024-06-13 17:27:03 +05:30
IshaVenikar
cb27e53853 Add docker compose file for v3 2024-06-13 13:55:12 +05:30
17 changed files with 977 additions and 0 deletions

View File

@ -0,0 +1,80 @@
version: '3.2'
services:
sushiswap-v2-watcher-db:
restart: unless-stopped
image: postgres:14-alpine
environment:
- POSTGRES_USER=vdbm
- POSTGRES_MULTIPLE_DATABASES=sushiswap-v2-watcher,sushiswap-v2-watcher-job-queue
- POSTGRES_EXTENSION=sushiswap-v2-watcher-job-queue:pgcrypto
- POSTGRES_PASSWORD=password
volumes:
- ../config/postgresql/multiple-postgressql-databases.sh:/docker-entrypoint-initdb.d/multiple-postgressql-databases.sh
- sushiswap_v2_watcher_db_data:/var/lib/postgresql/data
ports:
- "5432"
healthcheck:
test: ["CMD", "nc", "-v", "localhost", "5432"]
interval: 20s
timeout: 5s
retries: 15
start_period: 10s
sushiswap-v2-watcher-job-runner:
restart: unless-stopped
depends_on:
sushiswap-v2-watcher-db:
condition: service_healthy
image: cerc/watcher-sushiswap:local
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
CERC_ETH_RPC_ENDPOINTS: ${CERC_ETH_RPC_ENDPOINTS}
working_dir: /app/packages/v2-watcher
command: ["bash", "./start-job-runner.sh"]
volumes:
- ../config/watcher-sushiswap-v2/watcher-config-template.toml:/app/packages/v2-watcher/environments/watcher-config-template.toml
- ../config/common/start-job-runner.sh:/app/packages/v2-watcher/start-job-runner.sh
ports:
- "9000"
healthcheck:
test: ["CMD", "nc", "-vz", "127.0.0.1", "9000"]
interval: 20s
timeout: 5s
retries: 15
start_period: 5s
extra_hosts:
- "host.docker.internal:host-gateway"
sushiswap-v2-watcher-server:
restart: unless-stopped
depends_on:
sushiswap-v2-watcher-db:
condition: service_healthy
sushiswap-v2-watcher-job-runner:
condition: service_healthy
image: cerc/watcher-sushiswap:local
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
CERC_ETH_RPC_ENDPOINTS: ${CERC_ETH_RPC_ENDPOINTS}
working_dir: /app/packages/v2-watcher
command: ["bash", "./start-server.sh"]
volumes:
- ../config/watcher-sushiswap-v2/watcher-config-template.toml:/app/packages/v2-watcher/environments/watcher-config-template.toml
- ../config/common/start-server.sh:/app/packages/v2-watcher/start-server.sh
- sushiswap_v2_watcher_gql_logs_data:/app/packages/v2-watcher/gql-logs
ports:
- "3008"
- "9001"
healthcheck:
test: ["CMD", "nc", "-vz", "127.0.0.1", "3008"]
interval: 20s
timeout: 5s
retries: 15
start_period: 5s
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
sushiswap_v2_watcher_db_data:
sushiswap_v2_watcher_gql_logs_data:

View File

@ -0,0 +1,80 @@
version: '3.2'
services:
sushiswap-v3-watcher-db:
restart: unless-stopped
image: postgres:14-alpine
environment:
- POSTGRES_USER=vdbm
- POSTGRES_MULTIPLE_DATABASES=sushiswap-v3-watcher,sushiswap-v3-watcher-job-queue
- POSTGRES_EXTENSION=sushiswap-v3-watcher-job-queue:pgcrypto
- POSTGRES_PASSWORD=password
volumes:
- ../config/postgresql/multiple-postgressql-databases.sh:/docker-entrypoint-initdb.d/multiple-postgressql-databases.sh
- sushiswap_v3_watcher_db_data:/var/lib/postgresql/data
ports:
- "5432"
healthcheck:
test: ["CMD", "nc", "-v", "localhost", "5432"]
interval: 20s
timeout: 5s
retries: 15
start_period: 10s
sushiswap-v3-watcher-job-runner:
restart: unless-stopped
depends_on:
sushiswap-v3-watcher-db:
condition: service_healthy
image: cerc/watcher-sushiswap:local
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
CERC_ETH_RPC_ENDPOINTS: ${CERC_ETH_RPC_ENDPOINTS}
working_dir: /app/packages/v3-watcher
command: ["bash", "./start-job-runner.sh"]
volumes:
- ../config/watcher-sushiswap-v3/watcher-config-template.toml:/app/packages/v3-watcher/environments/watcher-config-template.toml
- ../config/common/start-job-runner.sh:/app/packages/v3-watcher/start-job-runner.sh
ports:
- "9000"
healthcheck:
test: ["CMD", "nc", "-vz", "127.0.0.1", "9000"]
interval: 20s
timeout: 5s
retries: 15
start_period: 5s
extra_hosts:
- "host.docker.internal:host-gateway"
sushiswap-v3-watcher-server:
restart: unless-stopped
depends_on:
sushiswap-v3-watcher-db:
condition: service_healthy
sushiswap-v3-watcher-job-runner:
condition: service_healthy
image: cerc/watcher-sushiswap:local
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
CERC_ETH_RPC_ENDPOINTS: ${CERC_ETH_RPC_ENDPOINTS}
working_dir: /app/packages/v3-watcher
command: ["bash", "./start-server.sh"]
volumes:
- ../config/watcher-sushiswap-v3/watcher-config-template.toml:/app/packages/v3-watcher/environments/watcher-config-template.toml
- ../config/common/start-server.sh:/app/packages/v3-watcher/start-server.sh
- sushiswap_v3_watcher_gql_logs_data:/app/packages/v3-watcher/gql-logs
ports:
- "3008"
- "9001"
healthcheck:
test: ["CMD", "nc", "-vz", "127.0.0.1", "3008"]
interval: 20s
timeout: 5s
retries: 15
start_period: 5s
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
sushiswap_v3_watcher_db_data:
sushiswap_v3_watcher_gql_logs_data:

View File

@ -0,0 +1,80 @@
version: '3.2'
services:
sushiswap-watcher-db:
restart: unless-stopped
image: postgres:14-alpine
environment:
- POSTGRES_USER=vdbm
- POSTGRES_MULTIPLE_DATABASES=sushiswap-watcher,sushiswap-watcher-job-queue
- POSTGRES_EXTENSION=sushiswap-watcher-job-queue:pgcrypto
- POSTGRES_PASSWORD=password
volumes:
- ../config/postgresql/multiple-postgressql-databases.sh:/docker-entrypoint-initdb.d/multiple-postgressql-databases.sh
- sushiswap_watcher_db_data:/var/lib/postgresql/data
ports:
- "5432"
healthcheck:
test: ["CMD", "nc", "-v", "localhost", "5432"]
interval: 20s
timeout: 5s
retries: 15
start_period: 10s
sushiswap-watcher-job-runner:
restart: unless-stopped
depends_on:
sushiswap-watcher-db:
condition: service_healthy
image: cerc/watcher-sushiswap:local
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
CERC_ETH_RPC_ENDPOINTS: ${CERC_ETH_RPC_ENDPOINTS}
working_dir: /app/packages-watcher
command: ["bash", "./start-job-runner.sh"]
volumes:
- ../config/watcher-sushiswap/watcher-config-template.toml:/app/packages-watcher/environments/watcher-config-template.toml
- ../config/common/start-job-runner.sh:/app/packages-watcher/start-job-runner.sh
ports:
- "9000:9000"
healthcheck:
test: ["CMD", "nc", "-vz", "127.0.0.1", "9000"]
interval: 20s
timeout: 5s
retries: 15
start_period: 5s
extra_hosts:
- "host.docker.internal:host-gateway"
sushiswap-watcher-server:
restart: unless-stopped
depends_on:
sushiswap-watcher-db:
condition: service_healthy
sushiswap-watcher-job-runner:
condition: service_healthy
image: cerc/watcher-sushiswap:local
environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
CERC_ETH_RPC_ENDPOINTS: ${CERC_ETH_RPC_ENDPOINTS}
working_dir: /app/packages-watcher
command: ["bash", "./start-server.sh"]
volumes:
- ../config/watcher-sushiswap/watcher-config-template.toml:/app/packages-watcher/environments/watcher-config-template.toml
- ../config/common/start-server.sh:/app/packages-watcher/start-server.sh
- sushiswap_watcher_gql_logs_data:/app/packages-watcher/gql-logs
ports:
- "3008"
- "9001"
healthcheck:
test: ["CMD", "nc", "-vz", "127.0.0.1", "3008"]
interval: 20s
timeout: 5s
retries: 15
start_period: 5s
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
sushiswap_watcher_db_data:
sushiswap_watcher_gql_logs_data:

View File

@ -0,0 +1,24 @@
#!/bin/sh
set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
set -u
echo "Using ETH RPC endpoints ${CERC_ETH_RPC_ENDPOINTS}"
# Read in the config template TOML file and modify it
WATCHER_CONFIG_TEMPLATE=$(cat environments/watcher-config-template.toml)
# Convert the comma-separated list in CERC_ETH_RPC_ENDPOINTS to a JSON array
RPC_ENDPOINTS_ARRAY=$(echo "$CERC_ETH_RPC_ENDPOINTS" | tr ',' '\n' | awk '{print "\"" $0 "\""}' | paste -sd, - | sed 's/^/[/; s/$/]/')
WATCHER_CONFIG=$(echo "$WATCHER_CONFIG_TEMPLATE" | \
sed -E "s|REPLACE_WITH_CERC_ETH_RPC_ENDPOINTS|${RPC_ENDPOINTS_ARRAY}| ")
# Write the modified content to a new file
echo "$WATCHER_CONFIG" > environments/local.toml
echo "Running job-runner..."
DEBUG=vulcanize:* exec node --enable-source-maps dist/job-runner.js

View File

@ -0,0 +1,24 @@
#!/bin/sh
set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
set -u
echo "Using ETH RPC endpoints ${CERC_ETH_RPC_ENDPOINTS}"
# Read in the config template TOML file and modify it
WATCHER_CONFIG_TEMPLATE=$(cat environments/watcher-config-template.toml)
# Convert the comma-separated list in CERC_ETH_RPC_ENDPOINTS to a JSON array
RPC_ENDPOINTS_ARRAY=$(echo "$CERC_ETH_RPC_ENDPOINTS" | tr ',' '\n' | awk '{print "\"" $0 "\""}' | paste -sd, - | sed 's/^/[/; s/$/]/')
WATCHER_CONFIG=$(echo "$WATCHER_CONFIG_TEMPLATE" | \
sed -E "s|REPLACE_WITH_CERC_ETH_RPC_ENDPOINTS|${RPC_ENDPOINTS_ARRAY}| ")
# Write the modified content to a new file
echo "$WATCHER_CONFIG" > environments/local.toml
echo "Running server..."
DEBUG=vulcanize:* exec node --enable-source-maps dist/server.js

View File

@ -0,0 +1,110 @@
[server]
host = "0.0.0.0"
port = 3008
kind = "active"
# Checkpointing state.
checkpointing = true
# Checkpoint interval in number of blocks.
checkpointInterval = 2000
# Enable state creation
# CAUTION: Disable only if state creation is not desired or can be filled subsequently
enableState = false
subgraphPath = "./subgraph-build"
# Interval to restart wasm instance periodically
wasmRestartBlocksInterval = 20
# Interval in number of blocks at which to clear entities cache.
clearEntitiesCacheInterval = 1000
# Flag to specify whether RPC endpoint supports block hash as block tag parameter
rpcSupportsBlockHashParam = false
# Server GQL config
[server.gql]
path = "/graphql"
# Max block range for which to return events in eventsInRange GQL query.
# Use -1 for skipping check on block range.
maxEventsBlockRange = 1000
# Log directory for GQL requests
logDir = "./gql-logs"
# GQL cache settings
[server.gql.cache]
enabled = true
# Max in-memory cache size (in bytes) (default 8 MB)
# maxCacheSize
# GQL cache-control max-age settings (in seconds)
maxAge = 15
timeTravelMaxAge = 86400 # 1 day
[metrics]
host = "0.0.0.0"
port = 9000
[metrics.gql]
port = 9001
[database]
type = "postgres"
host = "sushiswap-v2-watcher-db"
port = 5432
database = "sushiswap-v2-watcher"
username = "vdbm"
password = "password"
synchronize = true
logging = false
[upstream]
[upstream.ethServer]
rpcProviderEndpoints = REPLACE_WITH_CERC_ETH_RPC_ENDPOINTS
# Boolean flag to specify if rpc-eth-client should be used for RPC endpoint instead of ipld-eth-client (ipld-eth-server GQL client)
rpcClient = true
# Boolean flag to specify if rpcProviderEndpoint is an FEVM RPC endpoint
isFEVM = true
# Boolean flag to filter event logs by contracts
filterLogsByAddresses = true
# Boolean flag to filter event logs by topics
filterLogsByTopics = true
[upstream.cache]
name = "requests"
enabled = false
deleteOnStart = false
[jobQueue]
dbConnectionString = "postgres://vdbm:password@sushiswap-v2-watcher-db/sushiswap-v2-watcher-job-queue"
maxCompletionLagInSecs = 300
jobDelayInMilliSecs = 100
eventsInBatch = 50
subgraphEventsOrder = true
# Filecoin block time: https://docs.filecoin.io/basics/the-blockchain/blocks-and-tipsets#blocktime
blockDelayInMilliSecs = 30000
# Number of blocks by which block processing lags behind head
blockProcessingOffset = 0
# Boolean to switch between modes of processing events when starting the server.
# Setting to true will fetch filtered events and required blocks in a range of blocks and then process them.
# Setting to false will fetch blocks consecutively with its events and then process them (Behaviour is followed in realtime processing near head).
useBlockRanges = true
# Block range in which logs are fetched during historical blocks processing
historicalLogsBlockRange = 2000
# Max block range of historical processing after which it waits for completion of events processing
# If set to -1 historical processing does not wait for events processing and completes till latest canonical block
historicalMaxFetchAhead = 10000
# Max number of retries to fetch new block after which watcher will failover to other RPC endpoints
maxNewBlockRetries = 3

View File

@ -0,0 +1,110 @@
[server]
host = "0.0.0.0"
port = 3008
kind = "active"
# Checkpointing state.
checkpointing = true
# Checkpoint interval in number of blocks.
checkpointInterval = 2000
# Enable state creation
# CAUTION: Disable only if state creation is not desired or can be filled subsequently
enableState = false
subgraphPath = "./subgraph-build"
# Interval to restart wasm instance periodically
wasmRestartBlocksInterval = 20
# Interval in number of blocks at which to clear entities cache.
clearEntitiesCacheInterval = 1000
# Flag to specify whether RPC endpoint supports block hash as block tag parameter
rpcSupportsBlockHashParam = false
# Server GQL config
[server.gql]
path = "/graphql"
# Max block range for which to return events in eventsInRange GQL query.
# Use -1 for skipping check on block range.
maxEventsBlockRange = 1000
# Log directory for GQL requests
logDir = "./gql-logs"
# GQL cache settings
[server.gql.cache]
enabled = true
# Max in-memory cache size (in bytes) (default 8 MB)
# maxCacheSize
# GQL cache-control max-age settings (in seconds)
maxAge = 15
timeTravelMaxAge = 86400 # 1 day
[metrics]
host = "0.0.0.0"
port = 9000
[metrics.gql]
port = 9001
[database]
type = "postgres"
host = "sushiswap-v3-watcher-db"
port = 5432
database = "sushiswap-v3-watcher"
username = "vdbm"
password = "password"
synchronize = true
logging = false
[upstream]
[upstream.ethServer]
rpcProviderEndpoints = REPLACE_WITH_CERC_ETH_RPC_ENDPOINTS
# Boolean flag to specify if rpc-eth-client should be used for RPC endpoint instead of ipld-eth-client (ipld-eth-server GQL client)
rpcClient = true
# Boolean flag to specify if rpcProviderEndpoint is an FEVM RPC endpoint
isFEVM = true
# Boolean flag to filter event logs by contracts
filterLogsByAddresses = true
# Boolean flag to filter event logs by topics
filterLogsByTopics = true
[upstream.cache]
name = "requests"
enabled = false
deleteOnStart = false
[jobQueue]
dbConnectionString = "postgres://vdbm:password@sushiswap-v3-watcher-db/sushiswap-v3-watcher-job-queue"
maxCompletionLagInSecs = 300
jobDelayInMilliSecs = 100
eventsInBatch = 50
subgraphEventsOrder = true
# Filecoin block time: https://docs.filecoin.io/basics/the-blockchain/blocks-and-tipsets#blocktime
blockDelayInMilliSecs = 30000
# Number of blocks by which block processing lags behind head
blockProcessingOffset = 0
# Boolean to switch between modes of processing events when starting the server.
# Setting to true will fetch filtered events and required blocks in a range of blocks and then process them.
# Setting to false will fetch blocks consecutively with its events and then process them (Behaviour is followed in realtime processing near head).
useBlockRanges = true
# Block range in which logs are fetched during historical blocks processing
historicalLogsBlockRange = 2000
# Max block range of historical processing after which it waits for completion of events processing
# If set to -1 historical processing does not wait for events processing and completes till latest canonical block
historicalMaxFetchAhead = 10000
# Max number of retries to fetch new block after which watcher will failover to other RPC endpoints
maxNewBlockRetries = 3

View File

@ -0,0 +1,110 @@
[server]
host = "0.0.0.0"
port = 3008
kind = "active"
# Checkpointing state.
checkpointing = true
# Checkpoint interval in number of blocks.
checkpointInterval = 2000
# Enable state creation
# CAUTION: Disable only if state creation is not desired or can be filled subsequently
enableState = false
subgraphPath = "./subgraph-build"
# Interval to restart wasm instance periodically
wasmRestartBlocksInterval = 20
# Interval in number of blocks at which to clear entities cache.
clearEntitiesCacheInterval = 1000
# Flag to specify whether RPC endpoint supports block hash as block tag parameter
rpcSupportsBlockHashParam = false
# Server GQL config
[server.gql]
path = "/graphql"
# Max block range for which to return events in eventsInRange GQL query.
# Use -1 for skipping check on block range.
maxEventsBlockRange = 1000
# Log directory for GQL requests
logDir = "./gql-logs"
# GQL cache settings
[server.gql.cache]
enabled = true
# Max in-memory cache size (in bytes) (default 8 MB)
# maxCacheSize
# GQL cache-control max-age settings (in seconds)
maxAge = 15
timeTravelMaxAge = 86400 # 1 day
[metrics]
host = "0.0.0.0"
port = 9000
[metrics.gql]
port = 9001
[database]
type = "postgres"
host = "sushiswap-watcher-db"
port = 5432
database = "sushiswap-watcher"
username = "vdbm"
password = "password"
synchronize = true
logging = false
[upstream]
[upstream.ethServer]
rpcProviderEndpoints = REPLACE_WITH_CERC_ETH_RPC_ENDPOINTS
# Boolean flag to specify if rpc-eth-client should be used for RPC endpoint instead of ipld-eth-client (ipld-eth-server GQL client)
rpcClient = true
# Boolean flag to specify if rpcProviderEndpoint is an FEVM RPC endpoint
isFEVM = true
# Boolean flag to filter event logs by contracts
filterLogsByAddresses = true
# Boolean flag to filter event logs by topics
filterLogsByTopics = true
[upstream.cache]
name = "requests"
enabled = false
deleteOnStart = false
[jobQueue]
dbConnectionString = "postgres://vdbm:password@sushiswap-watcher-db/sushiswap-watcher-job-queue"
maxCompletionLagInSecs = 300
jobDelayInMilliSecs = 100
eventsInBatch = 50
subgraphEventsOrder = true
# Filecoin block time: https://docs.filecoin.io/basics/the-blockchain/blocks-and-tipsets#blocktime
blockDelayInMilliSecs = 30000
# Number of blocks by which block processing lags behind head
blockProcessingOffset = 0
# Boolean to switch between modes of processing events when starting the server.
# Setting to true will fetch filtered events and required blocks in a range of blocks and then process them.
# Setting to false will fetch blocks consecutively with its events and then process them (Behaviour is followed in realtime processing near head).
useBlockRanges = true
# Block range in which logs are fetched during historical blocks processing
historicalLogsBlockRange = 2000
# Max block range of historical processing after which it waits for completion of events processing
# If set to -1 historical processing does not wait for events processing and completes till latest canonical block
historicalMaxFetchAhead = 10000
# Max number of retries to fetch new block after which watcher will failover to other RPC endpoints
maxNewBlockRetries = 3

View File

@ -0,0 +1,15 @@
FROM node:18.17.1-alpine3.18
RUN apk --update --no-cache add git python3 alpine-sdk bash curl jq
WORKDIR /app
COPY . .
# Get the latest Git commit hash and set in package.json
RUN COMMIT_HASH=$(git rev-parse HEAD) && \
jq --arg commitHash "$COMMIT_HASH" '.commitHash = $commitHash' package.json > tmp.json && \
mv tmp.json package.json
RUN echo "Installing dependencies and building sushiswap-watcher-ts" && \
yarn && yarn build

View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
# Build cerc/watcher-sushiswap
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
docker build -t cerc/watcher-sushiswap:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/sushiswap-watcher-ts

View File

@ -0,0 +1,104 @@
# SushiSwap v2 Watcher
## Clone the stack repo
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/sushiswap-watcher-ts
```
## Build the container image
```bash
laconic-so --stack ~/cerc/sushiswap-watcher-ts/stacks/stack-orchestrator/stacks/sushiswap-v2 build-containers
```
## Create a spec file for the deployment
```bash
laconic-so --stack ~/cerc/sushiswap-watcher-ts/stacks/stack-orchestrator/stacks/sushiswap-v2 deploy init --output sushiswap-v2-spec.yml
```
### Ports
Edit `network` in the spec file to map container ports to host ports as required:
```yml
...
network:
ports:
sushiswap-v2-watcher-db:
- 15432:5432
sushiswap-v2-watcher-job-runner:
- 9000:9000
sushiswap-v2-watcher-server:
- 3008:3008
- 9001:9001
```
## Create a deployment from the spec file
```bash
laconic-so --stack ~/cerc/sushiswap-watcher-ts/stacks/stack-orchestrator/stacks/sushiswap-v2 deploy create --spec-file sushiswap-v2-spec.yml --deployment-dir sushiswap-v2-deployment
```
### Configuration
Inside deployment directory, open the `config.env` file and set following env variables:
```bash
# External Filecoin (ETH RPC) endpoint to point the watcher to
CERC_ETH_RPC_ENDPOINTS=https://example-lotus-endpoint-1/rpc/v1,https://example-lotus-endpoint-2/rpc/v1
```
## Start the deployment
```bash
laconic-so deployment --dir sushiswap-v2-deployment start
```
* To list down and monitor the running containers:
```bash
# With status
docker ps -a
# Check logs for a container
docker logs -f <CONTAINER_ID>
```
* Open the GQL playground at <http://localhost:3008/graphql>
```graphql
# Example query
query {
_meta {
block {
hash
number
timestamp
}
deployment
hasIndexingErrors
}
```
## Clean up
Stop all the sushiswap-v2 services running in background:
```bash
# Only stop the docker containers
laconic-so deployment --dir sushiswap-v2-deployment stop
# Run 'start' to restart the deployment
```
To stop all the sushiswap-v2 services and also delete data:
```bash
# Stop the docker containers
laconic-so deployment --dir sushiswap-v2-deployment stop --delete-volumes
# Remove deployment directory (deployment will have to be recreated for a re-run)
rm -r sushiswap-v2-deployment
```

View File

@ -0,0 +1,8 @@
version: "1.0"
name: sushiswap-v2
description: "SushiSwap v2 watcher stack"
repos:
containers:
- cerc/watcher-sushiswap
pods:
- watcher-sushiswap-v2

View File

@ -0,0 +1,104 @@
# SushiSwap v3 Watcher
## Clone the stack repo
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/sushiswap-watcher-ts
```
## Build the container image
```bash
laconic-so --stack ~/cerc/sushiswap-watcher-ts/stacks/stack-orchestrator/stacks/sushiswap-v3 build-containers
```
## Create a spec file for the deployment
```bash
laconic-so --stack ~/cerc/sushiswap-watcher-ts/stacks/stack-orchestrator/stacks/sushiswap-v3 deploy init --output sushiswap-v3-spec.yml
```
### Ports
Edit `network` in the spec file to map container ports to host ports as required:
```yml
...
network:
ports:
sushiswap-v3-watcher-db:
- 15432:5432
sushiswap-v3-watcher-job-runner:
- 9000:9000
sushiswap-v3-watcher-server:
- 3008:3008
- 9001:9001
```
## Create a deployment from the spec file
```bash
laconic-so --stack ~/cerc/sushiswap-watcher-ts/stacks/stack-orchestrator/stacks/sushiswap-v3 deploy create --spec-file sushiswap-v3-spec.yml --deployment-dir sushiswap-v3-deployment
```
### Configuration
Inside deployment directory, open the `config.env` file and set following env variables:
```bash
# External Filecoin (ETH RPC) endpoint to point the watcher to
CERC_ETH_RPC_ENDPOINTS=https://example-lotus-endpoint-1/rpc/v1,https://example-lotus-endpoint-2/rpc/v1
```
## Start the deployment
```bash
laconic-so deployment --dir sushiswap-v3-deployment start
```
* To list down and monitor the running containers:
```bash
# With status
docker ps -a
# Check logs for a container
docker logs -f <CONTAINER_ID>
```
* Open the GQL playground at <http://localhost:3008/graphql>
```graphql
# Example query
query {
_meta {
block {
hash
number
timestamp
}
deployment
hasIndexingErrors
}
```
## Clean up
Stop all the sushiswap-v3 services running in background:
```bash
# Only stop the docker containers
laconic-so deployment --dir sushiswap-v3-deployment stop
# Run 'start' to restart the deployment
```
To stop all the sushiswap-v3 services and also delete data:
```bash
# Stop the docker containers
laconic-so deployment --dir sushiswap-v3-deployment stop --delete-volumes
# Remove deployment directory (deployment will have to be recreated for a re-run)
rm -r sushiswap-v3-deployment
```

View File

@ -0,0 +1,8 @@
version: "1.0"
name: sushiswap-v3
description: "SushiSwap v3 watcher stack"
repos:
containers:
- cerc/watcher-sushiswap
pods:
- watcher-sushiswap-v3

View File

@ -0,0 +1,104 @@
# SushiSwap Watcher
## Clone the stack repo
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/sushiswap-watcher-ts
```
## Build the container image
```bash
laconic-so --stack ~/cerc/sushiswap-watcher-ts/stacks/stack-orchestrator/stacks/sushiswap build-containers
```
## Create a spec file for the deployment
```bash
laconic-so --stack ~/cerc/sushiswap-watcher-ts/stacks/stack-orchestrator/stacks/sushiswap deploy init --output sushiswap-spec.yml
```
### Ports
Edit `network` in the spec file to map container ports to host ports as required:
```yml
...
network:
ports:
sushiswap-watcher-db:
- 15432:5432
sushiswap-watcher-job-runner:
- 9000:9000
sushiswap-watcher-server:
- 3008:3008
- 9001:9001
```
## Create a deployment from the spec file
```bash
laconic-so --stack ~/cerc/sushiswap-watcher-ts/stacks/stack-orchestrator/stacks/sushiswap deploy create --spec-file sushiswap-spec.yml --deployment-dir sushiswap-deployment
```
### Configuration
Inside deployment directory, open the `config.env` file and set following env variables:
```bash
# External Filecoin (ETH RPC) endpoint to point the watcher to
CERC_ETH_RPC_ENDPOINTS=https://example-lotus-endpoint-1/rpc/v1,https://example-lotus-endpoint-2/rpc/v1
```
## Start the deployment
```bash
laconic-so deployment --dir sushiswap-deployment start
```
* To list down and monitor the running containers:
```bash
# With status
docker ps -a
# Check logs for a container
docker logs -f <CONTAINER_ID>
```
* Open the GQL playground at <http://localhost:3008/graphql>
```graphql
# Example query
query {
_meta {
block {
hash
number
timestamp
}
deployment
hasIndexingErrors
}
```
## Clean up
Stop all the sushiswap services running in background:
```bash
# Only stop the docker containers
laconic-so deployment --dir sushiswap-deployment stop
# Run 'start' to restart the deployment
```
To stop all the sushiswap services and also delete data:
```bash
# Stop the docker containers
laconic-so deployment --dir sushiswap-deployment stop --delete-volumes
# Remove deployment directory (deployment will have to be recreated for a re-run)
rm -r sushiswap-deployment
```

View File

@ -0,0 +1,8 @@
version: "1.0"
name: sushiswap
description: "SushiSwap watcher stack"
repos:
containers:
- cerc/watcher-sushiswap
pods:
- watcher-sushiswap