Reputation: 1878
I have a rails 5 app. I was trying to hunt down a memory leak and it opened up a can of worms. One of the worms is rvm and deploy. I do not have
rvm_ruby_string
set anywhere in the project. If I go to the directory of the project, and do either
bundle exec ruby --version
or
ruby --version
both result in
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin14]
However, if I do
cap staging deploy
you can see it somehow picks up the wrong version:
DEBUG [778e15cb] Running /usr/bin/env which passenger as deploy@xxxx
DEBUG [778e15cb] Command: /usr/bin/env which passenger
DEBUG [778e15cb] /usr/bin/passenger
DEBUG [778e15cb] Finished in 0.710 seconds with exit status 0 (successful).
DEBUG [0da5c891] Running [ -d ~/.rvm ] as xxx
DEBUG [0da5c891] Command: [ -d ~/.rvm ]
DEBUG [0da5c891] Finished in 0.101 seconds with exit status 0 (successful).
DEBUG [f2734c3e] Running ~/.rvm/bin/rvm version as
xxx
DEBUG [f2734c3e] Command: ~/.rvm/bin/rvm version
DEBUG [f2734c3e] rvm 1.29.1 (latest) by Michal Papis, Piotr Kuczynski,
Wayne E.
Seguin [https://rvm.io/]
DEBUG [f2734c3e] Finished in 0.268 seconds with exit status 0 (successful).
rvm 1.29.1 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin
[https://rvm.io/]
DEBUG [a2e3d82a] Running ~/.rvm/bin/rvm current as xx
DEBUG [a2e3d82a] Command: ~/.rvm/bin/rvm current
DEBUG [a2e3d82a] ruby-2.5.0
Now if I simply try to mimic what capistrano says it's doing, by copying and pasting the following to the command line:
~/.rvm/bin/rvm current
I get
ruby-2.3.1
So, I'm stumped. Where is Capistrano pulling the rvm var from?
Upvotes: 1
Views: 509
Reputation: 7505
You are probably running cap staging deploy
as a different user then when you ran ruby --version
.
Based on the capistrano output, you are using deploy
user to deploy. If this is the case, you need to install ruby 2.3.1 as deploy
user, and set 2.3.1 to "default and current".
You can test this by running ruby --version
as both deploy
user and the other user you used to run it the first time.
Upvotes: 1