I'm trying to run PM2 for my Node application that is hosted on the Digital Ocean App Platform. I have no issues running my app with node index.js
but when I try to run pm2 start index.js
I end up with a failed deployment. I haven't seen anywhere saying otherwise, but is it possible to use PM2 on the App Platform?
From my deploy logs:
[2023-02-28 07:03:29] > pm2 start index.js
[2023-02-28 07:03:30] [PM2] Spawning PM2 daemon with pm2_home=/workspace/.pm2
[2023-02-28 07:03:30] [PM2] PM2 Successfully daemonized
[2023-02-28 07:03:30] [PM2] Starting /workspace/index.js in fork_mode (1 instance)
[2023-02-28 07:03:31] [PM2] Done.
[2023-02-28 07:03:31] ┌─────┬──────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
[2023-02-28 07:03:31] │ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
[2023-02-28 07:03:31] ├─────┼──────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
[2023-02-28 07:03:31] │ 0 │ index │ default │ 1.0.0 │ fork │ 39 │ 0s │ 0 │ online │ 0% │ 0b │ apps │ enabled │
[2023-02-28 07:03:31] └─────┴──────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
[2023-02-28 07:03:31] npm notice
[2023-02-28 07:03:31] npm notice New major version of npm available! 8.19.3 -> 9.5.1
[2023-02-28 07:03:31] npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.5.1>
[2023-02-28 07:03:31] npm notice Run `npm install -g [email protected]` to update!
[2023-02-28 07:03:31] npm notice
Error message: Component Issues app_name failed to deploy
For health check to know if the app is running and the deployment was successful you'll have to run PM2 in the foreground.
pm2 start index.js --no-daemon