我注意到在cap deploy:update的输出中,它正在触发“deploy:assets:precompile”作为deploy的后回调:update_code:
triggering after callbacks for `deploy:update_code'
* 2013-05-15 11:32:16 executing `deploy:assets:precompile'
triggering before callbacks for `deploy:assets:precompile'
* 2013-05-15 11:32:16 executing `deploy:assets:update_asset_mtimes'
* executing "[ -e /home/johnmerlino/public_html/store.johnmerlino.com/shared/assets/manifest* ] && cat /home/johnmerlino/public_html/store.johnmerlino.com/shared/assets/manifest* || echo"
servers: ["xxx.xx.xx.xxx"]
[xxx.xx.xx.xxx] executing command
command finished in 314ms
* executing "cd -- /home/johnmerlino/public_html/store.johnmerlino.com/releases/20130515153214 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
servers: ["xxx.xx.xx.xxx"]
[xxx.xx.xx.xxx] executing command
** [out :: xxx.xx.xx.xxx] rake aborted!
** [out :: xxx.xx.xx.xxx] No such file or directory - /home/johnmerlino/public_html/store.johnmerlino.com/releases/20130515153214/config/config.yml
** [out :: xxx.xx.xx.xxx
现在的问题是它说最新版本没有“config.yml”文件。
实际上在我的capistrano脚本中,该文件是在“deploy:update_code”之后创建的:
after "deploy:update_code", "deploy:symlink_shared_configs"
namespace :deploy do
desc "Symlink configuration files"
task :symlink_shared_configs, :roles => [:db,:app] do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
run "ln -nfs #{shared_path}/config/config.yml #{release_path}/config/config.yml"
end
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
所以不应该在这个时候创建config.yml吗?
答案 0 :(得分:0)
如果在after deploy:update_code
的回调列表中触发了两者,则它们基本上是同一回调组的一部分,但调用同一组中回调的顺序取决于on the implementation of the callback registration and execution。
如果您需要它们以给定的顺序运行,那么您可以通过稍后移动assets:precompile
来显式更改,或者更早地移动config.yml
文件,以保证在after deploy:update_code
之前其他
现在看来,既然他们都以 ...before...
deploy:update_code
...after... | after group
deploy:symlink_shared_configs | after group
deploy:assets:precompile | after group
的顺序运行,他们执行的顺序可能是:
...before...
deploy:update_code
...after... | after group
deploy:assets:precompile | after group
deploy:symlink_shared_configs | after group
... ... OR
{{1}}
...并且基于您发布此问题的事实,听起来后一个实例正在为您而发生。