Keystone: Keystone with pm2 or forever

Created on 12 Apr 2020  路  1Comment  路  Source: keystonejs/keystone

How to use Keystone V5 with pm2 or forever to make application up and running forever in production?

Most helpful comment

The simplest way is simply to have an ecosystem.config.js file like this:

module.exports = {
  apps: [
    {
      name: "keystone-project",
      cwd: "/path/to/keystone/project/",
      script: "npm run build && npm start",
      instances: 1,
      autorestart: true,
      max_memory_restart: "1G",
      env: {
        DATABASE_URL: "mongodb://localhost/keystone-project-db"
      }
    }
  ]
};

Then you'd simply start it with pm2 start ecosystem.config.js

This works fine for me, with one caveat: I have no successfully been able to run KeystoneJS in cluster mode.

>All comments

The simplest way is simply to have an ecosystem.config.js file like this:

module.exports = {
  apps: [
    {
      name: "keystone-project",
      cwd: "/path/to/keystone/project/",
      script: "npm run build && npm start",
      instances: 1,
      autorestart: true,
      max_memory_restart: "1G",
      env: {
        DATABASE_URL: "mongodb://localhost/keystone-project-db"
      }
    }
  ]
};

Then you'd simply start it with pm2 start ecosystem.config.js

This works fine for me, with one caveat: I have no successfully been able to run KeystoneJS in cluster mode.

Was this page helpful?
0 / 5 - 0 ratings