监视 Ruby on Rails Sidekiq [英] Monit Ruby on Rails Sidekiq
问题描述
我正在尝试为 Sidekiq 设置 Monit.到目前为止,这是我的配置文件的内容:
I'm trying to set up Monit for Sidekiq. Here's what I have so far for my config file:
check process sidekiq_site
with pidfile /var/www/site/tmp/pids/sidekiq.pid
start program = "bundle exec sidekiq -C /var/www/site/config/sidekiq.yml -P /var/www/site/tmp/pids/sidekiq.pid" with timeout 90 seconds
if totalmem is greater than 200 MB for 2 cycles then restart # eating up memory?
group site_sidekiq
问题是我在运行 monit reload 时收到一条消息,说程序bundle"不存在.
The problem is I'm getting a message when I run monit reload that the program "bundle" does not exist.
有没有人有解决方案?
推荐答案
在完成我自己的 monit 和 sidekiq 配置之后,我可以分享对我运行 ubuntu 有用的东西.
After working on my own monit and sidekiq config, I can share what worked for me running ubuntu.
首先,如果您使用的是该发行版,则存在适用于 ubuntu 的 sidekiq upstart 脚本.有用于 sidekiq 和管理工人的脚本:https://github.com/mperham/sidekiq/tree/master/examples/upstart/manage-one
First, there exists a sidekiq upstart script for ubuntu if you are on that distro. There are scripts for sidekiq and for managing the workers: https://github.com/mperham/sidekiq/tree/master/examples/upstart/manage-one
当我使用 rvm 时,我在使用默认的 upstart 脚本时遇到了一些错误.检查/var/logs/upstart/sidekiq-0.log 对问题有所了解.这一行:
I ran into a few errors with that default upstart script, as I am using rvm. Checking /var/logs/upstart/sidekiq-0.log shed some light on the problems. This line:
exec bin/sidekiq -i ${index} -e production -C config/sidekiq.yml -P tmp/pids/sidekiq-${index}.pid
需要改为exec bundle exec sidekiq
+ 选项
然后,为了使所有内容与我的 rvm 安装保持一致,我更改了以下内容:
Then, for keeping everything in line with my rvm install, I changed the following:
#source $HOME/.rvm/scripts/rvm
source /usr/local/rvm/scripts/rvm
在/etc/monit/monitrc 中,我引用了 upstart 脚本并具有:
# sidekiq
check process sidekiq
with pidfile /var/www/apps/myapp/current/tmp/pids/sidekiq-0.pid
start program = "/usr/bin/sudo start sidekiq index=0"
stop program = "/usr/bin/sudo stop sidekiq index=0"
if totalmem is greater than 500 MB for 2 cycles then restart # eating up memory?
if 3 restarts within 5 cycles then timeout
这篇关于监视 Ruby on Rails Sidekiq的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!