How do I upgrade the version of Ruby used by Passenger when I update Ruby and its Gemlist using RVM and Capistrano? What is the best way to check if my application uses the correct ruby version and gemset?
I have a Rails application running on a Linode (Ubuntu) server, with NGinx and Passenger. Before he worked without any problems.
My application previously ran Ruby on Rails 3.2.16 with Ruby 1.9.3-p194
I use RVM to manage ruby versions both locally and on the server. After I installed Ruby-2.1.2 and updated the main gems (bundler, nokogiri, etc.), I created my new gemset for my application.
In development (locally), I use Ruby 2.1.2, rails 3.1.19 (before moving to Rails 4) and the specific gemset for this project.
I changed my deploy.rb for Capistrano following integration with RVM-Capistrano gem
require "rvm/capistrano" require "bundler/capistrano" set :user, "myusername" set :application, "myapp" set :deploy_to, "/home/#{user}/apps/#{application}" set :scm, :git set :repository, " git@github.com :myusername/#{application}.git" set :branch, "master" set :rvm_ruby_string, :local
Then I launched cap deploy
I updated my web page and the passenger throws the following errors:
It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this application needs. To install your gems, please run: bundle install ... Could not find rake-10.3.2 in any of the sources (Bundler::GemNotFound) /home/myusername/.rvm/gems/ ruby-1.9.3-p194@global /gems/bundler-1.5.3/lib/bundler/spec_set.rb:92:in `block in materialize' ... Ruby interpreter command /home/myusername/.rvm/gems/ruby-1.9.3-p194/wrappers/ruby
Passenger seems to still be running Ruby-1.9.3, not Ruby-2.1.2. I am not sure if RVM-Capistrano has installed / updated the Ruby version and the corresponding gemset. I'm not sure what I missed?
EDIT: I checked nginx.conf as root user in /opt/nginx/conf/nginx.conf
At the top of the file I found
... http { passenger_root /home/myusername/.rvm/gems/ruby-1.9.3-p194/gems/passenger-4.0.37; passenger_ruby /home/myusername/.rvm/gems/ruby-1.9.3-p194/wrappers/ruby; ... server { listen 80; server_name XXX.XXX.XX.XX myapp.com www.myapp.com *.myapp.com; root /home/myusername/apps/myapp/current/public; passenger_enabled on; client_max_body_size 4G; }
Does this mean that I need to change these lines using ruby-2.1.2? Is there a way to automate this change?
UPDATE 2: I changed nginx.conf
http { passenger_root /home/myusername/.rvm/gems/ ruby-2.1.2@rails3.2 /gems/passenger-4.0.53; passenger_ruby /home/myusername/.rvm/gems/ ruby-2.1.2@rails3.2 /wrappers/ruby;
and in my deploy.rb I explicitly say use gemset ruby-2.1.2@rails3.2
set :rvm_ruby_string, " 2.1.2@rails3.2 "
The application is working fine, Ruby Interpreter is still 1.9.3. I even printed the RUBY_VERSION constant on the admin page, and it displays 1.9.3
I do not understand...
thanks for the help