繁体   English   中英

Capistrano VPS部署错误

[英]Capistrano VPS deploy error

我正在使用Capistrano部署到VPS。 在我的deploy.rb

require "bundler/capistrano"
server "xxx.xxx.xx.xxx", :web, :app, :db, primary: true
set :application, "riffbox"
set :user, "root"
set :deploy_to, "/home/#{user}/apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false
set :scm, "git"
set :repository, "https://xxxx@bitbucket.org/xxxx/iv.git"
set :branch, "master"
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
after "deploy", "deploy:cleanup" # keep only the last 5 releases

而且在运行cap deploy:cold时出现以下错误:

  * 2013-04-13 22:59:38 executing `bundle:install'
  * executing "cd /home/root/apps/riffbox/releases/20130413105936 && bundle install --gemfile /home/root/apps/riffbox/releases/20130413105936/Gemfile --path /home/root/apps/riffbox/shared/bundle --deployment --quiet --without development test"
    servers: ["198.199.74.146"]
    [198.199.74.146] executing command
 ** [out :: 198.199.74.146] **ERROR: Gem bundler is not installed, run `gem install bundler` first.**
 ** [out :: 198.199.74.146] 
    command finished in 915ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/root/apps/riffbox/releases/20130413105936; true"
    servers: ["198.199.74.146"]
    [198.199.74.146] executing command
    command finished in 907ms
**failed: "sh -c 'cd /home/root/apps/riffbox/releases/20130413105936 && bundle install --gemfile /home/root/apps/riffbox/releases/20130413105936/Gemfile --path /home/root/apps/riffbox/shared/bundle --deployment --quiet --without development test'" on 198.199.74.146**

我看到有两个错误,找不到Bundler ,另一个错误无法运行sh命令。 我按照说明( https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm )安装使用root用户在我的VPS上的rvm,rubygem和rails。

我还想念什么?

更新资料

我正在使用rvm-capistrano,并使用创建的用户安装了所有程序,并且在deploy:cold时出现了另一个错误:

执行“如果[-d / home / app / riffbox / shared / cached-copy];然后cd / home / app / riffbox / shared / cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 2afbd8fb661f62a01e0940be38e70915fc3e32ea && git clean -q -d -x -f;否则git clone -q git@bitbucket.org:xxx / iv.git / home / app / riffbox / shared / cached-copy && cd / home / app / riffbox / shared / cached-copy && git checkout -q -b deploy 2afbd8fb661f62a01e0940be38e70915fc3e32ea; fi“
服务器:[“ 198.199.74.146”]
密码:
[198.199.74.146]执行命令
** [198.199.74.146 ::错误] 致命:无法读取“ https://xxx@bitbucket.org ”的密码:无此设备或地址
密码:
命令在7399毫秒内完成
* [deploy:update_code]回滚
*执行“ rm -rf / home / app / riffbox / releases / 20130414224249; true”
服务器:[“ 198.199.74.146”]
[198.199.74.146]执行命令
指令在586毫秒内完成
**失败:“ rvm_path = $ HOME / .rvm / $ HOME / .rvm / bin / rvm-shell'1.9.3@myapp'-c'if [-d / home / app / riffbox / shared / cached-copy ];然后cd / home / app / riffbox / shared / cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 2afbd8fb661f62a01e0940be38e70915fc3e32ea && git clean -q -d -x- f;否则git clone -q git@bitbucket.org:xxx / iv.git / home / app / riffbox / shared / cached-copy && cd / home / app / riffbox / shared / cached-copy && git checkout -q- b在198.199.74.146上部署2afbd8fb661f62a01e0940be38e70915fc3e32ea; fi'“

您应该使用rvm-capistrano gem,它将在部署期间为您提供对RVM环境的访问。


一个非常重要的注意事项:

您正在使用root用户进行部署,这是整体不好的做法,直接使用root用户,你应该考虑每个应用程序使用一个新的用户。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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