// This is the pm2 configuration file for npms-analyzer
{
    apps: [
        {
            name: 'npms-analyzer-observe',
            script: './cli.js',
            args: 'observe',
            instances: 1,
            env : { NODE_ENV: 'production' },
        },
        {
            name: 'npms-analyzer-consume',
            script: './cli.js',
            args: 'consume --concurrency 3',
            instances: 2,
            env : { NODE_ENV: 'production' },
        },
        {
            name: 'npms-analyzer-scoring',
            script: './cli.js',
            args: 'scoring',
            instances: 1,
            env : { NODE_ENV: 'production' },
        },
    ],
    deploy: {
        production: {
            user: 'analyzer',
            host: '163.172.148.133',
            ref: 'origin/master',
            repo: 'https://github.com/npms-io/npms-analyzer.git',
            path: '/home/analyzer/npms-analyzer',
            'post-deploy': '\
cp ../local.json5 ./config/ && \
npm update --loglevel http --production && \
pm2 startOrRestart ecosystem.json5 --env production',
        },
    },
}


Add max_memory_restart to pm2 config.
// This is the pm2 configuration file for npms-analyzer
{
    apps: [
        {
            name: 'npms-analyzer-observe',
            script: './cli.js',
            args: 'observe',
            instances: 1,
            env : { NODE_ENV: 'production' },
            max_memory_restart: '1.5GB'
        },
        {
            name: 'npms-analyzer-consume',
            script: './cli.js',
            args: 'consume --concurrency 3',
            instances: 2,
            env : { NODE_ENV: 'production' },
            max_memory_restart: '1.5GB'
        },
        {
            name: 'npms-analyzer-scoring',
            script: './cli.js',
            args: 'scoring',
            instances: 1,
            env : { NODE_ENV: 'production' },
            max_memory_restart: '1.5GB'
        },
    ],
    deploy: {
        production: {
            user: 'analyzer',
            host: '163.172.148.133',
            ref: 'origin/master',
            repo: 'https://github.com/npms-io/npms-analyzer.git',
            path: '/home/analyzer/npms-analyzer',
            'post-deploy': '\
cp ../local.json5 ./config/ && \
npm update --loglevel http --production && \
pm2 startOrRestart ecosystem.json5 --env production',
        },
    },
}