Skip to content

Commit 5dd72df

Browse files
authored
Mention pm2-runtime (#651)
1 parent b31e29a commit 5dd72df

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/pages/agents/deploy/pm2-process-management.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,15 @@ agent.on("unhandledError", (error) => {
115115
**Symptom**: Process restarts in a tight loop.
116116

117117
**Solution**: Increase `restart_delay` to give the process time to initialize before allowing another restart.
118+
119+
### Application exits early
120+
121+
When PM2 runs in daemon mode, `pm2 start` exits right after launching the processes. In container or PaaS environments, this can make the platform think your app has finished and should shut down.
122+
123+
To keep PM2 in the foreground, use `pm2-runtime` instead of `pm2 start`:
124+
125+
```ts [Node]
126+
pm2-runtime ecosystem.config.cjs
127+
```
128+
129+
This keeps the PM2 process running in the foreground, which is typically required by PaaS platforms such as [Render](https://render.com/) or [Heroku](https://www.heroku.com/).

0 commit comments

Comments
 (0)