4

I'm thinking of switching from Node.js to another programming language (Elixir). And in Node, I've used PM2 as a process manager. Now, the thing is, I don't want to use PM2 for process management, since I would need Node as a dependency and PM2 is more for Node.js application processes (although I know that you can run non-Node applications with it).

So, my question is: what can I use as a PM2 replacement for non-Node.js applications?

Features that I need from this tool:

  • listing processes and getting their stats (CPU, memory etc.)
  • tasks for starting/restarting/deleting processes
  • auto-restart process on crash
  • logs displaying and storing
  • (optional) some monitoring tools (something like Prometheus)
  • (optional) auto-restart process on files change
serge1peshcoff
  • 413
  • 1
  • 4
  • 8
  • Check out https://servicer.dev, I created this tool exactly to solve this problem. It provides a pm2 style CLI to create and monitor services, built on top of systemd. `sudo ser create server.py --interpreter python3 --start --auto-restart` will automatically create a `.service` file and start the service. Servicer doesn't run in the background or produce forks, so you don't have to worry about running your service written in X lang running inside a tool written in Y lang. – secretshardul Aug 15 '23 at 12:07

2 Answers2

0

Any other process manager will come with it's own set of supporting/underlying languages and frameworks, eg. Python or such, so there is no difference.

If you already know PM2 and know to maintain Node, then use PM2 the way it is documented to use with non-Node apps: https://pm2.keymetrics.io/docs/usage/process-management/#start-any-process-type

Sych
  • 93
  • 3
0

Virtually any service, including those you used to run with pm2, can be run from a systemd unit. And this is better integrated into the Linux distribution anyway. Most languages/web app frameworks will provide a sample systemd unit you can use.

For instance, if you are programming in Elixir, you are likely using the Phoenix Framework, for which you can find sample systemd units and assistance on the Elixir forum.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972