Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Capistrano VPS部署错误_Ruby On Rails_Deployment_Rvm_Capistrano_Rvm Capistrano - Fatal编程技术网

Ruby on rails Capistrano VPS部署错误

Ruby on rails Capistrano VPS部署错误,ruby-on-rails,deployment,rvm,capistrano,rvm-capistrano,Ruby On Rails,Deployment,Rvm,Capistrano,Rvm Capistrano,我正在使用Capistrano部署到VPS。在mydeploy.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

我正在使用Capistrano部署到VPS。在my
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
在运行
capdeploy: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
命令。我按照说明()使用
root
用户在我的VPS上安装rvm、rubygem和rails

我还缺少什么

更新

我正在使用rvm capistrano,并使用创建的用户安装了所有内容,现在在部署时出现了一个不同的错误:cold:

执行“如果[-d/home/app/riffbox/shared/cached copy];则 /home/app/riffbox/shared/cached copy&&git fetch-q origin&&git fetch--tags-q origin&&git reset-q--hard 2afbd8fb661f62a01e0940be38e70915fc3e32ea和git清洁-q-d-x-f; else git克隆-qgit@bitbucket.org:xxx/iv.git /home/app/riffbox/shared/cached copy&&cd /home/app/riffbox/shared/cached copy&&git签出-q-b部署 2afbd8fb661f62a01e0940be38e70915fc3e32ea;fi“
服务器:[“198.199.74.146”]
密码:
[198.199.74.146]正在执行命令
**[198.199.74.146::err]致命:无法读取的密码 '':没有此类设备或地址
密码:
命令在7399ms内完成
*[deploy:update_code]回滚
*执行“rm-rf/home/app/riffbox/releases/201304142249;true”
服务器:[“198.199.74.146”]
[198.199.74.146]执行命令
命令在586ms内完成
**失败:“rvm_path=$HOME/.rvm/$HOME/.rvm/bin/rvm shell”1.9。3@myapp“-c”如果[-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清洁-q-d-x-f; else git克隆-qgit@bitbucket.org:xxx/iv.git /home/app/riffbox/shared/cached copy&&cd /home/app/riffbox/shared/cached copy&&git签出-q-b部署 198.199.74.146上的2afbd8fb661f62a01e0940be38e70915fc3e32ea;fi'

您应该使用gem,它将在部署期间允许您访问RVM环境


非常重要的一点是:
您正在使用根>代码>用户进行部署,直接使用<代码>根>代码>用户,这是一个糟糕的做法,您应该考虑使用每个应用程序的新用户。我在admin组中创建了一个新用户,但由于“错误:未安装Gem bundler”而无法使其工作。。我的问题是,在VPS上,我应该使用哪个用户(root用户或创建的用户)来安装rvm、ruby nginx等。是的,使用
root
创建的所有用户都在自找麻烦。