标签: god

上帝停止resque工人耙

我在生产网站上使用Resque.

当我部署时,我希望GOD停止所有工作者然后重新启动它们,因为有时我们会更改类的代码并重新排队失败的作业.

问题是,当我做上帝停止resque,耙子实际上没有停止,工人仍然活着并使用旧代码,这为我创造了各种各样的问题.

即使我做"上帝终止",它也不会杀死工人.

现在,我正在使用shell脚本来杀死工作者,但由于我有多个服务器,所以在所有生产服务器上进行操作时,这几乎是一件痛苦的事.

这是我的上帝配置文件:

rails_env   = ENV['RAILS_ENV']  || "production"
rails_root  = ENV['RAILS_ROOT'] || "/mnt/data-store/html/gogobot/current"
num_workers = rails_env == 'production' ? 5 : 2

num_workers.times do |num|
  God.watch do |w|
    w.dir      = "#{rails_root}"
    w.name     = "resque-#{num}"
    w.group    = "resque"
    w.interval = 2.minutes
    w.env      = {"QUEUE"=>"duplicate_merging,facebook_wall_posts,generic,mailer,notifications,realtime,scoring_system,signup,social_graph_facebook,social_graph_foursquare,social_graph_twitter,user_info,user_score", "RAILS_ENV"=>rails_env, "PIDFILE" => "#{rails_root}/tmp/resque_#{w}.pid"}
    w.pid_file = "#{rails_root}/tmp/resque_#{w}.pid"
    w.start    = "cd #{rails_root}/ && rake environment resque:work QUEUE=duplicate_merging,facebook_wall_posts,generic,mailer,notifications,realtime,scoring_system,signup,social_graph_facebook,social_graph_foursquare,social_graph_twitter,user_info,user_score RAILS_ENV=#{rails_env}"
    w.log      = "#{rails_root}/log/resque_god.log"

    w.uid = 'root'
    w.gid = 'root'

    # restart if memory gets too high
    w.transition(:up, …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails god resque

6
推荐指数
1
解决办法
3005
查看次数

重新启动所有上帝的任务

这是上帝的重启命令的描述:restart <task or group name>。内置的初始化脚本会先杀死,然后开始。是否真的没有内置的方法可以向所有手表发送重启命令,无论它们是否分组?

ruby god

4
推荐指数
2
解决办法
2674
查看次数

上帝没有运行:服务器不可用(或者你没有权限访问它)

我正试图让上帝启动我的resque队列.但是,当我运行god load config/resque.god它返回The server is not available (or you do not have permissions to access it)

这是我的resque.god文件:

rails_env   = ENV['RAILS_ENV']  || "production"
rails_root  = ENV['RAILS_ROOT'] || "/Users/andrewlynch/sites/wellness/wellbot"
God.watch do |w|    
 w.name     = "resque-worker"
 w.group    = "resque"
 w.interval = 60.seconds
 w.dir = "#{rails_root}"
 w.start    = "RAILS_ENV=development QUEUE=* rake resque:work"
 w.start_grace = 30.seconds   
end
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails god resque

4
推荐指数
1
解决办法
2927
查看次数

监控redis与神 - 监控条件

我试图用上帝监视redis但是上帝试图重新启动它,即使它已经在运行.这是我的.god脚本(移植自http://blog.thomasmango.com/post/636319317/resque-in-production):

# Redis
%w{6379}.each do |port|
  God.watch do |w|
    w.name = "redis-server"
    w.interval = 30.seconds
    w.start = "/etc/init.d/redis-server start"
    w.stop = "/etc/init.d/redis-server stop"
    w.restart = "/etc/init.d/redis-server restart"
    w.start_grace = 10.seconds
    w.restart_grace = 10.seconds

    w.start_if do |start|
      start.condition(:process_running) do |c|
          c.interval = 5.seconds
          c.running = false
      end
    end
  end
end
Run Code Online (Sandbox Code Playgroud)

现在当我像这样开始上帝:

god -c /home/phlegx/workspace/projectx/config/god/config.god -D --log-level debug
Run Code Online (Sandbox Code Playgroud)

我得到以下输出:

I [2011-04-28 18:32:10]  INFO: Loading /home/phlegx/workspace/projectx/config/god/config.god
I [2011-04-28 18:32:10]  INFO: Syslog enabled.
I [2011-04-28 18:32:10]  INFO: Using pid file directory: /var/run/god …
Run Code Online (Sandbox Code Playgroud)

monitoring god redis

2
推荐指数
1
解决办法
1991
查看次数

我如何用上帝监控独立的应用程序?

我目前正在研究Rails/Ruby项目的过程监控选项,并且非常像上帝.

但我真的找不到任何关于如何监控多个应用程序(例如在一台机器上运行的2个rails项目)与上帝.

据我所知,我只是设置了神(系统红宝石)并让每个项目添加自己的配置(可能在某种程度上在deploy-hook中).这也适用于运行不同ruby版本(rbenv,rvm)或bundler的项目,因为god ruby​​不必访问任何项目代码.

有没有人像这样使用它?还是有更好的方法?

ruby god

1
推荐指数
1
解决办法
1035
查看次数

如何让工头开始上帝

我有一个像这样的Procfile:

web: bundle exec unicorn -c config/unicorn.rb -E production
god: god -c services.god
Run Code Online (Sandbox Code Playgroud)

但是foreman start god没有开始...它只是这样说:

17:14:32 god.1  | started with pid 29506
17:14:32 god.1  | exited with code 0
17:14:32 system | sending SIGTERM to all processes
SIGTERM received
Run Code Online (Sandbox Code Playgroud)

如果我跑god -c services.god,所有服务运行良好...
任何想法?
谢谢

ruby god ruby-on-rails-3 foreman

0
推荐指数
1
解决办法
1444
查看次数