首次使用Capistrano部署应用程序,但是在Rails 3.1.3,Capistrano 2.9.0,RVM 1.8.6和Ubuntu服务器10.10上运行cap deploy:update任务时遇到问题。 就我所知,这不应是权限问题。 现在,我一直对此感到震惊,感谢任何指示。

drphil@mumindalen:~/Rails/testapp$ cap deploy:update
  * executing `deploy:update'
 ** transaction: start
  * executing `deploy:update_code'
    executing locally: "git ls-remote git@my_server:~/testapp/ HEAD"
git@23.23.23.23.'s password: 
command finished in 8892ms
  * executing "git clone -q git@my_server:~/testapp/         /home/deploy/testapp/releases/20111211183654 && cd /home/deploy/testapp/releases/20111211183654 && git checkout -q -b deploy f473e207b15d73d2fa9aa32ab1dbeec98471153d && (echo f473e207b15d73d2fa9aa32ab1dbeec98471153d > /home/deploy/testapp/releases/20111211183654/REVISION)"
servers: ["my_server"]
Password: 
[my_server] executing command
command finished in 1695ms
* executing `deploy:finalize_update'
triggering before callbacks for `deploy:finalize_update'
* executing `deploy:assets:symlink'
* executing "rm -rf /home/deploy/testapp/releases/20111211183654/public/assets &&\\\n        mkdir -p /home/deploy/testapp/releases/20111211183654/public &&\\\n        mkdir -p /home/deploy/testapp/shared/assets &&\\\n        ln -s /home/deploy/testapp/shared/assets /home/deploy/testapp/releases/20111211183654/public/assets"
servers: ["my_server"]
[my_server] executing command
command finished in 1117ms
* executing "chmod -R g+w /home/deploy/testapp/releases/20111211183654"
servers: ["my_server"]
[my_server] executing command
command finished in 614ms
* executing "rm -rf /home/deploy/testapp/releases/20111211183654/log /home/deploy/testapp/releases/20111211183654/public/system /home/deploy/testapp/releases/20111211183654/tmp/pids &&\\\n      mkdir -p /home/deploy/testapp/releases/20111211183654/public &&\\\n      mkdir -p /home/deploy/testapp/releases/20111211183654/tmp &&\\\n      ln -s /home/deploy/testapp/shared/log /home/deploy/testapp/releases/20111211183654/log &&\\\n      ln -s /home/deploy/testapp/shared/system /home/deploy/testapp/releases/20111211183654/public/system &&\\\n      ln -s /home/deploy/testapp/shared/pids /home/deploy/testapp/releases/20111211183654/tmp/pids"
servers: ["my_server"]
[my_server] executing command
command finished in 1022ms
* executing "find /home/deploy/testapp/releases/20111211183654/public/images /home/deploy/testapp/releases/20111211183654/public/stylesheets /home/deploy/testapp/releases/20111211183654/pu## Heading ##blic/javascripts -exec touch -t 201112111837.12 {} ';'; true"
servers: ["my_server"]
[my_server] executing command
*** [err :: my_server] find:
*** [err :: my_server] "/home/deploy/testapp/releases/20111211183654/public/images"
*** [err :: my_server] : Filen eller katalogen finns inte
*** [err :: my_server] 
*** [err :: my_server] find:
*** [err :: my_server] "/home/deploy/testapp/releases/20111211183654/public/stylesheets"
*** [err :: my_server] : Filen eller katalogen finns inte
*** [err :: my_server] 
*** [err :: my_server] find:
*** [err :: my_server] "/home/deploy/testapp/releases/20111211183654/public/javascripts"
*** [err :: my_server] : Filen eller katalogen finns inte
*** [err :: my_server] 
command finished in 1024ms
triggering after callbacks for `deploy:update_code'
  * executing `deploy:assets:precompile'
  * executing "cd /home/deploy/testapp/releases/20111211183654 && rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
servers: ["my_server"]
[my_server] executing command
*** [err :: my_server] sh:
*** [err :: my_server] rake: not found
*** [err :: my_server] 
command finished in 1440ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/deploy/testapp/releases/20111211183654; true"
servers: ["my_server"]
[my_server] executing command
command finished in 727ms
failed: "sh -c 'cd /home/deploy/testapp/releases/20111211183654 && rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'" on my_server

===============>>#1 票数:4 已采纳

这是开发箱和服务器上不同版本的RVM的问题,并且我没有正确设置deploy.rb以使其与RVM一起使用。 经过数小时的挖掘,认为这是一种错误 那好吧。

在deploy.rb中使用以下命令使其正常工作:

$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :rvm_ruby_string, 'ruby-1.9.2-p290'
set :rvm_type, :user

===============>>#2 票数:0

它找不到rake二进制文件。 如果使用的是RVM,请确保要部署的用户保持在rvm组中。

或者,很可能(或与上述结合使用),您为非交互式外壳禁用了.bashrc / bashrc / profile环境。 因此,它不会加载所有配置(设置PATH等)。

参见http://lists.apple.com/archives/macos-x-server/2008/Jun/msg00251.html

Debian(/ etc / bashrc):

# System-wide .bashrc file for interactive bash(1) shells.

# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

...等等。 最后一行是问题。 退出非交互式shell的处理bashrc。 在您的系统上寻找类似的东西。

更新:

概述了在debian squeeze上处理的shell脚本: http : //www.fam.tuwien.ac.at/~schamane/_/blog : 110814_bash_shell_startup_files_in_debian_squeeze

  ask by Dr Philifjonkan translate from so

未解决问题?本站智能推荐: