Skip to content

This repository executes tasks in a periodic sequence to precompute computationally intensive jobs within the scope of the explorer project

License

Notifications You must be signed in to change notification settings

cardano-foundation/cf-ledger-consumer-schedules

Explorer Scheduled Jobs

Tests Coverage Release Publish conventionalcommits FOSSA Status

This repository executes tasks in a periodic sequence to precompute computationally intensive jobs.

👉 Check the Explorer repository to understand how the microservices work together

How to run

Following prerequisites are required to run the application:

  • Java 17
  • Redis
  • Postgres (ledger-sync and explorer database)
  • Ledger-sync (Ledgersync + Aggregate app + Postgres)

An example docker-compose script is provided in the example-infra directory. (This script only sets up Redis and Postgres, for a ledger-sync setup, please refer to the ledger-sync repository)

This can be used right away with the provided .env.example and adjusted as needed.

To start the needed Infrastructure, run:

# Start Redis and Postgres
docker-compose -f example-infra/docker-compose.yml up
# Additionally start Ledger Sync according to the docs in the ledger-sync repository 

To run the application via command line:

# Copy the .env.example to .env and adjust as needed
cp .env.example .env
# Build the application
source .env
mvn clean package
mvn spring-boot:run

🧪 Test Reports

To ensure the stability and reliability of this project, unit and mutation tests have been implemented. By clicking on the links below, you can access the detailed test reports and review the outcomes of the tests performed.

📊 Mutation report

🌱 Environment Variables
  • LEDGER_SYNC_HOST: Ledger-sync database host.

  • LEDGER_SYNC_PORT: Ledger-sync database port

  • LEDGER_SYNC_USER: Ledger-sync database username

  • LEDGER_SYNC_PASSWORD: Ledger-sync database password

  • LEDGER_SYNC_DB: Ledger-sync database name

  • LEDGER_SYNC_SCHEMA: Ledger-sync database schema

  • LEDGER_SYNC_FLYWAY_ENABLE: Ledger-sync Migrate schema, set true if this is the first time run app

  • LEDGER_SYNC_AGG_HOST= Ledger-sync aggregate database host.

  • LEDGER_SYNC_AGG_PORT= Ledger-sync aggregate database port

  • LEDGER_SYNC_AGG_USER= Ledger-sync aggregate database username

  • LEDGER_SYNC_AGG_PASSWORD= Ledger-sync aggregate database password

  • LEDGER_SYNC_AGG_DB= Ledger-sync aggregate database name

  • LEDGER_SYNC_AGG_SCHEMA= Ledger-sync aggregate database schema

  • LEDGER_SYNC_AGG_FLYWAY_ENABLE= Ledger-sync aggregate Migrate schema, set true if this is the first time run app

  • EXPLORER_HOST: Explorer database host.

  • EXPLORER_PORT: Explorer database port

  • EXPLORER_USER: Explorer database username

  • EXPLORER_PASSWORD: Explorer database password

  • EXPLORER_DB: Explorer database name

  • EXPLORER_SCHEMA: Explorer database schema

  • EXPLORER_FLYWAY_ENABLE: Explorer Migrate schema, set true if this is the first time run app

  • MAXIMUM_POOL_SIZE: Schedule will have job select parallel from database. If you want to task schedule as fast as possible set the MAXIMUM_POOL_SIZE as much as possible (cpu core * 4). This will reduce another app performance.

  • REPORT_HISTORY_JOB_ENABLED: enable a report history job to delete expired file. Default true

  • SET_EXPIRED_REPORTS_DELAY: delay time between each report history job run. Default 86400000 as 1 day

  • LIMIT_CONTENT_PER_SHEET: limit content per sheet of export file, default 1000000

  • API_CHECK_REWARD_URL: api url to fetch reward

  • API_CHECK_POOL_HISTORY_URL: api url to fetch pool history

  • NETWORK_NAME: cardano node network name (preprod, testnet, mainnet)

  • REPORT_S3_ACCESS_KEY: report aws s3 access key

  • REPORT_S3_SECRET_KEY: report aws s3 secret key

  • REPORT_S3_REGION: report aws s3 region

  • REPORT_S3_BUCKET_NAME: report aws s3 bucket name

  • REPORT_S3_STORAGE_ENDPOINT: report aws s3 storage endpoint

  • TOKEN_LOGO_S3_ACCESS_KEY: token logo aws s3 access key

  • TOKEN_LOGO_S3_SECRET_KEY: token logo aws s3 secret key

  • TOKEN_LOGO_S3_REGION: token logo aws s3 region

  • TOKEN_LOGO_S3_BUCKET_NAME: token logo aws s3 bucket name

  • TOKEN_LOGO_S3_STORAGE_ENDPOINT: token logo aws s3 storage endpoint

  • SPRING_PROFILES_ACTIVE: active profiles

  • LOG: application log level

  • META_DATA_JOB_ENABLED: enable metadata job

  • TOKEN_METADATA_URL: url that store token

  • TOKEN_METADATA_FOLDER: store token

  • REDIS_SENTINEL_PASSWORD : Redis sentinel password. Default is redis_sentinel_pass.

  • REDIS_SENTINEL_HOST : Redis sentinel host. Default is cardano.redis.sentinel.

  • REDIS_SENTINEL_PORT : Redis sentinel port. Default is 26379.

  • REDIS_SENTINEL_MASTER_NAME : Redis master name. Default is mymaster.

  • POOL_STATUS_FIXED_DELAY: delay time between each time get pool status

  • NUMBER_DELEGATOR_FIXED_DELAY: delay time between each time get number delegator

  • UNIQUE_ACCOUNT_FIXED_DELAY: fixed delay for job build cache unique account

  • UNIQUE_ACCOUNT_ENABLED: enable unique account job

  • STAKE_TX_BALANCE_JOB_ENABLED: enable stake tx balance job

  • STAKE_TX_BALANCE_FIXED_DELAY: fixed delay for job stake tx balance

  • TOKEN_INFO_JOB_ENABLED: enable token info job

  • TOKEN_INFO_FIXED_DELAY: delay time between each time run token info job

  • AGGREGATE_POOL_INFO_FIXED_DELAY: fixed delay for job aggregate pool info

  • SMART_CONTRACT_INFO_FIXED_DELAY: fixed delay for job smart contract info

  • NATIVE_SCRIPT_INFO_FIXED_DELAY: fixed delay for job native script info

  • DREP_INFO_JOB_ENABLED: enable drep info job

  • DREP_INFO_FIXED_DELAY: fixed delay for job drep info

  • GOVERNANCE_INFO_JOB_ENABLED: enable governance info job

  • GOVERNANCE_INFO_FIXED_DELAY: fixed delay for job governance info

  • AGG_ANALYTIC_FIXED_DELAY: fixed delay for job aggregate analytic that related to address and token

About

This repository executes tasks in a periodic sequence to precompute computationally intensive jobs within the scope of the explorer project

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Languages