Configuration with PM2

Table of Contents

Custom configuration

Klayr Service offers a set of Default Configurations, which can be customized as per the requirement. To create a custom configuration, it is recommended to copy the default configuration file and use the copy of the said file for customization.

Working directory: ./klayr-service/
cp ecosystem.config.js ecosystem.custom.config.js

Now it is possible to open the new file ecosystem.custom.config.js and adjust it as desired.

Klayr Service can be configured in various ways by setting environment variables.

All available configuration options are described in the Configuration reference.

Once customized, you can start Klayr Service with the custom ecosystem file by executing the following command:

Working directory: ./klayr-service/
pm2 start ecosystem.custom.config.js

Finally, if you want to use yarn start and yarn stop to start and stop Klayr Service with the custom configuration, don’t forget to update the scripts in package.json:

Working directory: ./klayr-service/
{
  //[...]
  "scripts": {
    "start": "pm2 start ecosystem.custom.config.js",
    "stop": "pm2 delete ecosystem.custom.config.js",
  //[...]
  }
}

Additional commands for managing Klayr Service with PM2 are described on the PM2 commands page.