capistrano 3如何在部署后运行runner命令?

时间:2018-03-04 16:47:50

标签: ruby-on-rails capistrano3

尝试做类似的事情:

task :refresh_leads do
    "bundle exec runner 'Leads.refresh'"
end

after :deploy, "runner refresh_leads"

这会返回成功,但实际上并没有运行。在部署之后,有人能指出我对跑步者任务的示例吗?

1 个答案:

答案 0 :(得分:2)

试试这个:

namespace :deploy do
  desc 'Refresh Leads'
  task :refresh_leads do
    on roles(:app), in: :sequence, wait: 5 do
      runner "Leads.refresh"
    end
  end
end

# The above restart task is not run by default
# Uncomment the following line to run it on deploys if needed
after 'deploy:publishing', 'deploy:refresh_leads'