我有一个 Rails 应用程序在 Capistrano 2.5.18 和 Rake 0.9.2.2 的机器上运行。部署工作得很好。
我在另一台运行 Capistrano 2.12.0 和 Rake 0.9.2.2 的机器上设置了相同的应用程序,它运行到一个点 - 复制文件等 - 但不运行我的后挂钩。
我读到了 deploy:symlink 任务被更改为 deploy:create_symlink 所以我更新了它。
这是精简的食谱...
set :ssh_options, { :forward_agent => true }
set :use_sudo, true
set :deploy_via, :copy
set :copy_strategy, :export
set :copy_compression, :gzip
on :load, 'max:deploy:ask_env'
after 'deploy:create_symlink', 'max:deploy:finalize_update' # DOESN'T WORK!!
namespace :deploy do
task :restart do
run "#{sudo :as => admin_runner} touch #{current_path}/tmp/restart.txt"
end
end
namespace :max do
[...]
namespace :deploy do
# NEVER CALLED!!!
desc "Finalizes update by setting permissions"
task :finalize_update do
run "chgrp -R #{admin_group} #{current_release}; exit 0"
end
end
[...]
end
运行脚本时的最后一点输出看起来像......
* executing `deploy:create_symlink'
* executing "rm -f /home/s-exer1/webapps/max-shared-desktop/application_home/current && ln -s /home/s-exer1/webapps/max-shared-desktop/application_home/releases/20121031124115 /home/s-exer1/webapps/max-shared-desktop/application_home/current"
servers: ["vaomb81"]
[vaomb81] executing command
command finished in 97ms
** transaction: commit
* executing `deploy:restart'
* executing "sudo -p 'sudo password: ' -u s-exer1 touch /home/s-exer1/webapps/max-shared-desktop/application_home/current/tmp/restart.txt"
deploy:create_symlink 任务运行,然后跳转到 deploy:restart - 跳过我的后挂钩。
关于可能导致这种情况的任何建议?
谢谢