- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经为此苦苦挣扎了一段时间,启动 resque 和 resque 调度程序等后台进程的正确方法是什么?使用上帝是不是矫枉过正?
目前我正试图让上帝工作,但我不确定 *.god conf 文件是否应该在应用程序的目录或其他地方。
这就是我使用的:
config
|- app.god
|- God
|- resque.god
|- resque_scheduler.god
# config/god/resque.god
rails_env = ENV['RAILS_ENV'] || raise(ArgumentError, "RAILS_ENV not defined")
rails_root = ENV['RAILS_ROOT'] || File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
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 = 30.seconds
w.env = {"QUEUE"=>"*", "RAILS_ENV"=>rails_env, "BUNDLE_GEMFILE"=>"#{rails_root}/Gemfile"}
w.start = "/usr/bin/rake -f #{rails_root}/Rakefile environment resque:work"
w.log = "#{rails_root}/log/resque-scheduler.log"
... start/stop methods ...
end
end
/home/myapp/apps/myapp_production/current
# config/deploy.rb
after "deploy:restart", "god:restart"
namespace :god do
def try_killing_resque_workers
run "pkill -3 -f resque"
rescue
nil
end
desc "Restart God gracefully"
task "restart", :roles => :app do
god_config_path = File.join(release_path, 'config', 'app.god')
begin
# Throws an exception if god is not running.
run "cd #{release_path}; bundle exec god status && RAILS_ENV=#{rails_env} RAILS_ROOT=#{release_path} bundle exec god load #{god_config_path} && bundle exec god start resque"
# Kill resque processes and have god restart them with the newly loaded config.
try_killing_resque_workers
rescue => ex
# god is dead, workers should be as well, but who knows.
try_killing_resque_workers
# Start god.
run "cd #{release_path}; RAILS_ENV=#{rails_env} bundle exec god -c #{god_config_path}"
end
end
end
god status
它什么也不返回,但如果我运行
god --version
它返回版本。
最佳答案
您是否设置了 init.d 脚本?
你有上帝在运行吗?
/etc/init.d/god status
/usr/bin/god -c /etc/god/conf.god -D
关于ruby-on-rails - 在生产中监控 ruby 后台进程(如 Resque)的正确方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15490154/
我用coffee-resque创建了一些worker,并尝试使用resque-web的ruby版本查看worker,但只看到间歇性的worker闪进闪出。 我注意到咖啡风格在暂停时会取消对 worke
假设这是我的 worker : class FooWorker @queue = :foo def self.perform User.all.each do |u| ..
我对 resque 很陌生,但它看起来非常适合我的需求。 实际上,我正在尝试设置一个简单的测试应用程序,例如: require 'resque' require 'resque/job_with_st
我正在使用 Resque 和 Resque 调度程序,但是当我输入命令时 resque-web它没有运行。而是提示错误: bash: resque-web: command not found So
我正在使用 ruby on rails 构建一个 webapp,它需要在后台运行 C++ exe 程序。我为此比较了 3 个最常用的 gem(Delayed_Jobs、Resque、Sidekiq
我想知道 resque-scheduler 是否需要一个 resque 实例来运行特定队列中的作业,或者 resque-scheduler 必须使用 resque:work 任务。 提前致谢。 最佳答
我正在使用 Resque、Resque-Status 和 Resque-Retry 来处理 bkg 作业。以下是一个示例作业。它针对 4-5 个模型执行查询。现在我想尝试使用 Sidekiq它以其超过
我正在开发一个使用 resque 的 rails 应用程序和 resque-scheduler 安排电子邮件发送。 有没有办法获得所有预定作业的列表,或者更好的具有特定参数的作业列表? 我尝试了一些类
将 Resque 与 Redis 结合使用 我一直收到 Redis 的 OOM 命令在使用内存时不允许 > 'maxmemory' 错误。现在很明显,我似乎应该将 redis 的内存从当前的 500M
此外,管理内置“管理结构”(如标题中的结构)的 Resque 的最佳实践是什么?我应该用 jedis.del(String key) 或类似的东西清除它们吗? 最佳答案 resque:failed 是
我有 resque-scheduler 在 Rails 应用程序中运行良好。现在我需要能够从队列中跟踪状态并删除作业。我简要地查看了 resque-status,据我所见,如果我能让它与 resque
我都关注了 instructions on resque-scheduler repo在 resque-web 界面上显示“延迟”和“计划”选项卡,但什么也没有! 这是进口的 gem : gem 'r
我已经为我的应用程序设置了 Resque.redis.namespace,现在 resque-web 不再显示工作人员和队列。 有什么方法可以让 resque-web 知道 redis.namespa
我一直试图让 Resque(使用 Resque 服务器)和 RedisToGo 在 heroku(cedar)上工作一段时间,但我一直遇到这个错误: Redis::CannotConnectError
我在 resque 工作中遇到了一个奇怪的问题,我想知道是否有其他人遇到过。 我们在 jruby 1.6.2 下运行 resque 我们有一个长时间 运行任务,它从各种 URL 下载一堆文件,使用 F
我刚刚看了这个关于 Resque 的惊人的 railscast .在我启动 redis 服务器并启动 workers 之后: rake environment resque:work QUEUE="*
我使用 resque-history 插件来监控已完成的任务。 首先,我将这个字符串 require 'resque-history/server' 包含到路由文件中,然后我在仪表板中看到了新的历史记
我需要启动 4 个 resque 工作人员,所以我使用了以下命令 bundle exec rake environment resque:workers RAILS_ENV=production CO
我有几个 Resque 作业在运行,每个都在一个单独的终端窗口中启动,如下所示: QUEUE=queue_1 rake environment resque:work QUEUE=queue_2 ra
我有以下代码。它的工作是根据通过浏览器(使用 Sinatra)提供的数据发送电子邮件。它会在 20 秒后向给定的地址发送一封电子邮件。当我运行该程序时,它会立即发送电子邮件,而无需等待时间。谁能帮我解
我是一名优秀的程序员,十分优秀!