Puma - Rails on linux // Restart when process dies
Asked Answered
W

1

4

Using puma on a rails app; it sometimes dies without any articular reason; also often dies (does not restart after being stopped) when deployed

What would be a good way to monitor if the process died, and restart it right way ? Being called within a rails app; I'd be useful to have a way to defines it for any apps. I did not found any useable ways to do it (looked into systemd, other linux daemons… no success)

Thanks if any feedback

Whew answered 26/5, 2014 at 10:11 Comment(0)
A
13

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

bundle exec pumactl -P path/puma.pid stop

To set pid file path or to other options (like daemonizing) you could create puma config. You can found an example here. And then start and stop server just with config file:

bundle exec pumactl -F config/puma.rb start

You can also restart and check status in this way:

bundle exec pumactl -F config/puma.rb restart
bundle exec pumactl -F config/puma.rb status
Allegro answered 27/5, 2014 at 3:18 Comment(1)
bingo! added to favoritesMoreville

© 2022 - 2024 — McMap. All rights reserved.