Puma - Rails on linux // Restart the process when the process dies

Using puma in a rails application; he sometimes dies without any articular cause; also often dies (does not restart after stopping) when deployed

What would be a good way to track if a process has died and restart it correctly? Called in the rails application; It would be useful for me to be able to define it for any applications. I did not find any useful ways to do this (looked at systemd, other linux daemons ... without success)

Thanks if any feedback

+3
source share
1 answer

You can use puma control to start / stop the puma server. If you know where the puma.pid file is puma.pid (for Mac, usually "#{Dir.pwd}/tmp/pids/puma.pid" ), you can do:

 bundle exec pumactl -P path/puma.pid stop 

To set the path to the pid file or other parameters (for example, to unmount), you can create a puma configuration. You can find an example here . And then start and stop the server only with the configuration file:

 bundle exec pumactl -F config/puma.rb start 

You can also restart and check the status as follows:

 bundle exec pumactl -F config/puma.rb restart bundle exec pumactl -F config/puma.rb status 
+9
source

Source: https://habr.com/ru/post/977288/


All Articles