【发布时间】:2016-07-04 01:11:06
【问题描述】:
我已经设置了 Capistrano,一切工作正常,除了 Capistrano 在部署后没有重新启动乘客。部署后的 Eveytime 我必须通过 ssh 进入服务器并在 current directory 中输入 touch tmp/restart.txt。我尝试了不同的方法来重新启动乘客,但没有任何东西对我有用。
first attempt:
namespace :deploy do
task :restart do
on roles(:app) do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
end
second attempt
namespace :deploy do
task :restart do
on roles(:app) do
within current_path do
execute :touch, 'tmp/restart.txt'
end
end
end
end
third attempt
namespace :deploy do
task :restart do
run "touch #{current_path}/tmp/restart.txt"
end
end
我在 stackoverflow 中发现上面的代码 sn-ps 与我的问题类似,但它们都没有重新启动服务器。
我正在使用 capistrano (3.4.0) 和 Rails 4(nginx + 乘客)
【问题讨论】: