From f72b3550637b6235c68842b577c7f44e38c2312f Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Fri, 14 Jun 2024 14:02:45 +0530 Subject: [PATCH] Add config template for sushiswap watcher --- .../docker-compose-watcher-sushiswap.yml | 16 +-- .../watcher-config-template.toml | 110 ++++++++++++++++++ 2 files changed, 118 insertions(+), 8 deletions(-) create mode 100644 stacks/stack-orchestrator/config/watcher-sushiswap/watcher-config-template.toml diff --git a/stacks/stack-orchestrator/compose/docker-compose-watcher-sushiswap.yml b/stacks/stack-orchestrator/compose/docker-compose-watcher-sushiswap.yml index 79246f7..8d8b25b 100644 --- a/stacks/stack-orchestrator/compose/docker-compose-watcher-sushiswap.yml +++ b/stacks/stack-orchestrator/compose/docker-compose-watcher-sushiswap.yml @@ -30,13 +30,13 @@ services: environment: CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} CERC_ETH_RPC_ENDPOINTS: ${CERC_ETH_RPC_ENDPOINTS} - working_dir: /app/packages-watcher + working_dir: /app/packages/sushiswap-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 + - ../config/watcher-sushiswap/watcher-config-template.toml:/app/packages/sushiswap-watcher/environments/watcher-config-template.toml + - ../config/common/start-job-runner.sh:/app/packages/sushiswap-watcher/start-job-runner.sh ports: - - "9000:9000" + - "9000" healthcheck: test: ["CMD", "nc", "-vz", "127.0.0.1", "9000"] interval: 20s @@ -57,12 +57,12 @@ services: environment: CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} CERC_ETH_RPC_ENDPOINTS: ${CERC_ETH_RPC_ENDPOINTS} - working_dir: /app/packages-watcher + working_dir: /app/packages/sushiswap-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 + - ../config/watcher-sushiswap/watcher-config-template.toml:/app/packages/sushiswap-watcher/environments/watcher-config-template.toml + - ../config/common/start-server.sh:/app/packages/sushiswap-watcher/start-server.sh + - sushiswap_watcher_gql_logs_data:/app/packages/sushiswap-watcher/gql-logs ports: - "3008" - "9001" diff --git a/stacks/stack-orchestrator/config/watcher-sushiswap/watcher-config-template.toml b/stacks/stack-orchestrator/config/watcher-sushiswap/watcher-config-template.toml new file mode 100644 index 0000000..1bbfa7e --- /dev/null +++ b/stacks/stack-orchestrator/config/watcher-sushiswap/watcher-config-template.toml @@ -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