I'm trying to use pm2
on Heroku. I did have a look at the documentation. It looks like the application works fine once deployed, and the logs indicates that multiple instances has started on a 2X dyno.
Yet when I run: heroku run bash
and do a pm2 ls
I get an empty list:
┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬────────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ memory │ watching │
└──────────┴────┴──────┴─────┴────────┴─────────┴────────┴────────┴──────────┘
And I can't use any pm2
CLI functions. I understand that when I do a heroku run
command a one-off dyno is created on the fly and the pm2
instance running on this dyno does not run any process.
However I don't see how I can access pm2
on a specific dyno.
Is there any way to take advantage of the pm2
cli on Heroku?
heroku run
connects you to an additional temporary container.
To connect to a real running app container, use heroku ps:exec
.
As mentioned in the Heroku docs,
your app is spread across many dynos
As a result there isn't one place your app is running so I can't see how you will be able to do what you want.
Heroku's docs explain this a bit more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With