Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rvm_path setting not picking up #124

Closed
trustarun opened this issue Jun 11, 2013 · 26 comments
Closed

rvm_path setting not picking up #124

trustarun opened this issue Jun 11, 2013 · 26 comments

Comments

@trustarun
Copy link

My server have system wide install of rvm at /usr/local/rvm/scripts/rvm .

when I try to set it in my deploy.rb as below

set :rvm_path, "/usr/local/rvm/scripts/rvm"

it is not getting set and so when I try to deploy, it fail with below error message

! Ruby Version Manager not found
! If RVM is installed, check your :rvm_path setting.

I also tried with set_default
set_default :rvm_path, "/usr/local/rvm/scripts/rvm"

But problem is still there.

when I tried by hardcoding the path in below file of the gem it work smoothly:
https://github.com/nadarei/mina/blob/master/lib/mina/rvm.rb

Below is the modification:

original line:
set_default :rvm_path, "$HOME/.rvm/scripts/rvm"

hardcoded line by me:
set_default :rvm_path, "/usr/local/rvm/scripts/rvm"

So, now it work, but hardcoding the path is not a solution for me or any one else.

can you guide me what going wrong here....

I have seen the online documentation of all the possible settings ( http://nadarei.co/mina/settings/ ) and find that you do not list rvm_path there.

is the gem not supporting this setting currently ..???

@anbu5
Copy link

anbu5 commented Nov 19, 2013

I get the same error and I could see rvm in the path. Did you get this working?

@jabbajac
Copy link

jabbajac commented Feb 6, 2014

wow umm so same problem....anyone with a solutions?

Edit: umm so actually I just got it working...I apparently misspelled something -.-. False alarm!

@zolzaya
Copy link

zolzaya commented Feb 13, 2014

Same here :(

@trustarun
Copy link
Author

Those who have made it work can please tell me what made it to work.
Actually due to the above RVM issue I moved to Capistrano to automate my deployment.

@jabbajac
Copy link

I ended up having to use the path that is provided when you do rvm info. That seems to work.

Edit: I was mistaken. It's not which rvm, you should run rvm info and you'll be able to get the rvm path. You still need to attach /scripts/rvm to the end of the path you get from rvm info

@zolzaya
Copy link

zolzaya commented Feb 16, 2014

I have a exact same problem. Is anybody solve it? I hardcoded set_default :rvm_path, "/usr/local/rvm/scripts/rvm" but not luck :(

@jabbajac
Copy link

@zolzaya pretty sure the hardcoded path should be something along the lines of /usr/local/.rvm/scripts/rvm. Check for the . in front of the first rvm, it's sneaky.

@zolzaya
Copy link

zolzaya commented Feb 16, 2014

Thank you for reply. But it's not work for me :(. How to find that path? I run which rvm. It shows me /usr/local/rvm/bin/rvm

@jabbajac
Copy link

hmm sorry the command is actually rvm info and you'll have to tack on /scripts/rvm to the end of the path you get from rvm info. Although it does look like you have the right path. what kind of error are you getting?

@zolzaya
Copy link

zolzaya commented Feb 16, 2014

Here the full output of rvm info command:

root@user:~# rvm info

ruby-2.0.0-p353@rails-4.1:

  system:
    system:      "ubuntu/13.10/x86_64"
    bash:        "/bin/bash => GNU bash, version 4.2.45(1)-release (x86_64-pc-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.25.18 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
    updated:      "2 days 21 hours 49 minutes 14 seconds ago"
    path:         "/usr/local/rvm"

  ruby:
    interpreter:  "ruby"
    version:      "2.0.0p353"
    date:         "2013-11-22"
    platform:     "x86_64-linux"
    patchlevel:   "2013-11-22 revision 43784"
    full_version: "ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux]"

  homes:
    gem:          "/usr/local/rvm/gems/ruby-2.0.0-p353@rails-4.1"
    ruby:         "/usr/local/rvm/rubies/ruby-2.0.0-p353"

  binaries:
    ruby:         "/usr/local/rvm/rubies/ruby-2.0.0-p353/bin/ruby"
    irb:          "/usr/local/rvm/rubies/ruby-2.0.0-p353/bin/irb"
    gem:          "/usr/local/rvm/rubies/ruby-2.0.0-p353/bin/gem"
    rake:         "/usr/local/rvm/rubies/ruby-2.0.0-p353/bin/rake"

  environment:
    PATH:         "/usr/local/rvm/gems/ruby-2.0.0-p353@rails-4.1/bin:/usr/local/rvm/gems/ruby-2.0.0-p353@global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p353/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
    GEM_HOME:     "/usr/local/rvm/gems/ruby-2.0.0-p353@rails-4.1"
    GEM_PATH:     "/usr/local/rvm/gems/ruby-2.0.0-p353@rails-4.1:/usr/local/rvm/gems/ruby-2.0.0-p353@global"
    MY_RUBY_HOME: "/usr/local/rvm/rubies/ruby-2.0.0-p353"
    IRBRC:        "/usr/local/rvm/rubies/ruby-2.0.0-p353/.irbrc"
    RUBYOPT:      ""
    gemset:       "rails-4.1"

I can't find /scripts/rvm from that result. BTW, I'm getting below errors:

 !     Ruby Version Manager not found
 !     If RVM is installed, check your :rvm_path setting.

 !     Command failed.
       Failed with status 1

@jabbajac
Copy link

it shows your rvm path to be /usr/local/rvm, you just gotta add the /scripts/rvm to the end of that. I just know that it works in my case, but I don't have a great understanding. It looks like you had the right path initially. What's the error that you're getting so that it doesn't work?

@zolzaya
Copy link

zolzaya commented Feb 16, 2014

It's not work :( The error is exactly same Ruby Version Manager not found. BTW thank you for advice :)

@jabbajac
Copy link

I'm not really sure what else to look at. If you want you can put your deploy.rb file on pastebin and link it up here. The only thing I can think of is to make sure you have require 'mina/rvm' uncommented as well. Also on the target machine, I just want to confirm that you have rvm and ruby installed for multi-user access right?

@zolzaya
Copy link

zolzaya commented Feb 17, 2014

Thank you for trying to help me :). I'm installed multi-user. Here is the deploy.rb. For security reason I removed domain, deploy_to, repository configs.

require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
# require 'mina/rbenv'  # for rbenv support. (http://rbenv.org)
require 'mina/rvm'    # for rvm support. (http://rvm.io)

# Basic settings:
#   domain       - The hostname to SSH to.
#   deploy_to    - Path to deploy into.
#   repository   - Git repo to clone from. (needed by mina/git)
#   branch       - Branch name to deploy. (needed by mina/git)

set :branch, 'master'

# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
# They will be linked in the 'deploy:link_shared_paths' step.
set :shared_paths, ['config/database.yml', 'log']

# Optional settings:
set :user, 'root'    # Username in the server to SSH to.
#   set :port, '30000'     # SSH port number.

# ISSUE: https://github.com/nadarei/mina/issues/124
# set_default :rvm_path, '/usr/local/rvm/scripts/rvm'
# set_default :rvm_path, '/usr/local/rvm/bin/rvm'
set_default :rvm_path, '/usr/local/rvm/scripts/rvm'

# This task is the environment that is loaded for most commands, such as
# `mina deploy` or `mina rake`.
task :environment do
  # If you're using rbenv, use this to load the rbenv environment.
  # Be sure to commit your .rbenv-version to your repository.
  # invoke :'rbenv:load'

  # For those using RVM, use this to load an RVM version@gemset.
  invoke :'rvm:use[ruby-2.0.0-p353@rails-4-1]'
end

# Put any custom mkdir's in here for when `mina setup` is ran.
# For Rails apps, we'll make some of the shared paths that are shared between
# all releases.
task :setup => :environment do
  queue! %[mkdir -p "#{deploy_to}/shared/log"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/log"]

  queue! %[mkdir -p "#{deploy_to}/shared/config"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config"]

  queue! %[touch "#{deploy_to}/shared/config/database.yml"]
  queue  %[echo "-----> Be sure to edit 'shared/config/database.yml'."]
end

desc "Deploys the current version to the server."
task :deploy => :environment do
  deploy do
    # Put things that will set up an empty directory into a fully set-up
    # instance of your project.
    invoke :'git:clone'
    invoke :'deploy:link_shared_paths'
    invoke :'bundle:install'
    invoke :'rails:db_migrate'
    invoke :'rails:assets_precompile'

    # to :launch do
    #   queue "touch #{deploy_to}/tmp/restart.txt"
    # end
  end
end

# For help in making your deploy script, see the Mina documentation:
#
#  - http://nadarei.co/mina
#  - http://nadarei.co/mina/tasks
#  - http://nadarei.co/mina/settings
#  - http://nadarei.co/mina/helpers

Added my gemsets:

root@user:~# rvm gemset list

gemsets for ruby-2.0.0-p353 (found in /usr/local/rvm/gems/ruby-2.0.0-p353)
   (default)
   global
=> rails-4-1

@jabbajac
Copy link

Hmm the only thing I can think of that could affect you is I have it as invoke :'rvm:use[2.1.0]'. I'm using Ruby v2.1.0 so I think yours should be something like invoke :'rvm:use[2.0.0]'. Hopefully that works. The rest seems to be the same as mine.

@zolzaya
Copy link

zolzaya commented Feb 17, 2014

Not work. I'm just give up :(

@jabbajac
Copy link

@zolzaya Sorry. I wish I could help more but I'm actually pretty limited in my understanding of how to use mina. I sort of just hacked the default to work with my project. I keep meaning to go and read over the documentation when I get a chance but unfortunately that chance hasn't come up yet. Hopefully someone with an answer to your question can help you out. I'd say try stackoverflow and see if you can find someone on there to help.

Best of luck!
J

@skelz0r
Copy link

skelz0r commented Feb 25, 2014

rvm_path is already used by rvm scripts :

~$ echo $rvm_path
/usr/local/rvm

I only changed rvm_path to another variable name in order to fix this issue.

@jbasdf
Copy link

jbasdf commented Feb 28, 2014

I get the same problem:
! Ruby Version Manager not found
! If RVM is installed, check your :rvm_path setting.

! Command failed.
Failed with status 1

I double checked several times. rvm is installed in the location I specified using rvm_path.

EDIT: I'll fess up and say that it turns out I was being stupid and using the rvm path on my local machine. Hopefully this can help someone else - you want to use the rvm path on the server not your local machine.

@NazarK
Copy link

NazarK commented Apr 1, 2014

in my case worked ("set" instead of "set_default"):
set :rvm_path, '/usr/local/rvm/scripts/rvm'

@wmuengineer
Copy link

That set command fixed it for me! Thanks @NazarK

@d4be4st d4be4st closed this as completed Jul 5, 2015
@helloyokoy
Copy link

thanks , use "set :rvm_path "
it works ~

@sintro
Copy link

sintro commented Apr 21, 2016

Still have problem. The exact error message:

 mina setup                                                                                                                                 ⏎ master ✭   -       sh: 2: [[: not found
-       sh: 8: source: not found
-       sh: 9: rvm: not found
-----> Using RVM environment 'ruby-2.2.2-p95@default'

 !     Command failed.
       Failed with status 1 (1)

My deploy.rb:

require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
# require 'mina/rbenv'  # for rbenv support. (http://rbenv.org)
require 'mina/rvm'    # for rvm support. (http://rvm.io)

# Basic settings:
#   domain       - The hostname to SSH to.
#   deploy_to    - Path to deploy into.
#   repository   - Git repo to clone from. (needed by mina/git)
#   branch       - Branch name to deploy. (needed by mina/git)

----- private info -----

# For system-wide RVM install.
set :rvm_path, '/usr/local/rvm/bin/rvm'

# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
# They will be linked in the 'deploy:link_shared_paths' step.
set :shared_paths, ['config/database.yml', 'config/secrets.yml', 'log']

# Optional settings:
  set :user, 'deployer'    # Username in the server to SSH to.
#   set :port, '30000'     # SSH port number.
#   set :forward_agent, true     # SSH forward_agent.

# This task is the environment that is loaded for most commands, such as
# `mina deploy` or `mina rake`.
task :environment do
  # If you're using rbenv, use this to load the rbenv environment.
  # Be sure to commit your .ruby-version or .rbenv-version to your repository.
  # invoke :'rbenv:load'

  # For those using RVM, use this to load an RVM version@gemset.
  invoke :'rvm:use[ruby-2.2.2-p95@default]'
end

# Put any custom mkdir's in here for when `mina setup` is ran.
# For Rails apps, we'll make some of the shared paths that are shared between
# all releases.
task :setup => :environment do
  queue! %[mkdir -p "#{deploy_to}/#{shared_path}/log"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/log"]

  queue! %[mkdir -p "#{deploy_to}/#{shared_path}/config"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/config"]

  queue! %[touch "#{deploy_to}/#{shared_path}/config/database.yml"]
  queue! %[touch "#{deploy_to}/#{shared_path}/config/secrets.yml"]
  queue  %[echo "-----> Be sure to edit '#{deploy_to}/#{shared_path}/config/database.yml' and 'secrets.yml'."]

  if repository
    repo_host = repository.split(%r{@|://}).last.split(%r{:|\/}).first
    repo_port = /:([0-9]+)/.match(repository) && /:([0-9]+)/.match(repository)[1] || '22'

    queue %[
      if ! ssh-keygen -H  -F #{repo_host} &>/dev/null; then
        ssh-keyscan -t rsa -p #{repo_port} -H #{repo_host} >> ~/.ssh/known_hosts
      fi
    ]
  end
end

desc "Deploys the current version to the server."
task :deploy => :environment do
  to :before_hook do
    # Put things to run locally before ssh
  end
  deploy do
    # Put things that will set up an empty directory into a fully set-up
    # instance of your project.
    invoke :'git:clone'
    invoke :'deploy:link_shared_paths'
    invoke :'bundle:install'
    invoke :'rails:db_migrate'
    invoke :'rails:assets_precompile'
    invoke :'deploy:cleanup'

    to :launch do
      queue "mkdir -p #{deploy_to}/#{current_path}/tmp/"
      queue "touch #{deploy_to}/#{current_path}/tmp/restart.txt"
    end
  end
end

# For help in making your deploy script, see the Mina documentation:
#
#  - http://nadarei.co/mina
#  - http://nadarei.co/mina/tasks
#  - http://nadarei.co/mina/settings
#  - http://nadarei.co/mina/helpers

What I did is changed user to 'deployer' and changed rvm_path

set :rvm_path, '/usr/local/rvm/bin/rvm'

If I just connect through terminal to ssh as deployer, rvm works fine.

PS I am using rbenv on local machine, I hope I don`t need to have rvm on local for correct mina operation?

@AlfredoRoca
Copy link

I don't see your repository var:
set :repository, 'git@...

@sintro
Copy link

sintro commented Apr 24, 2016

I have cut that in '----- private info -----'.

Actually, I found the source of half of my problems. It was default system shell of Ubuntu, which I use as server OS. It has dash, not bash. The point is dash even don't have 'source' command, which is heavily used in mina. Dash has '.' command in place of 'source'.
So I changed dash to bash as default shell and all the weird errors are gone... But appeared new, more common errors with RVM. mina deploy just can not see it. mina ssh too.
For now i temporarily solved the issue by manually sourcing all needed env vars and paths for my Ruby. Mina`s rvm package could not help me in this case. Hope this is problem with Ubuntu, not Mina.

@shah743
Copy link

shah743 commented Oct 27, 2018

use rvm_use_path path
set :rvm_use_path, '/usr/local/rvm/scripts/rvm'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests