Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PM2 (pm2-runtime) does not read cli --instances param if run ecosystem file (only docker) #5543

Open
VeXell opened this issue Jan 30, 2023 · 0 comments

Comments

@VeXell
Copy link

VeXell commented Jan 30, 2023

What's going wrong?

I am using docker container and to run PM2 with different count of instances depends on environment (prod or staging). In both cases i have common ecosystem config:

module.exports = {
    apps: [
        {
            name: 'app',
            script: 'build/app.js',
            autorestart: true,
            watch: false,
            max_memory_restart: '512M',
            vizion: false,
            exec_mode: 'cluster',
        },
    ],
};

And command in docker

CMD ["pm2-runtime", "--instances", "2", "--json", ".ecosystem.config.js"]

When i run docker container PM2 spawns only 1 instance instead of 2.
I think it might be a problem in that file

pm2/lib/API.js

Line 1012 in 5e70845

if (opts.instances && typeof(opts.instances) === 'number')

Because in that case instances has String type

Supporting information

--- Daemon logs --------------------------------------------
/home/nodejs/.pm2/pm2.log last 20 lines:
PM2        | 2023-01-30T13:23:21: PM2 log: ===============================================================================
PM2        | 2023-01-30T13:23:21: PM2 log: --- New PM2 Daemon started ----------------------------------------------------
PM2        | 2023-01-30T13:23:21: PM2 log: Time                 : Mon Jan 30 2023 13:23:21 GMT+0000 (Coordinated Universal Time)
PM2        | 2023-01-30T13:23:21: PM2 log: PM2 version          : 5.2.2
PM2        | 2023-01-30T13:23:21: PM2 log: Node.js version      : 14.21.2
PM2        | 2023-01-30T13:23:21: PM2 log: Current arch         : x64
PM2        | 2023-01-30T13:23:21: PM2 log: PM2 home             : /home/nodejs/.pm2
PM2        | 2023-01-30T13:23:21: PM2 log: PM2 PID file         : /home/nodejs/.pm2/pm2.pid
PM2        | 2023-01-30T13:23:21: PM2 log: RPC socket file      : /home/nodejs/.pm2/rpc.sock
PM2        | 2023-01-30T13:23:21: PM2 log: BUS socket file      : /home/nodejs/.pm2/pub.sock
PM2        | 2023-01-30T13:23:21: PM2 log: Application log path : /home/nodejs/.pm2/logs
PM2        | 2023-01-30T13:23:21: PM2 log: Worker Interval      : 30000
PM2        | 2023-01-30T13:23:21: PM2 log: Process dump file    : /home/nodejs/.pm2/dump.pm2
PM2        | 2023-01-30T13:23:21: PM2 log: Concurrent actions   : 2
PM2        | 2023-01-30T13:23:21: PM2 log: SIGTERM timeout      : 1600
PM2        | 2023-01-30T13:23:21: PM2 log: ===============================================================================
PM2        | 2023-01-30T13:23:32: PM2 log: App [pm2-autoscale:0] starting in -fork mode-
PM2        | 2023-01-30T13:23:32: PM2 log: App [pm2-autoscale:0] online
@VeXell VeXell changed the title PM2 does not read cli --instances param if run ecosystem file PM2 (pm2-runtime) does not read cli --instances param if run ecosystem file (only docker) Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant