用 capistrano + rbenv 按照 railscasts #335 Deploying to a VPS 所提示的流程进行的 VPS 的部署。
但是每当我在 Gemfile 里面添加一个新的 gem 之后再部署的时候就会有问题。比如这次我添加了 devise 然后执行 cap deploy
之后就报错说 'bcrypt-ruby' 没有安装成功,要我在 vps 上 gem install bcrypt-ruby
,我照做了,再次执行 cap deploy
依然报同样的错误。google 了半天,还没找到解决问题的办法...求助~
#1 楼 @Ddl1st cap deploy 会执行 bundle install 的吧, 报错显示在 执行
executing "cd /home/deployer/apps/get-real/releases/20130221144137 && bundle install --gemfile /home/deployer/apps/get-real/releases/20130221144137/Gemfile --path /home/deployer/apps/get-real/shared/bundle --deployment --quiet --without development test"
的时候报错的。
*** [deploy:update_code] rolling back
* executing "rm -rf /home/deployer/apps/get-real/releases/20130221150248; true"
相当宇什么事情都没有做唉
servers: ["ali"]
[ali] executing command
** [out :: ali] Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
** [out :: ali]
** [out :: ali]
** [out :: ali] /usr/bin/ruby1.9.1 extconf.rb
** [out :: ali]
** [out :: ali]
** [out :: ali] Gem files will remain installed in /home/deployer/apps/get-real/shared/bundle/ruby/1.9.1/gems/bcrypt-ruby-3.0.1 for inspection.
** [out :: ali]
** [out :: ali] Results logged to /home/deployer/apps/get-real/shared/bundle/ruby/1.9.1/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out
** [out :: ali]
** [out :: ali] An error occurred while installing bcrypt-ruby (3.0.1), and Bundler cannot continue.
** [out :: ali]
** [out :: ali] Make sure that `gem install bcrypt-ruby -v '3.0.1'` succeeds before bundling.
** [out :: ali]
安装了 gem 当然要重启,不过这和部署没关系啊,你 gem 安装好后,执行 cap deploy 应该是没问题的。cap deploy 默认是执行 update 然后是 restart