Coder Social home page Coder Social logo

rvm's Introduction

Capistrano: A deployment automation tool built on Ruby, Rake, and SSH.

Gem Version Build Status Code Climate CodersClan

Capistrano is a framework for building automated deployment scripts. Although Capistrano itself is written in Ruby, it can easily be used to deploy projects of any language or framework, be it Rails, Java, or PHP.

Once installed, Capistrano gives you a cap tool to perform your deployments from the comfort of your command line.

$ cd my-capistrano-enabled-project
$ cap production deploy

When you run cap, Capistrano dutifully connects to your server(s) via SSH and executes the steps necessary to deploy your project. You can define those steps yourself by writing Rake tasks, or by using pre-built task libraries provided by the Capistrano community.

Tasks are simple to make. Here's an example:

task :restart_sidekiq do
  on roles(:worker) do
    execute :service, "sidekiq restart"
  end
end
after "deploy:published", "restart_sidekiq"

Note: This documentation is for the current version of Capistrano (3.x). If you are looking for Capistrano 2.x documentation, you can find it in this archive.


Contents

Features

There are many ways to automate deployments, from simple rsync bash scripts to complex containerized toolchains. Capistrano sits somewhere in the middle: it automates what you already know how to do manually with SSH, but in a repeatable, scalable fashion. There is no magic here!

Here's what makes Capistrano great:

Strong conventions

Capistrano defines a standard deployment process that all Capistrano-enabled projects follow by default. You don't have to decide how to structure your scripts, where deployed files should be placed on the server, or how to perform common tasks: Capistrano has done this work for you.

Multiple stages

Define your deployment once, and then easily parameterize it for multiple stages (environments), e.g. qa, staging, and production. No copy-and-paste necessary: you only need to specify what is different for each stage, like IP addresses.

Parallel execution

Deploying to a fleet of app servers? Capistrano can run each deployment task concurrently across those servers and uses connection pooling for speed.

Server roles

Your application may need many different types of servers: a database server, an app server, two web servers, and a job queue work server, for example. Capistrano lets you tag each server with one or more roles, so you can control what tasks are executed where.

Community driven

Capistrano is easily extensible using the rubygems package manager. Deploying a Rails app? Wordpress? Laravel? Chances are, someone has already written Capistrano tasks for your framework of choice and has distributed it as a gem. Many Ruby projects also come with Capistrano tasks built-in.

It's just SSH

Everything in Capistrano comes down to running SSH commands on remote servers. On the one hand, that makes Capistrano simple. On the other hand, if you aren't comfortable SSH-ing into a Linux box and doing stuff on the command-line, then Capistrano is probably not for you.

Gotchas

While Capistrano ships with a strong set of conventions that are common for all types of deployments, it needs help understanding the specifics of your project, and there are some things Capistrano is not suited to do.

Project specifics

Out of the box, Capistrano can deploy your code to server(s), but it does not know how to execute your code. Does foreman need to be run? Does Apache need to be restarted? You'll need to tell Capistrano how to do this part by writing these deployment steps yourself, or by finding a gem in the Capistrano community that does it for you.

Key-based SSH

Capistrano depends on connecting to your server(s) with SSH using key-based (i.e. password-less) authentication. You'll need this working before you can use Capistrano.

Provisioning

Likewise, your server(s) will likely need supporting software installed before you can perform a deployment. Capistrano itself has no requirements other than SSH, but your application probably needs database software, a web server like Apache or Nginx, and a language runtime like Java, Ruby, or PHP. These server provisioning steps are not done by Capistrano.

sudo, etc.

Capistrano is designed to deploy using a single, non-privileged SSH user, using a non-interactive SSH session. If your deployment requires sudo, interactive prompts, authenticating as one user but running commands as another, you can probably accomplish this with Capistrano, but it may be difficult. Your automated deployments will be much smoother if you can avoid such requirements.

Shells

Capistrano 3 expects a POSIX shell like Bash or Sh. Shells like tcsh, csh, and such may work, but probably will not.

Quick start

Requirements

  • Ruby version 2.0 or higher on your local machine (MRI or Rubinius)
  • A project that uses source control (Git, Mercurial, and Subversion support is built-in)
  • The SCM binaries (e.g. git, hg) needed to check out your project must be installed on the server(s) you are deploying to
  • Bundler, along with a Gemfile for your project, are recommended

Install the Capistrano gem

Add Capistrano to your project's Gemfile using require: false:

group :development do
  gem "capistrano", "~> 3.17", require: false
end

Then run Bundler to ensure Capistrano is downloaded and installed:

$ bundle install

"Capify" your project

Make sure your project doesn't already have a "Capfile" or "capfile" present. Then run:

$ bundle exec cap install

This creates all the necessary configuration files and directory structure for a Capistrano-enabled project with two stages, staging and production:

├── Capfile
├── config
│   ├── deploy
│   │   ├── production.rb
│   │   └── staging.rb
│   └── deploy.rb
└── lib
    └── capistrano
            └── tasks

To customize the stages that are created, use:

$ bundle exec cap install STAGES=local,sandbox,qa,production

Note that the files that Capistrano creates are simply templates to get you started. Make sure to edit the deploy.rb and stage files so that they contain values appropriate for your project and your target servers.

Command-line usage

# list all available tasks
$ bundle exec cap -T

# deploy to the staging environment
$ bundle exec cap staging deploy

# deploy to the production environment
$ bundle exec cap production deploy

# simulate deploying to the production environment
# does not actually do anything
$ bundle exec cap production deploy --dry-run

# list task dependencies
$ bundle exec cap production deploy --prereqs

# trace through task invocations
$ bundle exec cap production deploy --trace

# lists all config variable before deployment tasks
$ bundle exec cap production deploy --print-config-variables

Finding help and documentation

Capistrano is a large project encompassing multiple GitHub repositories and a community of plugins, and it can be overwhelming when you are just getting started. Here are resources that can help:

Related GitHub repositories:

  • capistrano/sshkit provides the SSH behavior that underlies Capistrano (when you use execute in a Capistrano task, you are using SSHKit)
  • capistrano/rails is a very popular gem that adds Ruby on Rails deployment tasks
  • mattbrictson/airbrussh provides Capistrano's default log formatting

GitHub issues are for bug reports and feature requests. Please refer to the CONTRIBUTING document for guidelines on submitting GitHub issues.

If you think you may have discovered a security vulnerability in Capistrano, do not open a GitHub issue. Instead, please send a report to [email protected].

How to contribute

Contributions to Capistrano, in the form of code, documentation or idea, are gladly accepted. Read the DEVELOPMENT document to learn how to hack on Capistrano's code, run the tests, and contribute your first pull request.

License

MIT License (MIT)

Copyright (c) 2012-2020 Tom Clements, Lee Hambley

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

rvm's People

Contributors

aackerman avatar bretweinraub avatar cheald avatar jeremymarc avatar kernow avatar kirs avatar kotfu avatar mpapis avatar seenmyfate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rvm's Issues

Could not locate Gemfile in rvm:check

Hello,

I'm running git co config/deploy/production.rb

And I'm getting:

> git co config/deploy/production.rb
[email protected] ~/Projects/backersclub/backersclub +master
> cap production rvm:check
DEBUG [6d7e1ead] Running /usr/local/rvm/bin/rvm version on backersclub.com
DEBUG [6d7e1ead] Command: /usr/local/rvm/bin/rvm version
DEBUG [6d7e1ead]
DEBUG [6d7e1ead]    rvm 1.22.12 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
DEBUG [6d7e1ead]
DEBUG [6d7e1ead] Finished in 2.271 seconds with exit status 0 (successful).
rvm 1.22.12 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
DEBUG [cbf0c644] Running /usr/local/rvm/bin/rvm current on backersclub.com
DEBUG [cbf0c644] Command: /usr/local/rvm/bin/rvm current
DEBUG [cbf0c644]    ruby-1.9.3-p448
DEBUG [cbf0c644] Finished in 0.790 seconds with exit status 0 (successful).
ruby-1.9.3-p448
DEBUG [608b2c8c] Running /usr/local/rvm/bin/rvm ruby-1.9.3-p448 do bundle exec ruby --version on backersclub.com
DEBUG [608b2c8c] Command: /usr/local/rvm/bin/rvm ruby-1.9.3-p448 do bundle exec ruby --version
DEBUG [608b2c8c]    Could not locate Gemfile

I think it's bug since it needs to run this into the path of the project.
Can you please help me fix this or instruct me on writting a patch?

Thanks,
Bogdan

Using `rvm x.x` with RVM 1.25.14

I updated the target server to the latest version of RVM today:

$ rvm --version

rvm 1.25.14 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]

Since upgrading, the deployment recipe I'm using has stopped working:

 INFO [7a0dd7de] Running /usr/local/rvm/bin/rvm 2.1.0
 do bundle --gemfile /redacted/releases/20140115024320/Gemfile --path /redacted/shared/bundle --deployment --quiet --binstubs /redacted/shared/bin --without development test on redacted.example.com
DEBUG [7a0dd7de] Command: cd /redacted/releases/20140115024320 && /usr/local/rvm/bin/rvm 2.1.0
 do bundle --gemfile /redacted/releases/20140115024320/Gemfile --path /redacted/shared/bundle --deployment --quiet --binstubs /redacted/shared/bin --without development test
DEBUG [7a0dd7de]  RVM is not a function, selecting rubies with 'rvm use ...' will not work.
DEBUG [7a0dd7de]  
DEBUG [7a0dd7de]  You need to change your terminal emulator preferences to allow login shell.
DEBUG [7a0dd7de]  Sometimes it is required to use `/bin/bash --login` as the command.
DEBUG [7a0dd7de]  Please visit https://rvm.io/integration/gnome-terminal/ for a example.

I notice in #34, the call to rvm has been replaced with rvm-auto.sh, so potentially this issue won't arise when that PR is merged.

RVM:Check fails on bundle install ruby --version

Hello,

Could you please help me with the following issue?

Currently I'm deploying my solution to a new service. However I'm stuck with my deployment - whenever I execute:

cap production rvm:check

I get the following error:

rustems-mbp:mustela rbedretdinov$ cap production rvm:check
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/bundler-1.6.1/lib/bundler.rb:301: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
DEBUG [a88712ee] Running /usr/bin/env [ -d ~/.rvm ] on 188.226.217.83
DEBUG [a88712ee] Command: [ -d ~/.rvm ]
DEBUG [a88712ee] Finished in 1.298 seconds with exit status 0 (successful).
DEBUG [1e573947] Running ~/.rvm/bin/rvm version on 188.226.217.83
DEBUG [1e573947] Command: ~/.rvm/bin/rvm version
cap aborted!
rvm stdout: Nothing written
rvm stderr: Nothing written
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/sshkit-1.2.0/lib/sshkit/command.rb:94:in `exit_status='
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/sshkit-1.2.0/lib/sshkit/backends/netssh.rb:138:in `block (4 levels) in _execute'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:551:in `call'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:551:in `do_request'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:561:in `channel_request'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:205:in `process'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:269:in `wait'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/sshkit-1.2.0/lib/sshkit/backends/netssh.rb:160:in `block (2 levels) in _execute'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:514:in `call'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:205:in `process'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/sshkit-1.2.0/lib/sshkit/backends/netssh.rb:162:in `block in _execute'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/sshkit-1.2.0/lib/sshkit/backends/netssh.rb:119:in `tap'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/sshkit-1.2.0/lib/sshkit/backends/netssh.rb:119:in `_execute'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/sshkit-1.2.0/lib/sshkit/backends/netssh.rb:76:in `capture'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/capistrano-rvm-0.1.0/lib/capistrano/tasks/rvm.rake:8:in `block (3 levels) in <top (required)>'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/sshkit-1.2.0/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/sshkit-1.2.0/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/rbedretdinov/.rvm/gems/ruby-2.1.1/gems/sshkit-1.2.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => rvm:check
(See full trace by running task with --trace)

Here is my Gemfile contents:

source 'http://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

gem 'nokogiri', '~> 1.6.0'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

group :development, :test do
  gem 'sqlite3' # Use sqlite3 as the database for Active Record
end

group :production do
 gem 'therubyracer', :platforms => :ruby
 gem 'unicorn' # Use unicorn as the app server
 gem 'pg'
end

# Use Capistrano for deployment
group :development do
  gem 'capistrano', '~> 3.0'
  gem 'capistrano-rvm'
  gem 'capistrano-rails'
  gem 'capistrano-bundler'
  gem 'rspec'
end

# Use debugger
# gem 'debugger', group: [:development, :test]

#gem 'bcrypt-ruby', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt' #needed for prod

#gem 'money', '~>5.1' # fix for Bundler could not find compatible versions for gem "money"
#gem 'money', :github => "RubyMoney/money"
gem 'spree', :git => 'https://github.com/spree/spree.git', :branch => '2-1-stable'
gem 'spree_gateway', :git => 'https://github.com/spree/spree_gateway.git', :branch => '2-1-stable'
gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '2-1-stable'
gem 'devise-i18n', :git => 'https://github.com/tigrish/devise-i18n.git' #Contains proper russian translations for auth functionality

# Use this gem for zooming product images
gem "spree_product_zoom", :git => "https://github.com/BRZInc/spree_product_zoom.git" 

# Use this gem to add customizable fields to product page
# Use fork & need to fix mini_magick reference
gem 'mini_magick', :git => 'git://github.com/minimagick/minimagick.git', :ref => '6d0f8f953112cce6324a524d76c7e126ee14f392'
#gem 'spree_flexi_variants', :git => 'https://github.com/charredUtensil/spree_flexi_variants.git'

# Use this gem to have static pages in Spree,e.g. About page
gem 'spree_static_content', :git => 'https://github.com/DasWasser/spree_static_content.git', :branch => '2-1-stable'

# Turns on spree localization
gem 'russian'
gem 'rails-i18n'
gem 'spree_i18n', :git => 'https://github.com/spree/spree_i18n.git', :branch => '2-1-stable'
gem 'globalize', github: 'globalize/globalize'

# Allow paypal payments
gem 'spree_paypal_express', :github => "radar/better_spree_paypal_express", :branch => "2-1-stable"

# Allow bank transfer payments
gem 'spree_bank_transfer', :git => 'https://github.com/GarPit/spree_bank_transfer'

gem 'bootstrap-sass', '~> 3.1.0'
# Replaces standard frontend with bootstrap one
gem 'spree_bootstrap_frontend', :git => 'https://github.com/BRZInc/spree_bootstrap_frontend.git'

# Optimizes work with options
gem 'spree_variant_options', :git => 'https://github.com/joshblour/spree_variant_options.git', :branch => "2-1-stable"

# Turns on robokassa payments
gem 'spree_robokassa', :git => 'https://github.com/BRZInc/spree_robokassa.git', :branch => 'master'

# Allow to configure related products
gem 'spree_related_products', github: 'spree/spree_related_products', branch: '2-1-stable'

gem 'spree_slider', :git => 'https://github.com/BRZInc/spree_slider.git', :branch => '2-1-stable'

I've already tried to latest capistrano-rvm, capistrano-bundler, capistrano-rails gems versions.

Please help!

undefined method `each' for nil:NilClass

cap 3

± cap staging deploy
cap aborted!
undefined method each' for nil:NilClass /Users/Leonid/.rvm/gems/ruby-2.0.0-p353@ekster/gems/capistrano-rvm-0.1.0/lib/capistrano/tasks/rvm.rake:38:inblock (2 levels) in <top (required)>'
/Users/Leonid/.rvm/gems/ruby-2.0.0-p353@ekster/gems/capistrano-3.0.1/lib/capistrano/dsl.rb:14:in invoke' /Users/Leonid/.rvm/gems/ruby-2.0.0-p353@ekster/gems/capistrano-3.0.1/lib/capistrano/dsl/task_enhancements.rb:11:inblock in after'
/Users/Leonid/.rvm/gems/ruby-2.0.0-p353@ekster/gems/capistrano-3.0.1/lib/capistrano/application.rb:12:in run' /Users/Leonid/.rvm/gems/ruby-2.0.0-p353@ekster/gems/capistrano-3.0.1/bin/cap:3:in<top (required)>'
/Users/Leonid/.rvm/gems/ruby-2.0.0-p353@ekster/bin/cap:23:in `load'

cannot load such file -- capistrano/rvm

I get the following error when using capistrano-rvm:

cap aborted!
cannot load such file -- capistrano/rvm

My Gemfile contains the following entries:

gem 'capistrano', :github => 'capistrano/capistrano', :branch => 'v3'
gem 'capistrano-rvm', github: 'capistrano/rvm'

And the Gemfile.lock:

GIT
  remote: git://github.com/capistrano/capistrano.git
  revision: 5f3a2b67ff506dedbd92c9c7e59010fa360d1f12
  branch: v3
  specs:
    capistrano (3.0.0.pre14)
      i18n
      rake (>= 10.0.0)
      sshkit (>= 0.0.23)

GIT
  remote: git://github.com/capistrano/rvm.git
  revision: 76d7cd6bd86430210d7eb8cbc209f4b5161c42a2
  specs:
    capistrano-rvm (0.0.1)
      capistrano

I am using rvm 1.22.3 (master) under OSX. Ruby version is ruby-2.0.0-p247

using jruby-9.0.5.0 reports `Could not find the main class: org/jruby/Main. Program will exit.`

I am using jruby-9.0.5.0 for my project. After setting up the server, I run cap production deploy:check, and I get:

DEBUG [3852050a] Running ~/.rvm/bin/rvm jruby-9.0.5.0@tagore do ruby --version as [email protected]
DEBUG [3852050a] Command: ~/.rvm/bin/rvm jruby-9.0.5.0@tagore do ruby --version
DEBUG [3852050a]    Exception in thread "main"
DEBUG [3852050a]    java.lang.UnsupportedClassVersionError: org/jruby/Main : Unsupported major.minor version 51.0
DEBUG [3852050a]
DEBUG [3852050a]        at java.lang.ClassLoader.findBootstrapClass(Native Method)
DEBUG [3852050a]
DEBUG [3852050a]        at java.lang.ClassLoader.findBootstrapClass0(ClassLoader.java:909)
DEBUG [3852050a]
DEBUG [3852050a]        at java.lang.ClassLoader.loadClass(ClassLoader.java:318)
DEBUG [3852050a]
DEBUG [3852050a]        at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
DEBUG [3852050a]
DEBUG [3852050a]        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
DEBUG [3852050a]
DEBUG [3852050a]        at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
DEBUG [3852050a]
DEBUG [3852050a]    Could not find the main class: org/jruby/Main. Program will exit.

But when I log on to the system and run command ~/.rvm/bin/rvm jruby-9.0.5.0@tagore do ruby --version. It's all correct.

How could I fix this?

Thank you very much.

My server is running Ubuntu Server 12.04 with rvm latest installation. I am using capistrano 3.4 and capistrano-rvm 0.1.2

:hook gets in the way during fresh install

I have a few tasks wrapped under setup:deploy to prepare a new instance. As I deploy for the first time, rvm:hook gets executed very early on and prevents me from doing my own rvm installation:

namespace :rvm do
  task :install do
    on roles(:all), in: :sequence do
      execute %q(gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3)
      execute %q(\curl -sSL https://get.rvm.io | bash -s stable --autolibs=3 --ruby=2.2.1)
    end
  end
end

The line after stage, 'rvm:hook' (of this gem) starts rvm:hook before my rvm:install runs. It fails, obviously, but also does not let me proceed to install rvm. I went around that by forcing my task to run earlier: before :hook, :install, - but that obviously would run each time I ran cap production deploy, which is not what I want.

Ideally, I'd prefer the gem to provide its own :install which would let me install rvm in an independent execution - something that I could then include in my own task for setting up new instances. Either that - or tie :hook to a later stage that would not be executed before tasks that are not code deploys.

rvm:hook requirement outside deploy process

It seems to me, to be troublesome to impose using the rvm:hook task on every other library that wants to work in tandem. I contribute to the sidekiq project, and this would require us to make a change for the two libraries to work together.

For instance, on a fresh install of rails, with capistrano v3, and capistrano/rvm, and sidekiq. Running cap production sidekiq:start will simply not work unless a change was made, either by the host app or the sidekiq project to call rvm:hook before the sidekiq tasks ran.

rvm wrapped rake doesn't work with bundler's deployment + binstubs flags

Hi guys,

This command
/.rvm/bin/app_bundle --gemfile /home/user/www/app/releases/20131015200101/Gemfile --path /home/user/www/app/shared/bundle --deployment --quiet --binstubs /home/user/www/app/shared/bin --without development test
will install gems into shared/bundle directory and correct rake will be placed into shared/bin directory.
bundle exec command still works perfectly while /.rvm/bin/app_rake fails due to gem not found issue.

Regards,
Anatoly

Capistrano deployment failing with 'rbenv: /home/alexander/.rvm/bin/rvm: command not found'

I won't show the whole log but here's the error message:

    (Backtrace restricted to imported tasks)
    cap aborted!
    SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: bundle exit status: 127
    bundle stdout: rbenv: /home/alexander/.rvm/bin/rvm: command not found
    bundle stderr: Nothing written

    SSHKit::Command::Failed: bundle exit status: 127
    bundle stdout: rbenv: /home/alexander/.rvm/bin/rvm: command not found
    bundle stderr: Nothing written

    Tasks: TOP => deploy:updated => bundler:install
    (See full trace by running task with --trace)
    The deploy has failed with an error: Exception while executing as [email protected]: bundle exit status: 127
    bundle stdout: rbenv: /home/alexander/.rvm/bin/rvm: command not found
    bundle stderr: Nothing written

I have no idea what this means. Ideas?

Any remote RVM commands generate hundreds of wrapper RVM instances and recurse forever

I am running a simple cap production rvm:check.

Locally, everything looks good until it hits here:

[a0763390] Running /usr/local/rvm/bin/rvm ruby-2.0.0-p353@[REDACTED] do ruby --version on [REDACTED].com
DEBUG [a0763390] Command: ( RAILS_ENV=production /usr/local/rvm/bin/rvm ruby-2.0.0-p353@[REDACTED] do ruby --version )

ruby-2.0.0-p353 is installed on the remote machine, as is the gemset.

On the server side, hundreds of rvm wrapper instances are spawned per second with no end. Only a force kill locally, and a pkill remotely will cause it to stop.

$ root@[REDACTED]:/home/[REDACTED]/[REDACTED].com/current# ps ax | grep rvm
  546 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
  684 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
  791 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
  898 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 1005 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 1112 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 1220 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 1341 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 1452 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 1559 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 1666 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 1779 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 1886 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 1993 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 2101 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 2208 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 2315 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 2437 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 2544 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 2651 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 2760 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 2869 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 2980 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 3087 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 3196 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 3308 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 3416 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 3530 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 3646 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 3754 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 3861 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 3969 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 4078 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 4187 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 4294 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 4402 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 4509 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 4617 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 4734 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 4841 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 4970 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 5078 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 5185 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 5292 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 5401 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 5508 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 5615 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 5722 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 5829 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 5936 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 6043 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
 6050 pts/2    S+     0:00 grep rvm
25484 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
25850 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
25957 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
26064 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
26171 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
26279 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
26386 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
26493 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
26600 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
26707 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
26814 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
26921 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
27028 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
27135 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
27242 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
27349 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
27456 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
27563 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
27670 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
27777 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
27884 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
27992 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
28100 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
28208 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
28315 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
28422 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
28529 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
28636 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
28743 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
28851 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
28959 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
29066 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
29173 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
29280 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
29387 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
29494 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
29601 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
29708 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
29815 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
29922 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
30029 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
30136 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
30243 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
30350 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
30457 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
30565 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
30672 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
30779 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
30887 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
30994 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
31101 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
31208 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
31315 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
31422 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
31529 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
31636 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
31743 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
31850 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
31957 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
32064 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
32171 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
32278 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
32386 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
32493 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
32600 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
32707 ?        S      0:00 bash /usr/local/rvm/scripts/wrapper ruby-2.0.0-p353@[REDACTED]
$ root@[REDACTED]:/home/[REDACTED]/[REDACTED].com/current# ps ax | grep rvm | awk '{ print $1 }' | xargs kill

I never had a problem with cap 2. What is going on here?

rvm 2.2.5 and 2.3.1 rvm version missing

ive 3 ruby installed via rvm , etc: 2.2.4, 2.2.5 and 2.3.1
rvm 2.2.5 and above seems to fail

DEBUG [b7778623] Running /usr/local/rvm/bin/rvm 2.2.5 do ruby --version as [email protected]
 DEBUG [b7778623] Command: ( export RAILS_RELATIVE_URL_ROOT="/shop" ; /usr/local/rvm/bin/rvm 2.2.5 do ruby --version )
 DEBUG [535972cf]   ruby 2.2.5p319 (2016-04-26 revision 54774) [x86_64-linux]
 DEBUG [535972cf] Finished in 0.548 seconds with exit status 0 (successful).
ruby 2.2.5p319 (2016-04-26 revision 54774) [x86_64-linux]
 DEBUG [b7778623]   stdin: is not a tty
 DEBUG [b7778623]   Ruby ruby-2.2.5 is not installed.

working 2.2.4

 DEBUG [ff2ef802] Running /usr/local/rvm/bin/rvm 2.2.4-dev do ruby --version as [email protected]
 DEBUG [ff2ef802] Command: ( export RAILS_RELATIVE_URL_ROOT="/shop" ; /usr/local/rvm/bin/rvm 2.2.4-dev do ruby --version )
 DEBUG [61a0ba29]   stdin: is not a tty
 DEBUG [61a0ba29]   ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]
 DEBUG [61a0ba29] Finished in 0.622 seconds with exit status 0 (successful).
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]
 DEBUG [ff2ef802]   ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]
 DEBUG [ff2ef802] Finished in 0.762 seconds with exit status 0 (successful).

manual rvm use 2.2.5 or 2.3.1 and run bundle works...

SSHKit version error

Hi!

I'm getting this error when trying to deploy:

Unable to activate capistrano-rvm-0.1.0, because sshkit-1.3.0 conflicts with sshkit (~> 1.2.0)

Here are the versions of my gems (from Gemfile.lock):

  • capistrano-rvm (0.1.0)
  • capistrano (3.0.1)
  • capistrano-bundler (1.1.1)
  • capistrano-rails (1.1.0)

Strange things is that none of those Gems require sshkit 1.3.0. I also veryfied the dependencies of my other Gems, they don't require sshkit.

Here is the full trace:

cap aborted!
Unable to activate capistrano-rvm-0.1.0, because sshkit-1.3.0 conflicts with sshkit (~> 1.2.0)
/home/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:2000:in `raise_if_conflicts'
/home/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1238:in `activate'
/home/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems.rb:194:in `rescue in try_activate'
/home/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems.rb:191:in `try_activate'
/home/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
/home/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
/home/projects/rails_project/Capfile:18:in `<top (required)>'
/home/.rvm/gems/ruby-2.0.0-p247/gems/rake-10.1.1/lib/rake/rake_module.rb:25:in `load'
/home/.rvm/gems/ruby-2.0.0-p247/gems/rake-10.1.1/lib/rake/rake_module.rb:25:in `load_rakefile'
/home/.rvm/gems/ruby-2.0.0-p247/gems/rake-10.1.1/lib/rake/application.rb:637:in `raw_load_rakefile'
/home/.rvm/gems/ruby-2.0.0-p247/gems/rake-10.1.1/lib/rake/application.rb:94:in `block in load_rakefile'
/home/.rvm/gems/ruby-2.0.0-p247/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/home/.rvm/gems/ruby-2.0.0-p247/gems/rake-10.1.1/lib/rake/application.rb:93:in `load_rakefile'
/home/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.0.1/lib/capistrano/application.rb:22:in `load_rakefile'
/home/.rvm/gems/ruby-2.0.0-p247/gems/rake-10.1.1/lib/rake/application.rb:77:in `block in run'
/home/.rvm/gems/ruby-2.0.0-p247/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/home/.rvm/gems/ruby-2.0.0-p247/gems/rake-10.1.1/lib/rake/application.rb:75:in `run'
/home/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.0.1/lib/capistrano/application.rb:12:in `run'
/home/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.0.1/bin/cap:3:in `<top (required)>'
/home/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `load'
/home/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `<main>'
/home/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
/home/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'

Would you know what's going on?

Thanks. :)

Executing code locally with mixed rvm types

I'm trying to run a task that involves the run_locally method, but whenever Capistrano tries to execute this task, it tries to use the server's rvm type which is different from my type (system vs user), is there a way to tell Capistrano to check what type to use during a run_locally block?

Release a new gem.

Due to prefix support being released in the capistrano gem, this gem is now broken when prefixes are defined on executables you want to wrap. Works fine against master. Any chance of a new gem release?

Rails and rvm integration not working

Hi all!
Installed gems:

capistrano-bundler (1.1.1)
capistrano-rails (1.1.0)
capistrano-rvm (0.0.3)

I get this error:
bash: bundle: command not found

cap aborted!
rake exit status: 127
rake stdout: Nothing written
rake stderr: bash: bundle: command not found
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/command.rb:98:in `exit_status='
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/backends/netssh.rb:142:in `block (4 levels) in _execute'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:551:in `call'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:551:in `do_request'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:561:in `channel_request'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:205:in `process'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:269:in `wait'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/backends/netssh.rb:164:in `block (2 levels) in _execute'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:514:in `call'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:205:in `process'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/backends/netssh.rb:166:in `block in _execute'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/backends/netssh.rb:123:in `tap'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/backends/netssh.rb:123:in `_execute'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/backends/netssh.rb:66:in `execute'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/capistrano-rails-1.1.0/lib/capistrano/tasks/assets.rake:63:in `block (6 levels) in <top (required)>'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/backends/abstract.rb:89:in `with'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/capistrano-rails-1.1.0/lib/capistrano/tasks/assets.rake:62:in `block (5 levels) in <top (required)>'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/backends/abstract.rb:81:in `within'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/capistrano-rails-1.1.0/lib/capistrano/tasks/assets.rake:61:in `block (4 levels) in <top (required)>'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/backends/netssh.rb:54:in `run'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'

ps Sorry for my bad english

why not invoke rvm:init by default?

In my opinion, there should be only one specific version of ruby within a project, so why not invoke rvm:init by default to invoke all the tasks with the same version of ruby?

Add rvmsudo to default rvm_map_bins

Please, consider adding rvmsudo to the list of binaries that get an /usr/local/rvm ... do prefix(rvm_map_bins). My specific use case is with foreman:

execute :rvmsudo, :foreman, "export", "upstart"

Without the prefix it just says /usr/bin/env: rvmsudo: No such file or directory.

rvm.rake:67: undefined method `join' for nil:NilClass

I'm having trouble with this line:

execute :rvm, "wrapper #{fetch(:rvm_ruby_version)} #{fetch(:application)} #{fetch(:rvm_map_bins).join(" ")}"

When running the command:

cap production rvm:check

My Gemfile looks like this:

group :development do
  gem 'capistrano', github: 'capistrano/capistrano'
  gem 'capistrano-rails'
  gem 'capistrano-bundler'
  gem 'capistrano-rvm', github: 'capistrano/rvm'
end

And the non standard parts of deploy.rb:

require 'capistrano/rvm'
require 'capistrano/bundler'
require 'capistrano/rails'

set :rvm_ruby_version, '2.0.0'
set :rvm_type, :user

According to this issue #4 rvm_map_bins should be set when load:defaults is invoked. It is being run, this is the trace output:

** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke rvm:check (first_time)
** Invoke rvm:hook (first_time)
** Execute rvm:hook
** Invoke rvm:init (first_time)
** Execute rvm:init
** Invoke rvm:create_wrappers (first_time)
** Execute rvm:create_wrappers
cap aborted!
undefined method `join' for nil:NilClass
/Users/jamied/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/rvm-76d7cd6bd864/lib/capistrano/tasks/rvm.rake:67:in `block (3 levels) in <top (required)>'
/Users/jamied/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sshkit-0.0.34/lib/sshkit/backends/netssh.rb:42:in `instance_exec'
/Users/jamied/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sshkit-0.0.34/lib/sshkit/backends/netssh.rb:42:in `run'
/Users/jamied/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sshkit-0.0.34/lib/sshkit/runners/parallel.rb:29:in `block (2 levels) in execute'
Tasks: TOP => rvm:create_wrappers

install rvm/rubies

Hi I'm interested in maintenance of this extensions and adding installation of rvm and rubies to it, should I open PR or better to extract this things to separate gem(s)?

capistrano-rvm and capistrano-rails cant find bundle

Had a problem today when trying to deploy using capistrano and rvm.

rvm is system based.

When the capistrano was trying to use rake to precompile assets the system complained about not being able to find bundle. Previously in the deploy command had run successfully. I noticed that this command was run with "/usr/local/rvm/bin/rvm ruby-2.0.0-p353 do" while the rake task to do the precompile was "RAILS_ENV=staging bundle exec rake assets:precompile"

putting the following into the deploy.rb sorted it out SSHKit.config.command_map.prefix[:rake].unshift("/usr/local/rvm/bin/rvm ruby-2.0.0-p353 do") worked but as far as I could tell the capistrano-rvm should have already done this. Any ideas?

Incorrect PATH warning even though ruby version is specified

I get this error when my capistrano (capistrano-rvm (0.1.1)) script runs rvm commands:

   Warning! PATH is not properly set up, '/usr/local/rvm/gems/ruby-2.1.0/bin' is not at first place,
         usually this is caused by shell initialization files - check them for 'PATH=...' entries,
         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
         to fix temporarily in this shell session run: 'rvm use ruby-2.1.0'.

At the same time, I have set :rvm_ruby_version, '2.1.0' in my deploy.rb.

It appears that capistrano-rvm does not choose ruby properly. If I execute rvm commands manually, I get this warning too. However, it goes away if I execute rvm use 2.1.0 first.

rake exit status: 1

hello, i use capistrano-rvm gem, but i meet rake exit status: 1 error at rake assets:precompile this step
my stack as follows, no more infos, how to fix it? thx

NFO[236b3613] Running ~/.rvm/bin/rvm 2.1.1 do bundle install --binstubs /home/admin/kanbox/www/update.labs.etao.com/shared/bin --path /home/admin/kanbox/www/update.labs.etao.com/shared/bundle --without development test --no-deployment --quiet on 10.98.60.82
INFO[236b3613] Finished in 2.680 seconds with exit status 0 (successful).
INFO[d56fe150] Running ~/.rvm/bin/rvm 2.1.1 do bundle exec rake assets:precompile on 10.98.60.82
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host 10.98.60.82: rake exit status: 1
rake stdout: Nothing written
rake stderr: Nothing written
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/command.rb:97:in `exit_status='
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:148:in `block (5 levels) in _execute'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `call'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `do_request'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:561:in `channel_request'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:269:in `wait'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:170:in `block (3 levels) in _execute'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `call'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:172:in `block (2 levels) in _execute'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:186:in `with_ssh'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:131:in `block in _execute'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `tap'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `_execute'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:66:in `execute'
/home/admin/.rvm/gems/ruby-2.1.1/gems/capistrano-rails-1.1.1/lib/capistrano/tasks/assets.rake:59:in `block (6 levels) in <top (required)>'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/abstract.rb:85:in `with'
/home/admin/.rvm/gems/ruby-2.1.1/gems/capistrano-rails-1.1.1/lib/capistrano/tasks/assets.rake:58:in `block (5 levels) in <top (required)>'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/abstract.rb:77:in `within'
/home/admin/.rvm/gems/ruby-2.1.1/gems/capistrano-rails-1.1.1/lib/capistrano/tasks/assets.rake:57:in `block (4 levels) in <top (required)>'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
SSHKit::Command::Failed: rake exit status: 1
rake stdout: Nothing written
rake stderr: Nothing written
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/command.rb:97:in `exit_status='
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:148:in `block (5 levels) in _execute'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `call'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `do_request'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:561:in `channel_request'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:269:in `wait'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:170:in `block (3 levels) in _execute'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `call'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/admin/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:172:in `block (2 levels) in _execute'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:186:in `with_ssh'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:131:in `block in _execute'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `tap'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `_execute'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:66:in `execute'
/home/admin/.rvm/gems/ruby-2.1.1/gems/capistrano-rails-1.1.1/lib/capistrano/tasks/assets.rake:59:in `block (6 levels) in <top (required)>'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/abstract.rb:85:in `with'
/home/admin/.rvm/gems/ruby-2.1.1/gems/capistrano-rails-1.1.1/lib/capistrano/tasks/assets.rake:58:in `block (5 levels) in <top (required)>'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/abstract.rb:77:in `within'
/home/admin/.rvm/gems/ruby-2.1.1/gems/capistrano-rails-1.1.1/lib/capistrano/tasks/assets.rake:57:in `block (4 levels) in <top (required)>'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
/home/admin/.rvm/gems/ruby-2.1.1/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
Tasks: TOP => deploy:assets:precompile
(See full trace by running task with --trace)
The deploy has failed with an error: #<SSHKit::Runner::ExecuteError: Exception while executing on host 10.98.60.82: rake exit status: 1
rake stdout: Nothing written
rake stderr: Nothing written
>

Should rvm execute as root group?

This may not be a problem but I suspect it was unintentional and should be reviewed. I noticed that the files created from an RVM user install are owned by the user but have root for the group. This is probably because popen4 is not being given a group argument (from shell_params). Maybe it should?

Trying to bundle exec sidekiqctl/sidekiq, it says bundle command not found...

At first I tried to just use bundle exec sidekiqctl but since all my other commands seem to need to run in the app's current directory I wrapped my execute within current_path do ... end

It ends up trying to execute cd /var/app/current && bundle exec sidekiqctl stop /var/app/shared/tmp/pids/sidekiq.pid

Which works when I copy and paste that on the server logged in as the deploy user.

However, when it runs during capistrano deployment it fails... bash: bundle: command not found

Here's my restart task code...

namespace :deploy do
  desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      within current_path do
        if test("[ -f #{shared_path.join('tmp/pids/sidekiq.pid')} ]")
          execute :sidekiqctl, "stop #{shared_path.join('tmp/pids/sidekiq.pid')}" 
        end

        execute :sidekiq, '-r ./main.rb -e development -C ./config/sidekiq.yml -d'
      end
    end
  end

Maybe I'm posting to the wrong repo.. but I have a feeling this has something to do with how my RVM is configured.

I have this in my ~/.bash_profile

$ cat ~/.bash_profile

[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

bundle install problems

I'm not sure if this is a capistrano-rvm problem or a capistrano-bundler problem, or what, but I'll try reporting it here, for advice on how to figure out more on what's going on.

I have require 'capistrano/rvm' in my Capfile, followed by require 'capistrano/rails'.

When I try a cap deploy, it is unable to do the bundle install:

DEBUG [ec7b1264] Command: cd /opt/umlaut_jh/releases/20150506173737 && ~/.rvm/bin/rvm default do bundle install --path /opt/umlaut_jh/shared/bundle --without development test --deployment --quiet
DEBUG [ec7b1264]    An error occurred while installing uglifier (2.7.1), and Bundler cannot
DEBUG [ec7b1264]    continue.
DEBUG [ec7b1264]    Make sure that `gem install uglifier -v '2.7.1'` succeeds before bundling.
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host blacklight.library.jhu.edu: bundle exit status: 5
bundle stdout: An error occurred while installing uglifier (2.7.1), and Bundler cannot
continue.
Make sure that `gem install uglifier -v '2.7.1'` succeeds before bundling.
bundle stderr: Nothing written
/Users/jrochkind/.gem/ruby/2.2.2/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:16:in `rescue in block (2 levels) in execute'
/Users/jrochkind/.gem/ruby/2.2.2/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
SSHKit::Command::Failed: bundle exit status: 5
bundle stdout: An error occurred while installing uglifier (2.7.1), and Bundler cannot
continue.
Make sure that `gem install uglifier -v '2.7.1'` succeeds before bundling.
bundle stderr: Nothing written
/Users/jrochkind/.gem/ruby/2.2.2/gems/sshkit-1.7.1/lib/sshkit/command.rb:95:in `exit_status='
/Users/jrochkind/.gem/ruby/2.2.2/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:179:in `block in _execute'
/Users/jrochkind/.gem/ruby/2.2.2/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:133:in `tap'
/Users/jrochkind/.gem/ruby/2.2.2/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:133:in `_execute'
/Users/jrochkind/.gem/ruby/2.2.2/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:66:in `execute'
/Users/jrochkind/.gem/ruby/2.2.2/gems/capistrano-bundler-1.1.4/lib/capistrano/tasks/bundler.cap:35:in `block (5 levels) in <top (required)>'
/Users/jrochkind/.gem/ruby/2.2.2/gems/sshkit-1.7.1/lib/sshkit/backends/abstract.rb:85:in `with'
/Users/jrochkind/.gem/ruby/2.2.2/gems/capistrano-bundler-1.1.4/lib/capistrano/tasks/bundler.cap:26:in `block (4 levels) in <top (required)>'
/Users/jrochkind/.gem/ruby/2.2.2/gems/sshkit-1.7.1/lib/sshkit/backends/abstract.rb:77:in `within'
/Users/jrochkind/.gem/ruby/2.2.2/gems/capistrano-bundler-1.1.4/lib/capistrano/tasks/bundler.cap:25:in `block (3 levels) in <top (required)>'
/Users/jrochkind/.gem/ruby/2.2.2/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/jrochkind/.gem/ruby/2.2.2/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/jrochkind/.gem/ruby/2.2.2/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
Tasks: TOP => deploy:updated => bundler:install
The deploy has failed with an error: Exception while executing on host blacklight.library.jhu.edu: bundle exit status: 5
bundle stdout: An error occurred while installing uglifier (2.7.1), and Bundler cannot
continue.
Make sure that `gem install uglifier -v '2.7.1'` succeeds before bundling.
bundle stderr: Nothing written
** Invoke deploy:failed (first_time)
** Execute deploy:failed

If I log in to an interactive bash shell directly under the same cap user, I an do a gem install uglifier -v '2.7.1' no problem.

I can also, interactively, even do a cd /opt/umlaut_jh/releases/20150506173737 && ~/.rvm/bin/rvm default do bundle install --path /opt/umlaut_jh/shared/bundle --without development test --deployment without a problem. Once I've manually run that bundle command, I can subsequently do a cap deploy, because the gems are all there already -- but I expect that I'll have a problem again whenever I have a new gem in a cap deploy, so that's not good.

Any ideas of what might be going on, or how I might investigate or debug this further?

require 'capistrano/rvm' Error cannot load such file

Hi, I want to use Capistrano 3.0.0.

gem 'capistrano',  '~> 3.0.0'
gem 'capistrano-rails'
gem 'capistrano-rvm', github: 'capistrano/rvm'

This is my Capfile

require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rvm'

When I run cap, it show errors like this

cap aborted!
cannot load such file -- capistrano/rvm
/home/edwinlunando/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
/home/edwinlunando/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
/home/edwinlunando/Projects/edu-lab-website/Capfile:18:in `<top (required)>'
/home/edwinlunando/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load'
/home/edwinlunando/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load_rakefile'
/home/edwinlunando/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:637:in `raw_load_rakefile'
/home/edwinlunando/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:94:in `block in load_rakefile'
/home/edwinlunando/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/home/edwinlunando/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:93:in `load_rakefile'
/home/edwinlunando/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.0.0/lib/capistrano/application.rb:22:in `load_rakefile'
/home/edwinlunando/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:77:in `block in run'
/home/edwinlunando/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/home/edwinlunando/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/home/edwinlunando/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.0.0/lib/capistrano/application.rb:12:in `run'
/home/edwinlunando/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.0.0/bin/cap:3:in `<top (required)>'
/home/edwinlunando/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `load'
/home/edwinlunando/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `<main>'

System wide installation in usr/share

I did follow the instructions from rvm.io, and my rvm got installed by default in

$ which rvm
/usr/share/rvm/bin/rvm

(instead of usr/local)

I am running on an Ubuntu instance from Amazon, this is maybe why ?

Anyway, the rvm path is not detected with the system-wide install. Might want to add this path to the list of default paths checked by your gem.

Add rvm:install

It would be nice to have an rvm-install task to install rvm+ruby

rvm check gets called before all cap commands

Hello,
I'm not sure this is intended or not, but I'm using the capistrano/rvm integration on a multistage setup and any cap command will trigger a rvm:check.

example :

cap staging deploy:cleanup
DEBUG [1f658325] Running /usr/local/rvm/bin/rvm version on example.com
DEBUG [1f658325] Command: /usr/local/rvm/bin/rvm version
DEBUG [1f658325]
DEBUG [1f658325] rvm 1.21.15 (master) by Wayne E. Seguin [email protected], Michal Papis [email protected] [https://rvm.io/]
DEBUG [1f658325]
DEBUG [1f658325] Finished in 0.947 seconds with exit status 0 (successful).
rvm 1.21.15 (master) by Wayne E. Seguin [email protected], Michal Papis [email protected] [https://rvm.io/]
DEBUG [a4467073] Running /usr/local/rvm/bin/rvm current on example.com
DEBUG [a4467073] Command: /usr/local/rvm/bin/rvm current
DEBUG [a4467073] ruby-1.9.3-p327@gemset
DEBUG [a4467073] Finished in 0.233 seconds with exit status 0 (successful).
ruby-1.9.3-p327@gemset
DEBUG [ae0e8890] Running /usr/local/rvm/bin/rvm 1.9.3-p327 do ruby --version on example.com
DEBUG [ae0e8890] Command: /usr/local/rvm/bin/rvm 1.9.3-p327 do ruby --version
DEBUG [ae0e8890] ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]
DEBUG [ae0e8890] Finished in 0.364 seconds with exit status 0 (successful).
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]
DEBUG [2ecdf08f] Running /usr/bin/env ls -x /path/to/releases on example.com
DEBUG [2ecdf08f] Command: /usr/bin/env ls -x /path/to/releases
DEBUG [2ecdf08f] 20140304092652 20140304135645 20140304140120 20140304140829 20140304141608
DEBUG [2ecdf08f] 20140304142530 20140304152653
DEBUG [2ecdf08f] Finished in 0.116 seconds with exit status 0 (successful).
INFO Keeping 7 of 7 deployed releases on example.com
INFO No old releases (keeping newest 7) on example.com

Commenting out this line will prevent this :

after stage, 'rvm:check'

Is the rvm:check supposed to be always called ?

Thanks

how to get rvm-shell invoked

this gem automatically prefixes ruby, and friends with the rvm .. do. Can I leverage this somehow rather than hard coding things into run or execute?

rvm_path vs rvm_custom_path

I'm a little confused as to why there is both rvm_path and rvm_custom_path. What is the difference between the two?

Confusion with `gem 'capistrano-rvm'` (different gem ?)

Hi,
/cc @mpapis
/cc @softr8

I may be confused, but these are my findings, trying to use this code with Capistrano v3.

Based on the require 'capistrano/rvm' in

https://github.com/capistrano/capistrano/blob/master/lib/capistrano/templates/Capfile#L18

and the link to documentation in

https://github.com/capistrano/capistrano/blob/master/lib/capistrano/templates/Capfile#L11

and the gem.name of this project being 'capistrano-rvm':

https://github.com/capistrano/rvm/blob/master/capistrano-rvm.gemspec#L6

I went on to add to my Gemfile

gem 'capistrano-rvm'

However, it seems like that is a completely different gem, posted in July 2012 by Edwin Cruz ( @softr8 ):

http://rubygems.org/gems/capistrano-rvm

I presume, the source code for the 'capistrano-rvm' gem can be found here (I did not easily see that link on rubygems):

https://github.com/softr8/capistrano-rvm

The result of using the naive inclusion of the 'capistrano-rvm' gem is the predictable error:

cannot load such file -- capistrano/rvm

If there is no way to merge the 2 code bases, maybe this code (here) needs to adopt another gem.name and publish a gem under that name?

For now, what worked is to use the link to this code on github (of which I made a fork to be sure and with a more descriptive name).

  gem 'capistrano-rvm', github: "petervandenabeele/capistrano_rvm" # Clone a known working version

Maybe this code here could use the (somewhat ugly) github project name and gem.name of capistrano_rvm . One advantage would be that github clones would automatically inherit a name that is more different from the real rvm project and the project name and gem name would be in line.

Probably there are better alternatives, I was just a bit confused by this and trying to propose a solution. Better solutions are probably possible :-)

Thanks,

@petervandenabeele

No license

The gem seems to miss any license information.

Bundle exec with Capistrano 3

Hello everybody,

I've read all issues posts here but nothing works for my case for the error bash: bundle: command not found
I'm using Capistrano 3 with Rails 4 and Ruby 2.1.

Here is the command line that doesn't work on deploy.rb :

execute "cd #{fetch(:deploy_to)}/current/ && RAILS_ENV=#{fetch(:environment)} bundle exec rake db:migrate"

On my production.rb file, I have those settings :

set :rvm_type, :system
set :rvm_ruby_version, '2.1.1'
set :default_env, { rvm_bin_path: "/usr/local/rvm/bin" }
set :environment, "production"

Here is my Capfile

require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rvm'

require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'whenever/capistrano'

Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }

This time it's my GemFile

group :development do
  gem 'capistrano', github: 'capistrano/capistrano', ref: 'master'
  gem 'capistrano-rails', github: 'capistrano/rails', ref: 'master'
  gem 'capistrano-bundler', '~> 1.1'
  gem 'capistrano-rvm', git: 'https://github.com/capistrano/rvm.git'
end

Finally the deploy logs:

DEBUG [18471155]    bash: bundle: command not found
cap aborted!
cd /mytests/test1/current/ && RAILS_ENV=production bundle exec rake db:migrate stdout: Nothing written
cd /myTests/test1/current/ && RAILS_ENV=production bundle exec rake db:migrate stderr: Nothing written
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/command.rb:94:in `exit_status='
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:142:in `block (4 levels) in _execute'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:551:in `call'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:551:in `do_request'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:561:in `channel_request'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:205:in `process'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:269:in `wait'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:164:in `block (2 levels) in _execute'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:514:in `call'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:205:in `process'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:166:in `block in _execute'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:123:in `tap'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:123:in `_execute'
/Users/Brice/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:66:in `execute'
config/deploy.rb:55:in `block (3 levels) in <top (required)>'

I would like to find a way without touching to my deploy.rb because this file is working for other stages.

Thank you in advance for your help.

capistrano/rvm fails with system wide rvm instalation

I'm porting capistrano 2 + rvm-capistrano deployment to capitrano 3 + capistrano/rvm. I use system wide rvm instalation and unprivileged user for deployment. Looks like capistrano/rvm tries to write to system wide rvm installation:

** Invoke rvm:hook (first_time)
** Execute rvm:hook
** Invoke rvm:init (first_time)
** Execute rvm:init
** Invoke rvm:create_wrappers (first_time)
** Execute rvm:create_wrappers
 INFO [a80551dd] Running /usr/local/rvm/bin/rvm wrapper 2.0.0-p247 app_name bundle gem rake ruby on app.domain.com
DEBUG [a80551dd] Command: /usr/local/rvm/bin/rvm wrapper 2.0.0-p247 app_name bundle gem rake ruby
DEBUG [a80551dd]    No bin path suitable for lining wrapper. Try setting 'rvm_bin_path'.
cap aborted!
rvm stdout: Nothing written
rvm stderr: Nothing written
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/command.rb:94:in `exit_status='
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:125:in `block (4 levels) in _execute'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:551:in `call'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:551:in `do_request'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:561:in `channel_request'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:205:in `process'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:269:in `wait'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:147:in `block (2 levels) in _execute'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:514:in `call'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:205:in `process'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:149:in `block in _execute'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:106:in `tap'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:106:in `_execute'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:54:in `execute'
/home/user/.rvm/gems/ruby-2.0.0-p247/bundler/gems/rvm-05e37c4ec2f6/lib/capistrano/tasks/rvm.rake:68:in `block (3 levels) in <top (required)>'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:42:in `instance_exec'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:42:in `run'
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => rvm:create_wrappers

rvm current/ default does not respect .ruby-version

The task should first change to the current/ release folder so a possibly existing .ruby-version file gets picked up by RVM. Otherwise current or default report the system default, not the one specified in the .ruby-version file.

Check that :application is set.

If it isn't set, it attempts to produce a wrapper like this:

INFO [689ab449] Running /usr/local/rvm/bin/rvm wrapper ruby-2.0.0-p247 bundle gem rake ruby on sandbox

rather than:
INFO [689ab449] Running /usr/local/rvm/bin/rvm wrapper ruby-2.0.0-p247 my_app bundle gem rake ruby on sandbox

It would be better to raise an exception saying you must set application, or provide a default.

Remove SSHKit dependency

capistrano-rvm blocks the usage of a newer SSHKit gem version, because of the over restrictive version selector.

I think we should remove the SSHKit dependency completely.

Hangs on rvm:hook with capistrano 3.3.3

Hello,

I have capistrano 3.2.1 running with capistrano-rvm normally, but after trying to upgrade to 3.3.3, I get hanging process -- seems like forever -- during rvm:hook task (also note double -d ~/.rvm commant, which was not the case in 3.2.1):

➜  repo git:(capistrano3) ✗ cap test deploy
DEBUG[cc47b8d0] Running /usr/bin/env [ -d ~/.rvm ] on test.myapp.com
DEBUG[cc47b8d0] Command: [ -d ~/.rvm ]
DEBUG[b89780bb] Running /usr/bin/env [ -d ~/.rvm ] on test.myapp.com
DEBUG[b89780bb] Command: [ -d ~/.rvm ]
DEBUG[b89780bb] Finished in 0.544 seconds with exit status 0 (successful).
^C(Backtrace restricted to imported tasks)
cap aborted!
Interrupt: 

Tasks: TOP => rvm:hook
(See full trace by running task with --trace)

`rvm do ruby --version` was removed

If I run the rvm:check or deploy:check tasks I get the following failed output:

#> cap staging deploy:check
DEBUG [7dcfdae8] Running /usr/local/rvm/bin/rvm version as <server>
DEBUG [7dcfdae8] Command: /usr/local/rvm/bin/rvm version
DEBUG [7dcfdae8]    rvm 1.27.0 (latest) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
DEBUG [7dcfdae8]
DEBUG [7dcfdae8] Finished in 3.330 seconds with exit status 0 (successful).
rvm 1.27.0 (latest) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
DEBUG [a09777ec] Running /usr/local/rvm/bin/rvm current as <server>
DEBUG [a09777ec] Command: /usr/local/rvm/bin/rvm current
DEBUG [a09777ec]    system
DEBUG [a09777ec] Finished in 0.599 seconds with exit status 0 (successful).
system
DEBUG [2174bae7] Running /usr/local/rvm/bin/rvm  do ruby --version as <server>
DEBUG [2174bae7] Command: /usr/local/rvm/bin/rvm  do ruby --version
DEBUG [2174bae7]    `rvm do ruby --version` was removed, use `rvm 1.9.2,1.9.3 do ruby --version` or `rvm all do ruby --version` instead.
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as <server>: ruby exit status: 1
ruby stdout: `rvm do ruby --version` was removed, use `rvm 1.9.2,1.9.3 do ruby --version` or `rvm all do ruby --version` instead.
ruby stderr: Nothing written

SSHKit::Command::Failed: ruby exit status: 1
ruby stdout: `rvm do ruby --version` was removed, use `rvm 1.9.2,1.9.3 do ruby --version` or `rvm all do ruby --version` instead.
ruby stderr: Nothing written

Tasks: TOP => rvm:check

using --dry-run causes error

$ cap staging deploy --dry-run

produces this error.

undefined method `verbosity' for "~/.rvm/bin/rvm version\n":String
/Users/jondruse/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.2.0/lib/sshkit/formatters/pretty.rb:10:in `write'
/Users/jondruse/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.2.0/lib/sshkit/backends/printer.rb:14:in `block in execute'
/Users/jondruse/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.2.0/lib/sshkit/backends/printer.rb:13:in `tap'
/Users/jondruse/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.2.0/lib/sshkit/backends/printer.rb:13:in `execute'
/Users/jondruse/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.2.0/lib/sshkit/backends/printer.rb:23:in `block in capture'
/Users/jondruse/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.2.0/lib/sshkit/backends/printer.rb:23:in `tap'
/Users/jondruse/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.2.0/lib/sshkit/backends/printer.rb:23:in `capture'
/Users/jondruse/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-rvm-0.1.0/lib/capistrano/tasks/rvm.rake:8:in `block (3 levels) in '
/Users/jondruse/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.2.0/lib/sshkit/backends/printer.rb:9:in `instance_exec'
/Users/jondruse/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.2.0/lib/sshkit/backends/printer.rb:9:in `run'
/Users/jondruse/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.2.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => rvm:check

Load capistrano-rvm only in staging environment

Due to historic reasons i use rbenv in production and rvm in staging environment.

The problem is now, that I cannot load capistrano-rvm in the staging.rb cap file:

bundle exec cap staging console
cap aborted!
NoMethodError: undefined method `each' for nil:NilClass
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/capistrano-rvm-0.1.1/lib/capistrano/tasks/rvm.rake:38:in `block (2 levels) in <top (required)>'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/capistrano-3.2.1/lib/capistrano/dsl/task_enhancements.rb:12:in `block in after'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/capistrano-3.2.1/lib/capistrano/application.rb:15:in `run'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/capistrano-3.2.1/bin/cap:3:in `<top (required)>'
/Users/user/.rvm/gems/ruby-1.9.3-p448/bin/cap:23:in `load'
/Users/user/.rvm/gems/ruby-1.9.3-p448/bin/cap:23:in `<main>'
/Users/user/.rvm/gems/ruby-1.9.3-p448/bin/ruby_executable_hooks:15:in `eval'
/Users/user/.rvm/gems/ruby-1.9.3-p448/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => rvm:hook
(See full trace by running task with --trace)

But if I move the "require 'capistrano/rvm'" it in the Capfile, it also gets loaded in the production environment:

bundle exec cap production console
DEBUG [3ee05cd7] Running /usr/bin/env [ -d ~/.rvm ] on mywebsite.com
DEBUG [3ee05cd7] Command: [ -d ~/.rvm ]
DEBUG [3ee05cd7] Finished in 1.284 seconds with exit status 1 (failed).
DEBUG [c3bf6f47] Running /usr/bin/env [ -d /usr/local/rvm ] on mywebsite.com
DEBUG [c3bf6f47] Command: [ -d /usr/local/rvm ]
DEBUG [c3bf6f47] Finished in 0.083 seconds with exit status 1 (failed).
DEBUG [dbe7a15a] Running ~/.rvm/bin/rvm version on mywebsite.com
DEBUG [dbe7a15a] Command: ~/.rvm/bin/rvm version
cap aborted!
SSHKit::Command::Failed: rvm exit status: 127
rvm stdout: Nothing written
rvm stderr: Nothing written
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/sshkit-1.4.0/lib/sshkit/command.rb:98:in `exit_status='
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:142:in `block (4 levels) in _execute'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:551:in `call'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:551:in `do_request'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:561:in `channel_request'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:205:in `process'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:269:in `wait'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:164:in `block (2 levels) in _execute'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:514:in `call'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:205:in `process'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:166:in `block in _execute'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:123:in `tap'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:123:in `_execute'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:76:in `capture'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/capistrano-rvm-0.1.1/lib/capistrano/tasks/rvm.rake:8:in `block (3 levels) in <top (required)>'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/sshkit-1.4.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => rvm:check
(See full trace by running task with --trace)

How do I load capistrano-rvm only in staging?
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.