如何使Capistrano在deploy:create_symlink处停止失败? [英] How can I get Capistrano to stop failing at deploy:create_symlink?

查看:76
本文介绍了如何使Capistrano在deploy:create_symlink处停止失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

至少那是capistrano失败的地方。它贯穿了整个部署过程以及最后。

At least that's where it looks like capistrano is failing. It makes it all the way through the deployment and at the end. here is the output.

* executing `deploy:create_symlink'
* executing "rm -f ~/xxx.xx.xx/test/current && ln -s ~/xxx.xx.xx/test/releases/20120525193307 ~/xxx.xx.xx/test/current"
servers: ["test.xxx.xx.xx"]
["test.xxx.xx.xx"] executing command
 ** [out :: test.xxx.xx.xx] rm: cannot remove `/var/www/vhosts/xxx.xx.xx/test/current': I command finished in 460ms
*** [deploy:create_symlink] rolling back
*** no previous release to rollback to, rollback of symlink skipped
* executing "rm -rf /var/www/vhosts/xxx.xx.xx/test/releases/20120525195909; true"
servers: ["test.xxx.xx.xx"]
[test.xxx.xx.xx] executing command
command finished in 524ms
failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell 'default' -c 'rm -f /var/www/vhosts/xxx.xx.xx/test/current && ln -s /var/www/vhosts/xxx.xx.xx/test/releases/20120525195909 /var/www/vhosts/xxx.xx.xx/test/current'" on xxx.xx.xx

该应用程序正在使用
capistrano(2.12.0)
capistrano-ext(1.2.1)
很显然,还有更多的宝石试图将看起来有用的东西放进去,请告诉我更多信息会有所帮助。

the app is using capistrano (2.12.0) capistrano-ext (1.2.1) obviously there are more gems just trying to put what seems relevant, please let me know if more info would be helpful.

这是deploy.rb

Here is the deploy.rb

require "rvm/capistrano"
require 'bundler/capistrano'
require 'capistrano/ext/multistage'

set :stages, %w(staging production)
set :default_stage, 'staging'

set :application, 'xxx'

# trying to not use sudo on the deployment
#set :use_sudo, false

#set :copy_exclude, [".git", "spec"]

set :repository,  '~/git/xxx.git'
set :local_repository, "~/rorwork/xxx/.git"
set :scm, :git
set :user, 'xxx'
set :group, 'xxxx'
ssh_options[:forward_agent] = true
set :branch, 'master'
set :deploy_via, :remote_cache
set :scm_command, "/usr/local/bin/git"
set :local_scm_command, :default
default_run_options[:pty] = true
set :normalize_asset_timestamps, false #for asset piple

set :dbuser, 'xxx'
set :dbpass, 'xxx'

# if you want to clean up old releases on each deploy uncomment this:
# after "deploy:restart", "deploy:cleanup"

# if you're still using the script/reaper helper you will need
# these http://github.com/rails/irs_process_scripts

# If you are using Passenger mod_rails uncomment this:
 namespace :deploy do
   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

和staging.rb

and the staging.rb

set :domain, 'test.xxx.xx.xx'

role :web, domain                          # Your HTTP server, Apache/etc
role :app, domain                          # This may be the same as your `Web` server
role :db,  domain, :primary => true        # This is where Rails migrations will run

set :deploy_to, "/var/www/vhosts/xxx.xx.xx/test"
set :rails_env, 'staging'
set :rack_env, rails_env

set :dbname, "xxx_staging"

#set :bundle_without, [:test, :development, :production]

我在部署目录中手动创建当前,共享和发布文件夹并分配适当的用户:组。最初是在dirs上出现权限问题,但得到了解决。在这里有点无所适从,到目前为止,寻找解决方案的很多工作并没有带来任何收益。

i manually create the 'current', 'shared' and 'release' folders in the deploy dir and assign the appropriate user:group. originally was getting the permissions issues on dirs but got that sorted out. kinda at a loss here, much searching for solutions is netting nothing as of yet. any suggestions or experience here is much appreciated!

在测试盖帽登台部署时,我也将尝试生产。

in testing cap staging deploy thought i would try on production as well cap production deploy bails at the same time... something clever about consistency.

推荐答案

更新:找到它

删除当前目录,让capistrano创建到最新版本的当前符号链接。

Deleting the 'current' directory and letting capistrano create the 'current' symlink to the latest release fixed it.

我会尝试将其清除一点。我实际上是在创建当前文件夹,例如 mkdir当前文件夹。这只是阻碍了capistrano创建符号链接。尝试一下,创建一个名为 bob的文件夹,然后在同一目录中创建一个名为 bob的符号链接,并将其指向某个位置,这可能会将符号链接 bob放入目录 bob内。

I'll try to clear it up a bit. I was actually creating the folders 'current' and such, 'mkdir current' like. which just gets in the way of capistrano creating the symlinks. try it, make a folder called 'bob' then in the same directory make a symlink called 'bob' and point it somewhere it will probably put the symlink 'bob' inside the directory 'bob.'

当我删除当前共享等目录时,capistrano可以创建当前和其他必要的符号链接。因此,具体地删除当前目录可以使capistrano创建当前符号链接,该链接仅指向发布目录下的最新部署。

when i removed the 'current' 'shared' etc, directories, capistrano could create the 'current' and other necessary symlinks. So, concretely removing the 'current' directory allowed capistrano to create the 'current' symlink that just points to the latest deploy under the 'releases' dir.

请注意以下几点错误,这也是一个问题。

note the below error, which is also in the question.

** [out :: test.xxx.xx.xx] rm: cannot remove `/var/www/vhosts/xxx.xx.xx/test/current': I command finished in 460ms

失败的原因。我已经创建了名为当前的文件夹。这就是问题所在。它不应该是目录,应该是capistrano创建的符号链接。

the reason it failed. I had created the folder named 'current.' this is the problem. it is NOT supposed to be a directory, it is supposed to be a symlink that capistrano creates.

通过创建这些文件夹,它破坏了部署。删除这些文件夹后,capistrano可以创建相同名称的符号链接。此后一直航行顺利。

By creating those folders it broke the deploy. Removing those folders allowed capistrano to create the symlinks of the same name. Smooth sailing ever since.

这篇关于如何使Capistrano在deploy:create_symlink处停止失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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