简体   繁体   中英

Deploy:symlink on capistrano points the “current” directory to previous release

I am using capistrano to deploy my Ruby on Rails project. I 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 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 .

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM