Capistrano上的Deploy:symlink指向“当前”目录。先前版本的目录 [英] Deploy:symlink on capistrano points the "current" directory to previous release

查看:93
本文介绍了Capistrano上的Deploy:symlink指向“当前”目录。先前版本的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用capistrano部署我的Ruby on Rails项目。我使用的是Dreamhost VPS,自几周前以来,在Capistrano或乘客上没有任何变化,我开始在部署过程中遇到了一个奇怪的问题:

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:

每次capistrano在部署我的应用程序时,一切正常,除了deploy:symlink(默认情况下被调用)之外,应该将当前目录指向最新版本。尽管新版本已正确部署到版本目录中,但问题是当前符号链接始终设置为先前版本,而不是新版本。因此,我可以部署应用程序,但我总是必须连续运行两次部署。

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.

您可以在此处查看capistrano日志:
http://img715.imageshack.us/img715/7803/capistranoproblemb.png

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?

谢谢!

推荐答案

我通过其他部署任务解决了此问题,该任务使用不同的内部变量名称以及最新发行版的正确路径(release_path而不是latest_path或类似的名称)来重新创建符号链接

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"

这篇关于Capistrano上的Deploy:symlink指向“当前”目录。先前版本的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆