1

如何使用gemqueue_classic在 EC2 上设置后台作业?rubber我尝试使用工头导出,但我不确定在哪里运行它(应用程序或网络角色?)。我失败的尝试是使用http://blog.sosedoff.com/2011/07/24/foreman-capistrano-for-rails-3-applications/

我应该创建一个新实例来运行这些作业吗?(或新角色?)

谢谢您的帮助!

4

1 回答 1

1

弄清楚了。

首先使用 queue_classic rake 任务创建一个 Procfile(参见http://blog.daviddollar.org/2011/05/06/introducing-foreman.html

然后我将工头添加到我的主机(确保您有该环境的 procfile,例如:Procfile.production)

# Foreman tasks
namespace :foreman do
  desc 'Export the Procfile to Ubuntu upstart scripts'
  task :export, :roles => :queue do

    run "cd #{release_path} && bundle exec foreman export upstart /etc/init -f ./Procfile.#{Rubber.env} -a #{application} -u #{user} -l #{release_path}/log/foreman"
  end

  desc "Start the application services"
  task :start, :roles => :queue do

    rsudo "start #{application}"
  end

  desc "Stop the application services"

  task :stop, :roles => :queue do
    rsudo "stop #{application}"

  end

  desc "Restart the application services"
  task :restart, :roles => :queue do
    rsudo "stop #{application}; start #{application}"
    #run "sudo start #{application} || sudo restart #{application}"
  end
end
after "deploy:update", "foreman:export"    # Export foreman scripts
before "deploy:restart", "foreman:restart"   # Restart application scripts
after "deploy:stop", "foreman:stop"   # Restart application scripts
于 2012-05-23T17:36:06.930 回答