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

问题描述 投票:0回答:1

尝试做类似的事情:

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

after :deploy, "runner refresh_leads"

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

ruby-on-rails capistrano3
1个回答
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'
© www.soinside.com 2019 - 2024. All rights reserved.