如何在通过Capistrano部署后执行“命令行”实用程序?
问题描述:
存在对Capistrano的下面的代码部署:如何在通过Capistrano部署后执行“命令行”实用程序?
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
# Your restart mechanism here, for example:
execute :mkdir, '-p', "#{ release_path }/tmp"
execute :touch, release_path.join('tmp/restart.txt')
end
end
after :publishing, :restart
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end
end
我需要部署后执行“捆绑EXEC sidekiq -d”命令。我如何正确地做到这一点?提前致谢!
答
您可以在deploy.rb文件中运行shell命令。我通常不喜欢这样下面的“命名空间:部署做”:
task :bundle_sidekiq, :roles => :app do
run "bundle exec sidekiq -d"
end
然后,在你的deploy.rb文件的末尾,请执行下列操作,其中“富”可以是任何任务,自定义或内置在,称之为:
after 'deploy:foo', 'deploy:bundle_sidekiq'
大概[this](https://github.com/seuros/capistrano-sidekiq)可以帮助你! – GeekRiky 2015-03-13 06:46:37