Ruby on rails 如何从Capistrano启动1名生产工人?
我已经安装了Redis/Resque,但在部署时,我很难从Capistrano启动/重新启动它 我的需求相当简单:我只有一个队列,只需要一个工人,而且我没有使用monit或god 基于,my deploy.rb具有以下特性:Ruby on rails 如何从Capistrano启动1名生产工人?,ruby-on-rails,ruby-on-rails-3,capistrano,background-process,resque,Ruby On Rails,Ruby On Rails 3,Capistrano,Background Process,Resque,我已经安装了Redis/Resque,但在部署时,我很难从Capistrano启动/重新启动它 我的需求相当简单:我只有一个队列,只需要一个工人,而且我没有使用monit或god 基于,my deploy.rb具有以下特性: namespace :deploy do task :start do ; end task :stop do ; end task :restart, :roles => :app, :except => { :no_release => t
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
task :restart_resque do
pid_file = "#{shared_path}/pids/resque.pid"
run "test -f #{pid_file} && cd #{current_path} && kill -s QUIT `cat #{pid_file}` || rm -f #{pid_file}"
run "cd #{current_path}; RAILS_ENV=production QUEUE='*' VERBOSE=1 nohup rake environment resque:work& > #{shared_path}/log/resque.log && echo $! > #{pid_file}"
end
end
after 'deploy:restart', 'deploy:restart_resque'
我的resque.rake文件(基于Railscast)具有:
当我
capdeploy
时,一切似乎都正常,但当我查看resque web时,没有工作人员在运行 我建议你看看这个,并提出一些建议
require "resque/tasks"
task "resque:setup" => :environment