Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm trying to get capistrano working with rvm and passenger standalone. I had it working at one point, then capistrano suddenly started complaining about missing the bundle command. When I remove require 'bundler/capistrano', it no longer complains about missing bundle (and no longer attempts to bundle) but fails with the following:

...
* 2013-07-25 14:29:16 executing `deploy:restart'
* executing "if [[ -f /home/staging/capistrano/shared/tmp/pids/passenger.80.pid ]];\\\n      then\\\n        cd /home/staging/capistrano/current && rvmsudo passenger stop -p 80;\\\n      fi"
  servers: ["ccdev.dyndns.org"]
  [ccdev.dyndns.org] executing command
** [out :: ccdev.dyndns.org] sh: 1:
** [out :: ccdev.dyndns.org] [[: not found
** [out :: ccdev.dyndns.org]
  command finished in 13ms
* executing "cd /home/staging/capistrano/current && rvmsudo passenger start -e staging -p 80 -d"
  servers: ["ccdev.dyndns.org"]
  [ccdev.dyndns.org] executing command
** [out :: ccdev.dyndns.org] sh: 1:
** [out :: ccdev.dyndns.org] rvmsudo: not found
** [out :: ccdev.dyndns.org]
  command finished in 13ms
failed: "env rvmsudo_secure_path=1 sh -c 'cd /home/staging/capistrano/current && rvmsudo passenger start -e staging -p 80 -d'" on ccdev.dyndns.org

It seems evident that there's some path variable missing from the shell environment of my deploy user, but only when called from capistrano. All the commands in question work manually. I'm not sure where to start looking. The env rvmsudo_secure_path=1 is a result of default_run_options[:env] = {'rvmsudo_secure_path' => 1} at the top of staging.rb which stops an rvm error from showing and hanging the deploy process. It was present before when deploying worked.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

bundler/capistrano default settings are not always the best choice, this is why it is recommended in rvm-capistrano to reset those settings back to using standard ruby paths (called system in bundler - but has nothing to do with system itself)

I maintain example application https://github.com/mpapis/ad/blob/master/config/deploy.rb the minimal extract fro you would be:

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

set :bundle_dir, ''
set :bundle_flags, '--system --quiet'
set :bundle_without, [:development]
share|improve this answer
    
So with rvm-capistrano, how do I automate the bundle install task? –  Archonic Jul 29 '13 at 13:59
    
updated and added example –  mpapis Jul 30 '13 at 1:40
    
Ah, that's what I needed. Thanks! –  Archonic Jul 30 '13 at 19:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.