Note: PM2 own code quality is bad and cluster_mode is not production ready. I would not recommend to use PM2, anywhere. You have been warned.

How to use a different ssh port for PM2
Since pm2-deploy directly forward the host string to ssh, you can simply use:
"host": "HOSTNAME -p PORT"
inside the configuration file.
How to use cluster_mode in PM2
Make your app instances listen on port 8000 and pm2 will load-balance any request on 8080 to your app instances.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"apps": [{ | |
"name": "My app", | |
"script": "server.js", | |
"instances": 2, | |
"port": 8080, | |
"exec_mode": "cluster_mode" | |
}], | |
"deploy": { | |
"production": { | |
"user": "node", | |
"host": [{ | |
"host": "my-host-name -p 22115", | |
}], | |
"ref": "origin/master", | |
"repo": "git@github.com:user/repo.git", | |
"path": "/app", | |
"post-deploy": "pm2 startOrRestart ecosystem.json --env production" | |
} | |
} | |
} |
Troubleshooting pm2 deploy
pm2-deploy outputs its log into /tmp/pm2-deploy.log so if you don't understand why pm2 deploy is not working, a tail -f /tmp/pm2-deploy.log might help.