Ecosystem File

You can also create a configuration file, called Ecosystem File, to manage multiple applications. To generate an Ecosystem file

$ pm2 ecosystem

This will generate an ecosystem.config.js file

module.exports = {
 apps : [{
    name: "app",
    script: "./app.js",
    env: {
      NODE\_ENV: "development",
    },
 env\_production: {
      NODE\_ENV: "production",
    }
 }, {
 name: 'worker',
     script: 'worker.js'
  }]
}

And start it easily

$ pm2 start ecosystem.config.js

Read more about application declaration here

Comments