Capistrano部署rails的失败错误 - bundle:找不到

时间:2023-01-31 18:24:57

This is the first time I am deploying and getting errors.

这是我第一次部署和获取错误。

here is my deploy.rb file require 'bundler/capistrano' set :application, "app"

这是我的deploy.rb文件需要'bundler / capistrano'设置:应用程序,“app”

set :scm, :git
set :repository,  "git@github.com:myname/#{application}.git"
set :branch, "master"

server "198.12.78.92", :web, :app, :db, primary: true
set :user, "myname"
set :deploy_to, "/home/#{user}/public_html/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false

default_run_options[:pty] = true
ssh_options[:forward_agent] = true

 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

Here is the error I am getting.

这是我得到的错误。

*** [deploy:update_code] rolling back
  * executing "rm -rf /home/myname/public_html/app/releases/20130313073408; true"
    servers: ["198.12.78.92"]
    [198.12.78.92] executing command
    command finished in 891ms
failed: "sh -c 'cp -RPp /home/myname/public_html/app/shared/cached-copy /home/myname/public_html/app/releases/20130313073408 && (echo dd92017bc8bb7f951df52d6a14c933e3033fd24b > /home/myname/public_html/app/releases/20130313073408/REVISION)'" on 198.12.78.92

EDIT - I have commented "set :deploy_via, :remote_cache" and now getting bundle: not found error though

编辑 - 我评论说“set:deploy_via,:remote_cache”,现在收到bundle:not found错误

3 个解决方案

#1


19  

OK It seems the answer is (see my comment to your question):

好的似乎答案是(参见我对你的问题的评论):

Have a recent rvm installed on both your workstation and the server (I have 1.17.1).

在您的工作站和服务器上安装了最近的rvm(我有1.17.1)。

add:

加:

gem 'rvm-capistrano'

to your Gemfile (inside group :development as the capistrano gem)

到您的Gemfile(内部组:开发为capistrano gem)

add:

加:

require "rvm/capistrano"
require "bundler/capistrano"

to your config/deploy.rb

到你的config / deploy.rb

That should do it

应该这样做

#2


11  

If using rbenv put this in .bashrc

如果使用rbenv将其放在.bashrc中

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

before the following line to capistrano load the environment even if connect with non-interactive shell

在以下行之前,capistrano加载环境,即使连接非交互式shell

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

probably will also work also with rvm initialization

也可能也适用于rvm初始化

#3


10  

I've had the same problems. Below is solution for RBenv and RVM.

我遇到了同样的问题。以下是RBenv和RVM的解决方案。

RBENV

RBENV

Install correctly RBenv. Install bundler gem. Pefrorm 'rbenv rehash'.

正确安装RBenv。安装bundler gem。 Pefrorm'rbenv rehash'。

Add to deploy.rb or deploy/.rb

添加到deploy.rb或deploy / .rb

set :default_environment, { 'PATH' => '$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH' }

RVM

RVM

Install correctly RVM. Install bundler gem.

正确安装RVM。安装bundler gem。

gem 'rvm-capistrano'

deloy.rb or deploy/.rb

deloy.rb或deploy / .rb

require 'rvm/capistrano'
set :rvm_ruby_string, 'ruby-2.0.0-p247' # Change to your ruby version
set :rvm_type, :system # :user if RVM installed in $HOME

For further configuration info read: https://github.com/wayneeseguin/rvm-capistrano

有关更多配置信息,请阅读:https://github.com/wayneeseguin/rvm-capistrano

Good luck.

祝你好运。

#1


19  

OK It seems the answer is (see my comment to your question):

好的似乎答案是(参见我对你的问题的评论):

Have a recent rvm installed on both your workstation and the server (I have 1.17.1).

在您的工作站和服务器上安装了最近的rvm(我有1.17.1)。

add:

加:

gem 'rvm-capistrano'

to your Gemfile (inside group :development as the capistrano gem)

到您的Gemfile(内部组:开发为capistrano gem)

add:

加:

require "rvm/capistrano"
require "bundler/capistrano"

to your config/deploy.rb

到你的config / deploy.rb

That should do it

应该这样做

#2


11  

If using rbenv put this in .bashrc

如果使用rbenv将其放在.bashrc中

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

before the following line to capistrano load the environment even if connect with non-interactive shell

在以下行之前,capistrano加载环境,即使连接非交互式shell

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

probably will also work also with rvm initialization

也可能也适用于rvm初始化

#3


10  

I've had the same problems. Below is solution for RBenv and RVM.

我遇到了同样的问题。以下是RBenv和RVM的解决方案。

RBENV

RBENV

Install correctly RBenv. Install bundler gem. Pefrorm 'rbenv rehash'.

正确安装RBenv。安装bundler gem。 Pefrorm'rbenv rehash'。

Add to deploy.rb or deploy/.rb

添加到deploy.rb或deploy / .rb

set :default_environment, { 'PATH' => '$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH' }

RVM

RVM

Install correctly RVM. Install bundler gem.

正确安装RVM。安装bundler gem。

gem 'rvm-capistrano'

deloy.rb or deploy/.rb

deloy.rb或deploy / .rb

require 'rvm/capistrano'
set :rvm_ruby_string, 'ruby-2.0.0-p247' # Change to your ruby version
set :rvm_type, :system # :user if RVM installed in $HOME

For further configuration info read: https://github.com/wayneeseguin/rvm-capistrano

有关更多配置信息,请阅读:https://github.com/wayneeseguin/rvm-capistrano

Good luck.

祝你好运。