default_env not working as intended
I noticed some strange behaviour while working on a remote server w/rbenv system-installed. I was trying to fix the default PATH variable removing the comment on the line
set :default_env, { path: '/opt/rbenv/shims:opt/rbenv/bin:$PATH' }
my console outputs:
me@localhost > bundle exec cap staging deploy:restart
INFO [c501cf64] Running rbenv on some.ip.address
DEBUG [c501cf64] Command: ( PATH=/opt/rbenv/shims:opt/rbenv/bin:$PATH rbenv )
DEBUG [c501cf64] bash: rbenv: command not found
lurking on sources i can confirm that capistrano is correctly setting the default_env variable. So it is probably related on the sshkit dependancy or some misconfiguration in the capistrano sources.
bad place to post this issue. I am moving it.
I've got the same problem, where did you move this post?
This is a wrong way of using rbenv over modified PATH. You can easily add https://github.com/capistrano/rbenv to your config and the problem will be solved.
@DonGiulio the issue was moved here https://github.com/capistrano/capistrano/issues/675
@kirs I've got the same problem of $PATH in default_env not being translated when executing mkdir.
As I mentioned in capistrano/capistrano#675. For this reason I believe the problem goes beyond the rbenv.
@palominoz thanks
Don't, you're doing it wrong expanding path that way will NEVER be supported.
Sent from my Nexus 4. On 29 Nov 2013 12:59, "DonGiulio" [email protected] wrote:
@kirs https://github.com/kirs I've got the same problem of $PATH in default_env not being translated when executing mkdir.
As I mentioned in capistrano/capistrano#675https://github.com/capistrano/capistrano/issues/675. For this reason I believe the problem goes beyond the rbenv.
@palominoz https://github.com/palominoz thanks
— Reply to this email directly or view it on GitHubhttps://github.com/capistrano/documentation/issues/30#issuecomment-29512300 .
@leehambley thanks, I don't understand what I'm supposed to do, I'm trying to get RVM with https://github.com/fnichol/chef-rvm to install rubies and gems.
What am I supposed to do instead in order to use it?
Sorry, I can't get the idea of how chef cookbook is connected with PATH variable in Capistrano.
If you mean you want to deploy with RVM support, there is a great capistrano-rvm extension to do that. It will add wrappers to your commands so you won't need to modify PATH.
Hi, I'm sorry I should have explained better.
I'm using chef to install ruby and the bundler gem, I'm incurring in an issue where the bundle is installed nicely for all users and it works, though capistrano runs it with sudo, and I'm getting the following problem:
vagrant@berkshelf:~$ which bundle
/home/vagrant/.rvm/gems/ruby-2.0.0-p353@global/bin/bundle
vagrant@berkshelf:~$ sudo which bundle
/usr/bin/bundle
the sudo user uses the default bundler, which doesn't work. I was told that by specifying the default_env I could solve this, but really only got in more troubles.
any clue?
I figured that it wasn't the sudo, but the fact that capistrano runs the commands in a non interactive shell, where the .bashrc script quits right at the beginning.
I moved the init scripts of RVM at the beginning of .bashrc and now the problem is fixed.
thanks a lot for the support,
There's a lot more about that in the FAQ. see the "why SSH" link on the left, capistranorb.com
Sent from my Nexus 4. On 30 Nov 2013 00:42, "DonGiulio" [email protected] wrote:
I figured that it wasn't the sudo, but the fact that capistrano runs the commands in a non interactive shell, where the .bashrc script quits right at the beginning.
I moved the init scripts of RVM at the beginning of .bashrc and now the problem is fixed.
thanks a lot for the support,
— Reply to this email directly or view it on GitHubhttps://github.com/capistrano/documentation/issues/30#issuecomment-29541647 .
@leehambley Thank you for pointing this out, I've spent hours hunting this issue down, what you said was the real cause for me.