Managing deepstream-app using PM2?

I am looking at options for managing the deepstream-app.
Currently I am using PM2 for another service that needs to interact with the deepstream-app, so I would prefer using PM2 if it’s possible.

I simply want to run the app in background and auto-restart whenever it fails or system reboots.
Is there any recommended solution for this?
If PM2 is alright, how can I do it? It seems when I use PM2, the app continuously restarts.


You may try and it should work as long as resources & dependencies required for Deepstream app are available to PM2. Let us know your findings.

Thanks for your reply. I managed to get it working with alot of trial and error as well as different combinations in the PM2 ecosystem configuration.

Just an assumption:
PM2 was continuously restarting because DeepStream printed out some warning messgages which PM2 assumed to be std-error. The messages looked something like

GStreamer-WARNING **:

By fixing those warnings, everything just worked as I expected it to.

My preference goes to PM2 because it can give detailed information about the process and resources it consumes. But, there does lie some uncertainty in using PM2 for DeepStream.

It would be really good to have some kind of process managers for DS.