Deploy:symlink on capistrano points the "current" directory to previous release
I am using capistrano to deploy my Ruby on Rails project. I开发者_JAVA百科 am on a Dreamhost VPS and since a few weeks ago, with no change in capistrano or passenger, I began to experience a strange problem with the deployment:
Every time capistrano is deploying my application, everything goes right except deploy:symlink (which is called by default) that should point the "current" directory to the newest release. Although the new release is deployed properly to the "releases" directory, the problem is the "current" symlink is always set to previous release instead of the new one. So I can deploy apps but I always have to run the deploy two times in a row.
You can see the capistrano log here: http://img715.imageshack.us/img715/7803/capistranoproblemb.png
Has anybody else experienced this before or can help me solve it?
Thanks!
I solved this with an additional deploy task that recreates the symlink using a different internal variable name with the correct path to the latest release (release_path instead of latest_path or something like that).
namespace :deploy do
desc "Recreate symlink"
task :resymlink, :roles => :app do
run "rm -f #{current_path} && ln -s #{release_path} #{current_path}"
end
end
after "deploy:create_symlink", "deploy:resymlink", "deploy:update_crontab"
I think @foresth's answer is not a good solution.
I think what happens is that you're experiencing this horrible bug of capistrano.
The way to work-around the bug is the following: DO NOT READ THE latest_release
VARIABLE BEFORE THE TASK deploy
HAPPENS.
精彩评论