Puma-Linux上的Rails //进程终止后重新启动 [英] Puma - Rails on linux // Restart when process dies

查看:448
本文介绍了Puma-Linux上的Rails //进程终止后重新启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Rails应用程序上使用puma;它有时死于无任何关节原因;部署时还经常死掉(在停止后不会重新启动)

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

什么是监视进程是否死亡并以正确方式重新启动的好方法?
在Rails应用程序中被调用;有一种方法可以为所有应用程序定义它,这对我很有用。
我没有找到任何可行的方法(调查了systemd,其他linux守护程序……没有成功)

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)

感谢任何反馈

推荐答案

您可以使用 puma控件启动/停止puma服务器。如果您知道 puma.pid 文件的位置(对于Mac,通常为#{Dir.pwd} /tmp/pids/puma.pid ),您可以这样做:

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

要设置pid文件路径或其他选项(例如守护进程),您可以创建puma配置。您可以在此处找到示例。然后仅使用配置文件启动和停止服务器:

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

这篇关于Puma-Linux上的Rails //进程终止后重新启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆