我一直在寻找如何使用上帝监控系统启动sidekiq的配置。下面是我用来启动 sidekiq 的神文件。
rails_env = ENV['RAILS_ENV'] || "production"
rails_root = ENV['RAILS_ROOT'] || "/home/ubuntu/Projects/app"
God.watch do |w|
w.dir = "#{rails_root}"
w.name = "sidekiq"
w.interval = 30.seconds
w.env = {"RAILS_ENV" => rails_env}
w.interval = 30.seconds
w.start = "/home/ubuntu/.rvm/gems/ruby-1.9.3-p0/bin/ruby -f #{rails_root}/ sidekiq -c 25 -q worker,15 -q distributor,5"
w.uid = 'ubuntu'
# determine the state on startup
w.transition(:init, { true => :up, false => :start }) do |on|
on.condition(:process_running) do |c|
c.running = true
end
end
# determine when process has finished starting
w.transition([:start, :restart], :up) do |on|
on.condition(:process_running) do |c|
c.running = true
c.interval = 5.seconds
end
# failsafe
on.condition(:tries) do |c|
c.times = 5
c.transition = :start
c.interval = 5.seconds
end
end
# start if process is not running
w.transition(:up, :start) do |on|
on.condition(:process_running) do |c|
c.running = false
end
end
end
当我使用命令运行此脚本时god
,上帝服务器“显示进程未运行”,就好像什么都没发生一样。我相信我没有w.start
正确调用sidekiq,
我bundle exec sidekiq -c 25 -q worker,15 -q distributor,5
在开发模式下使用,它工作正常。
我错过了什么?是否有不同的方式来部署 sidekiq 工作人员?