Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pm2 for Ruby or Sinatra apps?

Tags:

ruby

sinatra

I currently use pm2 to manage my node processes. I have run into a situation where I need to run a Sinatra server, but I don't know how to keep it alive.

Is there a pm2 equivalent to host Ruby scripts or Sinatra apps?

like image 329
kidcapital Avatar asked Feb 09 '23 06:02

kidcapital


1 Answers

It looks like the PM2 Equivalent for ruby is... PM2. It allows you to choose your interpreter and start any process type. The docs that I linked to even have an example for how to set start a Ruby process.

From the Docs:

To run a non-JS interpreter you must set exec_mode to fork_mode and exec_interpreter to your interpreter of choice. For example:

{
  "apps" : [{
    "name"       : "bash-worker",
    "script"     : "./a-bash-script",
    "exec_interpreter": "bash",
    "exec_mode"  : "fork_mode"
  }, {
    "name"       : "ruby-worker",
    "script"     : "./some-ruby-script",
    "exec_interpreter": "ruby",
    "exec_mode"  : "fork_mode"
  }]
}
like image 197
Sam Eaton Avatar answered Feb 26 '23 21:02

Sam Eaton