Klayr Service Configuration Reference
On the Introduction to Klayr Service page, we have discussed the various microservices that combine to form Klayr Service. On this page, we will thoroughly discuss the configuration options available for each service.
Default configurations
By default, a Klayr Service installation will have an ecosystem.config.js
file with all the default configurations that could be used to run and manage the various microservices with pm2.
The actual ecosystem.config.js file for Klayr Service can be found in the klayr-service GitHub repository.
|
The values of various environment variables are automatically picked by the microservices based on the installation environment. Aside from that, many environment variables can be configured to meet the specific requirements, the details of which have been outlined with each microservice.
Microservice configurations
In this section, we discuss the common and specific configurations of all the microservices of Klayr Service.
Common configurations
The common configurations described in this section apply to all the microservices within Klayr Service.
Environment variable | Datatype | Description | Sample |
---|---|---|---|
|
string |
URL of the microservice message broker. Must be identical for all the microservices. Make sure that all microservices can connect with the message broker. This could be a NATS or a Redis instance. |
|
|
number |
Inter-microservice request timeout in seconds. |
|
|
string |
Set the application logging level; Available options are |
|
|
boolean |
Enable posting logs to the standard output stream.
Accepted values are |
|
|
boolean |
Enable posting logs to the JavaScript |
|
|
string |
File path to capture the logs. |
|
|
string |
Enable log output in GELF for remote logging.
For example, Graylog: |
|
|
string |
Used by the Docker CLI to determine the host to connect to. |
|
Sample Configurations
module.exports = {
apps: [
// Configuration for other microservices.
{
name: 'klayr-service-gateway',
// [...]
env: {
// --- Remember to set the properties below
SERVICE_BROKER: 'redis://klayr:[email protected]:6379/0',
SERVICE_LOG_LEVEL: 'info',
// SERVICE_BROKER_TIMEOUT: 10,
// SERVICE_LOG_CONSOLE: 'false',
// SERVICE_LOG_STDOUT: 'true',
// SERVICE_LOG_GELF: 'false',
// SERVICE_LOG_FILE: 'false',
// [...]
},
},
{
name: 'klayr-service-transaction-statistics',
// [...]
env: {
// --- Remember to set the properties below
SERVICE_BROKER: 'redis://klayr:[email protected]:6379/0',
SERVICE_LOG_LEVEL: 'info',
// SERVICE_BROKER_TIMEOUT: 10,
// SERVICE_LOG_CONSOLE: 'false',
// SERVICE_LOG_STDOUT: 'true',
// SERVICE_LOG_GELF: 'false',
// SERVICE_LOG_FILE: 'false',
// [...]
},
},
// Configuration for other microservices.
],
};
Gateway
Environment variable | Datatype | Description | Sample |
---|---|---|---|
|
number |
Port that provides the possibility to connect with Klayr Service. |
|
|
string |
URL of the host. |
|
|
string |
URL of the microservice message broker (NATS or Redis). |
|
|
boolean |
Ensures that JSON-RPC accepts a valid JSON-RPC 2.0 envelope. |
|
|
string |
Enables particular HTTP API endpoints.
Directories (under |
|
|
string |
Enables specified WebSocket API namespaces. Must be listed as comma-separated values. |
|
|
string |
URL of the volatile cache storage (Redis).
Used to cache RPC requests.
Required when |
|
|
string |
Describes the microservices on which the |
|
|
boolean |
Boolean flag to enforce the |
|
|
number |
Defines the number of microseconds the gateway will wait before closing an idle connection.
To enable, ensure |
|
|
number |
Defines the maximum number of microseconds for the gateway to send HTTP response headers after the client’s request.
To enable, ensure |
|
|
boolean |
To enable the WebSocket rate limit, this environment variable is required to be |
|
|
number |
Once the rate limit is enabled, this variable contains the number of connections per second. |
|
|
number |
Defines the duration (in seconds) for which the WS rate should be limited. |
|
|
boolean |
To enable RPC response caching, this environment variable is required to be |
|
|
boolean |
To enable the HTTP rate limit, this environment variable is required to be |
|
|
number |
Defines the maximum number of HTTP requests during a period. Defaults to 200 requests per window. |
|
|
number |
Defines the time for which a record of requests should be kept in the memory (in seconds). The default duration of a window is 10 seconds. |
|
|
boolean |
To enable response caching, this environment variable is required to be |
|
|
string |
The |
|
|
string |
Allows request from the comma-separated string of origins.
By default, it is set to |
|
|
boolean |
When set to true, the rate-limiting algorithm considers the |
|
|
number |
Defines the number of proxies that exist between the gateway and the external client application, enabling accurate identification of the client’s IP address for rate-limiting.
Requires |
|
|
number |
Job run interval to update the readiness status.
By default, it is set to |
|
|
string |
Job run cron schedule to update the readiness status.
By default, it is set to run |
|
Sample Configurations
module.exports = {
apps: [
// Configuration for other microservices.
{
name: "klayr-service-gateway",
// [...]
env: {
PORT: 9901,
// --- Remember to set the properties below
SERVICE_BROKER: 'redis://klayr:[email protected]:6379/0',
SERVICE_GATEWAY_REDIS_VOLATILE: 'redis://klayr:[email protected]:6379/5',
ENABLE_HTTP_API: 'http-status,http-version3,http-exports',
ENABLE_WS_API: 'blockchain,rpc-v3',
GATEWAY_DEPENDENCIES: 'indexer,connector',
WS_RATE_LIMIT_ENABLE: false,
WS_RATE_LIMIT_CONNECTIONS: 5,
WS_RATE_LIMIT_DURATION: 1, // in seconds
ENABLE_REQUEST_CACHING: true,
JSON_RPC_STRICT_MODE: false,
HTTP_RATE_LIMIT_ENABLE: false,
HTTP_RATE_LIMIT_CONNECTIONS: 200,
HTTP_RATE_LIMIT_WINDOW: 10, // in seconds
HTTP_CACHE_CONTROL_DIRECTIVES: 'public, max-age=10',
ENABLE_HTTP_CACHE_CONTROL: true,
HTTP_RATE_LIMIT_ENABLE_X_FORWARDED_FOR: false,
HTTP_RATE_LIMIT_NUM_KNOWN_PROXIES: 0,
// ENABLE_REVERSE_PROXY_TIMEOUT_SETTINGS: true
// HTTP_KEEP_ALIVE_TIMEOUT: 65000,
// HTTP_HEADERS_TIMEOUT: 66000,
// CORS_ALLOWED_ORIGIN: '*',
// SERVICE_BROKER_TIMEOUT: 10,
// SERVICE_LOG_LEVEL: 'info',
// SERVICE_LOG_CONSOLE: false,
// SERVICE_LOG_STDOUT: true,
// SERVICE_LOG_GELF: false,
// SERVICE_LOG_FILE: false,
// DOCKER_HOST: 'local',
// JOB_INTERVAL_UPDATE_READINESS_STATUS: 0,
// JOB_SCHEDULE_UPDATE_READINESS_STATUS: '* * * * *',
},
},
// Configuration for other microservices.
],
};
Blockchain Connector
Environment variable | Datatype | Description | Sample |
---|---|---|---|
|
string |
URL of the microservice message broker (NATS or Redis). |
|
|
string |
URL to connect with the Klayr application node over WebSocket.
By default, it is set to |
|
|
string |
URL to connect with the Klayr application node over HTTP(s).
By default, it is set to |
|
|
boolean |
Boolean flag to enable HTTP-API based connection to the Klayr application node. |
|
|
boolean |
Boolean flag to enable IPC-based connection to the Klayr application node.
Requires |
|
|
string |
Data path to connect with the Klayr application node over IPC. |
|
|
string |
URL of the GeoIP server. |
|
|
string |
URL of the Klayr SDK-based application’s genesis block. Only to be used when the genesis block is large enough to be transmitted over API calls within the timeout. |
|
|
boolean |
Boolean flag to enable block caching.
Enabled by default.
To disable it, set it to |
|
|
number |
Expiry time in hours for block cache.
By default, it is set to |
|
|
number |
Number of active API clients to be maintained in the pool.
Only applicable when using the IPC or WS clients to connect with the Klayr node.
By default, it is set to |
|
|
number |
Interval (in milliseconds) at which the WS server checks for liveliness of all the connected clients.
This should not be modified unless explicitly recommended by the development team.
By default, it is set to |
|
|
number |
A conservative assumption of the latency (in milliseconds) for WS server pings to arrive at the client.
By default, it is set to |
|
|
number |
Maximum number of endpoint invocation request retries to the node.
By default, it is set to |
|
|
number |
Delay (in milliseconds) between each endpoint invocation request retry.
By default, it is set to |
|
|
number |
Delay (in hours) after which the blockchain-connector microservice exits. The service should restart automatically if deployed using Docker or PM2.
To be removed eventually.
To enable it, set it higher than |
|
|
number |
Job run interval to clean up block cache.
By default, it is set to |
|
|
string |
Job run cron schedule to clean up block cache.
By default, it is set to run every |
|
|
number |
Job run interval to refresh the peers' list.
By default, it is set to run every |
|
|
string |
Job run cron schedule to refresh the peers' list.
By default, it is set to an empty string |
Sample Configurations
module.exports = {
apps: [
// Configuration for other microservices.
{
name: "klayr-service-blockchain-connector",
// [...]
env: {
// --- Remember to set the properties below
SERVICE_BROKER: 'redis://klayr:[email protected]:6379/0',
KLAYR_APP_WS: 'ws://127.0.0.1:7887',
GEOIP_JSON: 'https://geoip.klayr.xyz/json',
// ENABLE_BLOCK_CACHING: true,
// EXPIRY_IN_HOURS: 12,
// USE_KLAYR_IPC_CLIENT: true,
// KLAYR_APP_DATA_PATH: '~/.klayr/klayr-core',
// ENABLE_TESTING_MODE: false,
// SERVICE_BROKER_TIMEOUT: 10,
// SERVICE_LOG_LEVEL: 'info',
// SERVICE_LOG_CONSOLE: false,
// SERVICE_LOG_STDOUT: true,
// SERVICE_LOG_GELF: false,
// SERVICE_LOG_FILE: false,
// DOCKER_HOST: 'local',
// GENESIS_BLOCK_URL: 'https://downloads.klayr.xyz/klayr/mainnet/genesis_block.json.tar.gz',
// JOB_INTERVAL_CACHE_CLEANUP: 0,
// JOB_SCHEDULE_CACHE_CLEANUP: '0 */12 * * *',
// JOB_INTERVAL_REFRESH_PEERS: 60,
// JOB_SCHEDULE_REFRESH_PEERS: '',
},
},
// Configuration for other microservices.
],
};
Blockchain Coordinator
Environment variable | Datatype | Description | Sample |
---|---|---|---|
|
string |
URL of the microservice message broker (NATS or Redis). |
|
|
string |
URL of the Redis instance hosting the job queue to schedule the block indexing jobs.
Must match the value supplied for the |
|
|
number |
Job run interval to index missing blocks.
By default, it is set to |
|
|
string |
Job run cron schedule to index missing blocks.
By default, it is set to run every |
|
Sample Configurations
module.exports = {
apps: [
// Configuration for other microservices.
{
name: 'klayr-service-blockchain-coordinator',
// [...]
env: {
// --- Remember to set the properties below
SERVICE_BROKER: 'redis://klayr:[email protected]:6379/0',
SERVICE_MESSAGE_QUEUE_REDIS: 'redis://klayr:[email protected]:6379/3',
// SERVICE_BROKER_TIMEOUT: 10,
// SERVICE_LOG_LEVEL: 'info',
// SERVICE_LOG_CONSOLE: false,
// SERVICE_LOG_STDOUT: true,
// SERVICE_LOG_GELF: false,
// SERVICE_LOG_FILE: false,
// DOCKER_HOST: 'local',
// JOB_INTERVAL_INDEX_MISSING_BLOCKS: 0,
// JOB_SCHEDULE_INDEX_MISSING_BLOCKS: '*/5 * * * *',
},
},
// Configuration for other microservices.
],
};
Blockchain Indexer
Environment variable | Datatype | Description | Sample |
---|---|---|---|
|
string |
URL of the microservice message broker (NATS or Redis). |
|
|
string |
Connection string for the primary MySQL (read/write) instance that the microservice connects to. |
|
|
string |
URL of the job queue to process the scheduled indexing jobs by the Blockchain Coordinator (Redis).
Must match the value supplied for the |
|
|
string |
URL of the volatile cache storage (Redis). |
|
|
string |
Boolean flag to enable the Data Service mode. |
|
|
string |
Boolean flag to enable the Data Indexing mode. |
|
|
string |
Boolean flag to permanently maintain the events in the MySQL database. |
|
|
string |
URL of the cache storage (Redis). |
|
|
string |
Connection string for the replicated MySQL (read-only) instance that the microservice connects to. |
|
|
string |
URL of Klayr static assets. |
|
|
number |
Job run interval to delete serialized events.
By default, it is set to |
|
|
string |
Job run cron schedule to delete serialized events.
By default, it is set to run every |
|
|
number |
Job run interval to refresh validators cache.
By default, it is set to |
|
|
string |
Job run cron schedule to refresh validators cache.
By default, it is set to run every |
|
|
number |
Job run interval to validate the rank for all the validators.
By default, it is set to |
|
|
string |
Job run cron schedule to validate the rank for all the validators.
By default, it is set to run every |
|
|
string |
Job run interval to refresh indexing status.
By default, it is set to run every |
|
|
string |
Job run cron schedule to refresh indexing status.
By default, it is set to an empty string |
|
|
number |
Job run interval to refresh blockchain application statistics.
By default, it is set to |
|
|
string |
Job run cron schedule to refresh blockchain application statistics.
By default, it is set to run every |
|
|
number |
Job run interval to refresh account knowledge.
By default, it is set to |
|
|
string |
Job run cron schedule to refresh account knowledge.
By default, it is set to run every |
|
|
number |
Job run interval to delete finalized CCU metadata.
By default, it is set to |
|
|
string |
Job run cron schedule to delete finalized CCU metadata.
By default, it is set to run once a day at |
|
|
number |
Job run interval to trigger account updates.
By default, it is set to |
|
|
string |
Job run cron schedule to trigger account updates.
By default, it is set to run every |
|
|
number |
Transaction buffer bytes to consider when estimating the transaction fees.
By default, it is set to |
|
|
number |
Number of accounts for which the balance index is updated at a time.
By default, it is set to |
|
|
number |
Maximum number of jobs (in active and waiting state) allowed in the block indexing queue.
By default, it is set to |
|
|
string |
Mainchain service URL for custom deployments. |
|
|
string |
List of allowed methods that can be invoked via the |
|
Database snapshot configuration
To accelerate the indexing process, the blockchain-indexer microservice also supports automatic download and an application of a snapshot to the MySQL/MariaDB databases. The following environment variables in the table below can be used to configure the same.
Environment variable | Datatype | Description | Sample |
---|---|---|---|
|
boolean |
Enable or disable auto-apply snapshot feature. By default, the value is false. |
|
|
number |
Frequency in milliseconds to verify if a block is indexed or rolled-back successfully. By default, it is set to |
|
|
string |
Custom snapshot download URL (expected to end with sql.gz). |
|
|
boolean |
Boolean flag to enable downloading the snapshot from an (unsecured) HTTP URL. By default, this is set to false. |
|
Sample Configurations
module.exports = {
apps: [
// Configuration for other microservices.
{
name: 'klayr-service-blockchain-indexer',
// [...]
env: {
// --- Remember to set the properties below
SERVICE_BROKER: 'redis://klayr:[email protected]:6379/0',
SERVICE_INDEXER_CACHE_REDIS: 'redis://klayr:[email protected]:6379/1',
SERVICE_INDEXER_REDIS_VOLATILE: 'redis://klayr:[email protected]:6379/2',
SERVICE_MESSAGE_QUEUE_REDIS: 'redis://klayr:[email protected]:6379/3',
SERVICE_INDEXER_MYSQL: 'mysql://klayr:[email protected]:3306/klayr',
ENABLE_DATA_RETRIEVAL_MODE: 'true',
ENABLE_INDEXING_MODE: 'true',
ENABLE_PERSIST_EVENTS: 'false',
// ENABLE_APPLY_SNAPSHOT: 'false',
// DURABILITY_VERIFY_FREQUENCY: 1,
// INDEX_SNAPSHOT_URL: '',
// ENABLE_SNAPSHOT_ALLOW_INSECURE_HTTP: 'true',
// SERVICE_INDEXER_MYSQL_READ_REPLICA: 'mysql://klayr:[email protected]:3306/klayr',
// SERVICE_BROKER_TIMEOUT: 10,
// SERVICE_LOG_LEVEL: 'info',
// SERVICE_LOG_CONSOLE: 'false',
// SERVICE_LOG_STDOUT: 'true',
// SERVICE_LOG_GELF: 'false',
// SERVICE_LOG_FILE: 'false',
// DOCKER_HOST: 'local',
// MAINCHAIN_SERVICE_URL: 'https://service.klayr.xyz',
// KLAYR_STATIC: 'https://static-data.klayr.xyz',
// DEVNET_MAINCHAIN_URL: 'http://devnet-service.klayrdev.net:9901',
// ESTIMATES_BUFFER_BYTES_LENGTH: 0,
// ACCOUNT_BALANCE_UPDATE_BATCH_SIZE: 1000,
// INDEX_BLOCKS_QUEUE_SCHEDULED_JOB_MAX_COUNT: 100000,
// JOB_INTERVAL_DELETE_SERIALIZED_EVENTS: 0,
// JOB_SCHEDULE_DELETE_SERIALIZED_EVENTS: '*/5 * * * *',
// JOB_INTERVAL_REFRESH_VALIDATORS: 0,
// JOB_SCHEDULE_REFRESH_VALIDATORS: '*/5 * * * *',
// JOB_INTERVAL_VALIDATE_VALIDATORS_RANK: 0,
// JOB_SCHEDULE_VALIDATE_VALIDATORS_RANK: '4-59/15 * * * *',
// JOB_INTERVAL_REFRESH_INDEX_STATUS: 10,
// JOB_SCHEDULE_REFRESH_INDEX_STATUS: '',
// JOB_INTERVAL_REFRESH_BLOCKCHAIN_APPS_STATS: 0,
// JOB_SCHEDULE_REFRESH_BLOCKCHAIN_APPS_STATS: '*/15 * * * *',
// JOB_INTERVAL_REFRESH_ACCOUNT_KNOWLEDGE: 0,
// JOB_SCHEDULE_REFRESH_ACCOUNT_KNOWLEDGE: '*/15 * * * *',
// JOB_INTERVAL_DELETE_FINALIZED_CCU_METADATA: 0,
// JOB_SCHEDULE_DELETE_FINALIZED_CCU_METADATA: '0 2 * * *',
// JOB_INTERVAL_TRIGGER_ACCOUNT_UPDATES: 0,
// JOB_SCHEDULE_TRIGGER_ACCOUNT_UPDATES: '*/15 * * * *',
},
},
// Configuration for other microservices.
],
};
Blockchain application registry
Environment variable | Datatype | Description | Sample |
---|---|---|---|
|
string |
URL of the microservice message broker (NATS or Redis). |
|
|
string |
Connection string of the MySQL instance that the microservice connects to. |
|
|
boolean |
Boolean flag to truncate the index and rebuild at application init. |
|
|
string |
Default blockchain applications.
By default, it is set to |
|
|
number |
Job run interval to delete non-metadata files.
By default, it is set to |
|
|
string |
Job run cron schedule to delete non-metadata files.
By default, it is set to run every day at |
|
|
number |
Job run interval to update off-chain metadata.
By default, it is set to |
|
|
string |
Job run cron schedule to update off-chain metadata.
By default, it is set to run every |
|
|
string |
URL of |
|
|
string |
Relevant branch for |
|
Sample Configurations
module.exports = {
apps: [
// Configuration for other microservices.
{
name: 'klayr-service-blockchain-app-registry',
// [...]
env: {
// --- Remember to set the properties below
SERVICE_BROKER: 'redis://klayr:[email protected]:6379/0',
SERVICE_APP_REGISTRY_MYSQL: 'mysql://klayr:[email protected]:3306/klayr',
ENABLE_REBUILD_INDEX_AT_INIT: false,
// SERVICE_BROKER_TIMEOUT: 10,
// SERVICE_LOG_LEVEL: 'info',
// SERVICE_LOG_CONSOLE: false,
// SERVICE_LOG_STDOUT: true,
// SERVICE_LOG_GELF: false,
// SERVICE_LOG_FILE: false,
// DOCKER_HOST: 'local',
// GITHUB_APP_REGISTRY_REPO: 'https://github.com/KlayrHQ/app-registry',
// GITHUB_APP_REGISTRY_REPO_BRANCH: 'main',
// JOB_INTERVAL_DELETE_NON_METADATA_FILES: 0,
// JOB_SCHEDULE_DELETE_NON_METADATA_FILES: '0 0 * * *',
// JOB_INTERVAL_UPDATE_METADATA: 0,
// JOB_SCHEDULE_UPDATE_METADATA: '*/10 * * * *',
},
},
// Configuration for other microservices.
],
};
Fee estimator
Environment variable | Datatype | Description | Sample |
---|---|---|---|
|
string |
URL of the microservice message broker (NATS or Redis). |
|
|
string |
URL of the cache storage (Redis). |
|
|
boolean |
Enable quick algorithm for fee estimation. |
|
|
boolean |
Enable full algorithm for fee estimation. |
|
|
number |
Defines the number of blocks that are analyzed during cold start. |
|
|
number |
Defines the block height at which the dynamic fee estimation algorithm starts. By default, it starts at the genesis height in full mode and the current block height at the moment of application initialization in quick mode. |
|
|
number |
Estimated moving average algorithm batch size. |
|
|
number |
Estimated moving average algorithm decay rate. |
|
|
number |
Estimated moving average algorithm weighted average decay percentage. |
|
Sample Configurations
module.exports = {
apps: [
// Configuration for other microservices.
{
name: 'klayr-service-fee-estimator',
// [...]
env: {
// --- Remember to set the properties below
SERVICE_BROKER: 'redis://klayr:[email protected]:6379/0',
SERVICE_FEE_ESTIMATOR_CACHE: 'redis://klayr:[email protected]:6379/1',
ENABLE_FEE_ESTIMATOR_QUICK: true,
ENABLE_FEE_ESTIMATOR_FULL: false,
// FEE_EST_COLD_START_BATCH_SIZE: 1,
// FEE_EST_DEFAULT_START_BLOCK_HEIGHT: 1,
// FEE_EST_EMA_BATCH_SIZE: 20,
// FEE_EST_EMA_DECAY_RATE: 0.5,
// FEE_EST_WAVG_DECAY_PERCENTAGE: 10,
// SERVICE_BROKER_TIMEOUT: 10,
// SERVICE_LOG_LEVEL: 'info',
// SERVICE_LOG_CONSOLE: false,
// SERVICE_LOG_STDOUT: true,
// SERVICE_LOG_GELF: false,
// SERVICE_LOG_FILE: false,
// DOCKER_HOST: 'local',
},
},
// Configuration for other microservices.
],
};
Transaction statistics
Environment variable | Datatype | Description | Sample |
---|---|---|---|
|
string |
URL of the microservice message broker (NATS or Redis). |
|
|
string |
Connection string of the MySQL instance that the microservice connects to. |
|
|
string |
URL of the cache storage (Redis). |
|
|
number |
The number of days for which the transaction statistics need to be built in retrospect to the application init. |
|
|
string |
Connection string (read-only) of the replicated MySQL instance that the microservice connects to. |
|
|
number |
Job run interval to refresh transaction statistics.
By default, it is set to |
|
|
string |
Job run cron schedule to refresh transaction statistics.
By default, it is set to run every |
|
|
number |
Job run interval to verify if the transaction statistics have been built correctly.
By default, it is set to |
|
|
string |
Job run cron schedule to verify if the transaction statistics have been built correctly.
By default, it is set to run every |
|
Sample Configurations
module.exports = {
apps: [
// Configuration for other microservices.
{
name: 'klayr-service-transaction-statistics',
// [...]
env: {
// --- Remember to set the properties below
SERVICE_BROKER: 'redis://klayr:[email protected]:6379/0',
SERVICE_STATISTICS_REDIS: 'redis://klayr:[email protected]:6379/1',
SERVICE_STATISTICS_MYSQL: 'mysql://klayr:[email protected]:3306/klayr',
TRANSACTION_STATS_HISTORY_LENGTH_DAYS: 366,
// SERVICE_STATISTICS_MYSQL_READ_REPLICA: 'mysql://reader:[email protected]:3307/klayr',
// SERVICE_BROKER_TIMEOUT: 10,
// SERVICE_LOG_LEVEL: 'info',
// SERVICE_LOG_CONSOLE: false,
// SERVICE_LOG_STDOUT: true,
// SERVICE_LOG_GELF: false,
// SERVICE_LOG_FILE: false,
// DOCKER_HOST: 'local',
// JOB_INTERVAL_REFRESH_TRANSACTION_STATS: 0,
// JOB_SCHEDULE_REFRESH_TRANSACTION_STATS: '*/30 * * * *',
// JOB_INTERVAL_VERIFY_TRANSACTION_STATS: 0,
// JOB_SCHEDULE_VERIFY_TRANSACTION_STATS: '15 */3 * * *',
},
},
// Configuration for other microservices.
],
};
Market
Environment variable | Datatype | Description | Sample |
---|---|---|---|
|
string |
URL of the microservice message broker (NATS or Redis). |
|
|
string |
URL of the cache storage (Redis). |
|
|
string |
Fiat currencies are used for price calculation. All Fiat currencies used here need to be comma separated. |
|
|
string |
Exchange rates exposed to the Gateway. The values listed here must be comma separated. |
|
|
string |
Optional API key for https://exchangeratesapi.io/.
The |
|
|
number |
Job run interval to refresh prices from Binance.
By default, it is set to |
|
|
string |
Job run cron schedule to refresh prices from Binance.
By default, it is set to run |
|
|
string |
Job run interval to refresh prices from Bittrex.
By default, it is set to |
|
|
string |
Job run cron schedule to refresh prices from Bittrex.
By default, it is set to run |
|
|
string |
Job run interval to refresh prices from exchangeratesapi.
By default, it is set to |
|
|
string |
Job run cron schedule to refresh prices from exchangeratesapi.
By default, it is set to run |
|
|
string |
Job run interval to refresh prices from Kraken.
By default, it is set to |
|
|
string |
Job run cron schedule to refresh prices from Kraken.
By default, it is set to run |
|
|
string |
Job run interval to update market prices.
By default, it is set to run every |
|
|
string |
Job run cron schedule to update market prices.
By default, it is set to an empty string |
Sample Configurations
module.exports = {
apps: [
// Configuration for other microservices.
{
name: 'klayr-service-market',
// [...]
env: {
// --- Remember to set the properties below
SERVICE_BROKER: 'redis://klayr:[email protected]:6379/0',
SERVICE_MARKET_REDIS: 'redis://klayr:[email protected]:6379/2',
SERVICE_MARKET_FIAT_CURRENCIES: 'EUR,USD,CHF,GBP,RUB,PLN,JPY,AUD,GBP,INR',
SERVICE_MARKET_TARGET_PAIRS: 'LSK_BTC,LSK_EUR,LSK_USD,LSK_CHF,LSK_PLN,LSK_JPY,LSK_AUD,LSK_GBP,LSK_INR,BTC_EUR,BTC_USD,BTC_CHF',
// EXCHANGERATESAPI_IO_API_KEY: ''
// SERVICE_BROKER_TIMEOUT: 10,
// SERVICE_LOG_LEVEL: 'info',
// SERVICE_LOG_CONSOLE: false,
// SERVICE_LOG_STDOUT: true,
// SERVICE_LOG_GELF: false,
// SERVICE_LOG_FILE: false,
// DOCKER_HOST: 'local',
// JOB_INTERVAL_REFRESH_PRICES_BINANCE: 0,
// JOB_SCHEDULE_REFRESH_PRICES_BINANCE: '* * * * *',
// JOB_INTERVAL_REFRESH_PRICES_BITTREX: 0,
// JOB_SCHEDULE_REFRESH_PRICES_BITTREX: '* * * * *',
// JOB_INTERVAL_REFRESH_PRICES_EXCHANGERATESAPI: 0,
// JOB_SCHEDULE_REFRESH_PRICES_EXCHANGERATESAPI: '* * * * *',
// JOB_INTERVAL_REFRESH_PRICES_KRAKEN: 0,
// JOB_SCHEDULE_REFRESH_PRICES_KRAKEN: '* * * * *',
// JOB_INTERVAL_UPDATE_PRICES: 5,
// JOB_SCHEDULE_UPDATE_PRICES: '',
},
},
// Configuration for other microservices.
],
};
Export
The EXPORT_S3_* variables should only be configured when using AWS S3 instead of a local file system.
For the local file system, use SERVICE_EXPORT_PARTIALS and SERVICE_EXPORT_STATIC variables.
|
Environment variable | Datatype | Description | Sample |
---|---|---|---|
|
string |
URL of the microservice message broker (NATS or Redis). |
|
|
string |
URL of the permanent cache storage (Redis). |
|
|
string |
URL of the volatile cache storage (Redis). |
|
|
string |
Local filepath where the partial (per day) transaction history files for a specified account are temporarily cached. |
|
|
string |
Local filepath where the aggregated transaction history files, as requested by the user are stored. |
|
|
string |
Amazon S3 bucket endpoint. |
|
|
string |
Amazon S3 bucket access key for the specified endpoint. |
|
|
string |
Amazon S3 bucket secret key. |
|
|
string |
Amazon S3 bucket session token. |
|
|
string |
The region where Amazon S3 bucket is hosted. Optional. |
|
|
string |
Amazon S3 bucket name. Optional. |
|
|
string |
Amazon S3 bucket where the partial (per day) transaction history files for a specified account are temporarily cached. |
|
|
string |
Amazon S3 bucket where the aggregated transaction history files, as requested by the user are stored. |
|
|
string |
Amazon S3 bucket where the aggregated transaction history files, as requested by the user are stored. |
|
|
number |
Job run interval to clean up cache.
By default, it is set to |
|
|
string |
Job run cron schedule to clean up the cache.
By default, it is set to run daily at |
|
Sample Configurations
module.exports = {
apps: [
// Configuration for other microservices.
{
name: 'klayr-service-export',
// [...]
env: {
SERVICE_BROKER: 'redis://klayr:[email protected]:6379/0',
SERVICE_EXPORT_REDIS: 'redis://klayr:[email protected]:6379/3',
SERVICE_EXPORT_REDIS_VOLATILE: 'redis://klayr:[email protected]:6379/4',
// SERVICE_EXPORT_PARTIALS: './data/partials',
// EXPORT_S3_BUCKET_NAME_PARTIALS: 'partials',
// SERVICE_EXPORT_STATIC: './data/static',
// EXPORT_S3_BUCKET_NAME_EXPORTS: 'exports',
// SERVICE_BROKER_TIMEOUT: 10,
// SERVICE_LOG_LEVEL: 'info',
// SERVICE_LOG_CONSOLE: 'false',
// SERVICE_LOG_STDOUT: 'true',
// SERVICE_LOG_GELF: 'false',
// SERVICE_LOG_FILE: 'false',
// DOCKER_HOST: 'local',
// EXPORT_S3_ENDPOINT: 's3.amazonaws.com',
// EXPORT_S3_ACCESS_KEY: '',
// EXPORT_S3_SECRET_KEY: '',
// EXPORT_S3_SESSION_TOKEN: '',
// EXPORT_S3_REGION: 'eu-central-1',
// EXPORT_S3_BUCKET_NAME: 'export',
// JOB_INTERVAL_CACHE_PURGE: 0,
// JOB_SCHEDULE_CACHE_PURGE: '45 4 * * *',
},
},
],
};