I am trying to properly use Capistrano and RVM in order to deploy my Ruby on Rails 3.2.2 application to the remote machine that is running Ubuntu 10.04 LTS. I read the “How do I configure capistrano to use my rvm version of Ruby” question/answer and the “Using RVM rubies with Capistrano” official documentation, but I have still some issues relating to the Rvm – Capistrano integration.
For example, relating to the integration via the rvm capistrano plugin (see the official documentation for more information), what I have to make exactly (since I didn’t understand where and how to put the related code)?
Or, relating to the integration via :default_environment (see the official documentation for more information), you should properly state the following code in the deploy.rb file:
set :default_environment, {
'PATH' => "/path/to/.rvm/gems/ree/1.8.7/bin:/path/to/.rvm/bin:/path/to/.rvm/ree-1.8.7-2009.10/bin:$PATH",
'RUBY_VERSION' => 'ruby 1.8.7',
'GEM_HOME' => '/path/to/.rvm/gems/ree-1.8.7-2010.01',
'GEM_PATH' => '/path/to/.rvm/gems/ree-1.8.7-2010.01',
'BUNDLE_PATH' => '/path/to/.rvm/gems/ree-1.8.7-2010.01' # If you are using bundler.
}
What those paths refer to? How can I retrieve path values running Linux Ubuntu?
And finally, what integration type do you advice to use?
Firstly ensure that rvm installed on the machine.
See RVM Installation Instructions
or RVM on Ubuntu 10.04 if rvm isn’t installed.
Then find where rvm is installed to, this can be done either using the
findorlocatecommands.E.g.
find / -iname *rvmor
locate rvmIn the output of these commands you will see something that looks like /somedirectory/someotherdirectory/.rvm/gees/somethingelse.
The
/somedirectory/someotherdirectory/is what you would replace/path/to/with indeploy.rbor replaceENV['rvm_path']in the unshift command in the documentation of the first option at Using RVM rubies with Capistrano.The paths in the
deploy.rbare/path/to/.rvmRVM Installation Path'PATH'is the binary path that is used to call the rvm binary from.See here for more information on PATH.
GEM_HOMEis the home directory of the Gem.See here for more information on Gems.
'GEM_PATH'is the PATH of the Gem.'BUNDLE_PATH'is the PATH of the Bundle.See here for more information on Bundles and Bundler.