user502052
user502052

Reputation: 15259

Rvm - Capistrano integration on Linux Ubuntu

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?

Upvotes: 1

Views: 774

Answers (2)

mpapis
mpapis

Reputation: 53158

I have created example project for rvm/capistrano integration https://github.com/mpapis/ad

and you can see how easy it was to create deployment script here https://github.com/mpapis/ad/blob/master/config/deploy.rb

most important is to visit the server before deployment and install the proper ruby.

I will also add a new tasks to integration to install rvm/ruby -> https://github.com/wayneeseguin/rvm/issues/829

Upvotes: 0

Appleman1234
Appleman1234

Reputation: 16076

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 find or locate commands.

E.g.

find / -iname *rvm

or

locate rvm

In 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 in deploy.rb or replace ENV['rvm_path'] in the unshift command in the documentation of the first option at Using RVM rubies with Capistrano.

The paths in the deploy.rb are

/path/to/.rvm RVM Installation Path

'PATH' is the binary path that is used to call the rvm binary from.

See here for more information on PATH.

GEM_HOME is 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.

Upvotes: 1

Related Questions