Capistrano & jruby & rvm - Bundler::GemNotFound: Could not find rake-0.9.2.2 in any of the sources - ruby-on-rails-3

I encountered Bundler::GemNotFound: Could not find rake-0.9.2.2 in any of the sources during deploying my application using capistrano, and when processing deploy:assets:precompile.
The command is:
cd /opt/app/deploy/entercamp/releases/20120627132117 && /usr/local/rvm/rubies/jruby-1.6.7/bin/jruby --1.9 -S bundle exec rake RAILS_ENV=staging RAILS_GROUPS=assets assets:precompile
I tried the command manually on the server and it works quite ok. And I could see that rake-0.9.2.2 is installed in the result output of bundle:install in the deploy process.
Where could be the problem?
Detailed information is in: https://gist.github.com/3005237

This just got fixed with help of Michal from rvm-capistrano project.
It raises this error is because jruby is install with version 1.8 by default and it tries to switch to 1.9 when deploying and that causes the problem.
The solution is to install jruby with version 1.9 by default: rvm install jruby-1.6.7.2 --1.9 and then it works.

Related

How do I `bundle install` with Chef?

I am using Chef to provision a CentOS 6.5 box and install my Rails 4.0.4 app.
I installed RVM and Ruby 2.1.1
When I cd my_website, RVM will set the correct ruby version (gemset).
How do I tell Chef to bundle with the correct ruby version
currently I am using this:
execute "bundle-install" do
user "my_user"
cwd "/home/my_user/website/"
command "bundle install"
action :run
end
But that is not enougth, it's still trying to use ruby 1.9.3
RVM is a shell-based Ruby version manager. Since the Chef Client runs as root, it probably isn't executing the login shell. So things like .rvmrc and the actual loading of RVM are ignored. Handling this with Chef is a bit complicated. I would recommend looking at Fletcher's chef-rvm cookbook.

cap deploy:migrations fails with Could not locate Gemfile

I'm working on my first rails deployment and having a problem I can't figure out.
mac osx 10.8.2
ruby 1.8.7
Rails 3.2.6
rvm 1.17.2
I've been following this tutorial http://brandnewrails.wordpress.com/ and got stuck on 7c.
I set it all up in RVM, got git running on the server, ran bundle install in the app, and wrote the Capistrano recipe in my_app/config/deploy.rb
Then I ran:
$ capify . no problem
$ cap deploy:setup no errors
$ cap deploy:check returned You appear to have all necessary dependencies installed
$ cap deploy:migrations is where the problem happens. After successfully running a bunch of the commands, capistrano fails. See below:
2012-12-10 00:43:56 executing `bundle_install'
* executing "cd /home/{servername}/party/releases/20121209134354 && bundle install --path vendor/bundle"
servers: ["{servername}"]
[{servername}] executing command
** [out :: {servername}] Could not locate Gemfile
command finished in 694ms
failed: "sh -c 'cd /home/alexchee/party/releases/20121209134354 && bundle install --path vendor/bundle'" on {servername}
Does anyone know what to do? When I check the app directory, the Gemfile is there. Any ideas or further questions?
The inability of capistrano to locate a Gemfile in this case seems to be a symptom of not having initiated git in the app locally, that is on my own computer.
My hunch is that since Gemfile is the first file in the list above, that is why it created an error first. If the program had continued, it would have probably had other errors as well.
Even if git is running on the server and the app is bundled up correctly, you must also initiate git locally and direct it to the appropriate files on your server in order for the deploy to work.
Great instructions are listed here: http://brandnewrails.wordpress.com/2012/10/14/lesson-7b/

git://github.com/ryanb/nested_form.git (at master) is not checked out. Please run `bundle install` (Bundler::GitError)

I have deployed my application on linux server with passenger and apache, I have done bundle install run successfully still i get
( git://github.com/ryanb/nested_form.git (at master) is not checked out. Please run bundle install (Bundler::GitError) ) error while i try to run my application
FYI, i am using rails 3.2.3 and ruby 1.9.3
This works fine on my development machine
Any Idea ?
I have currently solved the issue by running below
bundle pack
bundle install --path vendor/cache
This solves my problem, but it stores whole gems in the vendor directory
But still if anybody have better solution then please let me know
I had the same problem, I always installed my gems as system-wide gems (including the ones from github).
$ sudo bundle install
When I ran rails, I got the same error:
$ rails s
http://github.com/Sija/garb.git (at master) is not checked out. Please run `bundle install`
So when I ran:
$ bundle install
This installed the gems from github locally, but otherwise used all the other system-wide gems.
Then when I ran rails again, it worked.
Are you running bundle install as root? If yes, try running bundle install without "sudo", anyway this seems to be a permissions problem (as Google suggests [google => (at master) is not checked out. Please run bundle install (Bundler::GitError)])1

Capistrano + RVM rvm_install_ruby with Rubinius

I am trying to fully automate the setup of my deployment host, and so avoiding manual install of Ruby.
I am using capistrano-rvm as it promises to do the job, but I have a problem when RVM compiles Rubinius:
** [out] rbx-2.0.0pre - #configuring
** [out] rbx-2.0.0pre - #compiling
*** [err] Error running '/home/app/.rvm/wrappers/ruby-1.8.7-p358/rake install', please read /home/app/.rvm/log/rbx-2.0.0pre/rake.log
The content of /home/app/.rvm/log/rbx-2.0.0pre/rake.log is:
ERROR: Gem rake is not installed, run `gem install rake` first.
How could I? That should have been done by RVM, no?
Does anyone already met & get out of this issue?
EDIT
I forgot to mention that RVM did load & compile 1.8.7 before rbx, seems like a dependence for build. Maybe RVM is running in a gem set which is badly initialized?
I thought the 2.0.0pre was removed from rbx already, it looks like you have older RVM installation, make sure you update RVM:
curl -L get.rvm.io | bash -s stable --auto
rvm reload
This will run the installer which also makes update.
To make sure everything works properly use rbx-2.0.testing which is supposed to work version of rbx.

Java Runtime error when trying to install sunspot

i have seen other blogs and SO questions relating to this issue but none of them seem to help. I am trying to install sunspot with solr, however i keep getting an error when running the following command:
bundle exec rake sunspot:solr:start
The is the trace from running the command:
** Invoke sunspot:solr:run (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute sunspot:solr:run
/home/i7core/.rvm/gems/ruby-1.9.3-p125/bin/rake: No such file or directory - java -version
rake aborted!
You need a Java Runtime Environment to run the Solr server
My gemfile:
gem 'sunspot_rails', '~> 1.3.0'
gem 'sunspot_solr'
Seems like i do not have a java runtime environment, but i have already installed java. Not sure what to do. There have also been a few github issues and everthing seems to work with the latest version, but i still cannot get it to work. Please help.
One of the fast ways to install JRE on Ubuntu:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
You need the Java JRE installed, eather the Oracle version or OpenJDK one did fine for me. Additionally, make sure, the java executable is in your path that the rake task can see.