When you run an app in cluster mode with PM2 each worker will receive a value in process.env.NODE_APP_INSTANCE which goes from 0 to number of workers-1. Let's say you start your app with pm2 start app.js -i 4, then your workers will receive 0 1 2 3 as NODE_APP_INSTANCE value.
Then in your code you can use that value to set the listen port such as server.listen(8000 + process.env.NODE_APP_INSTANCE)
// pm2 user permission fix Unitech/pm2#837