I'm trying to deploy a Rails app on an Apache2 server by using Phusion Passenger. While everything works well locally, I am getting the infamous "Bundler::GemNotFound" error while deploying:
Could not find abstract-1.0.0 in any of the sources (Bundler::GemNotFound)
All my gems are installed in my local home folder. Thus the passenger configuration lines from my Apache2 configuration file are as follows:
LoadModule passenger_module /home/regis/.gem/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
PassengerRoot /home/regis/.gem/gems/passenger-3.0.7
PassengerRuby /usr/bin/ruby1.8
I understand you would need more information to analyse the issue at hand, but I have no idea on how to diagnose this further.
Try doing bundle install --path vendor/cache
Related
I'm running multiple websites on Apache with Passenger 4.0.45 on a CentOS server. I have multiple ruby versions installed too with rvm 1.25.27 and for the past 3 years I'm using Ruby 2.1.2 version.
I have now started a new application with Rails 5.1 and I've needed to install Ruby 2.4.2. After deployed my application I'm getting an Internal Server Error and here it is the error I'm getting on error log:
App 10033 stderr: /usr/local/rvm/gems/ruby-2.1.2#rails-4.0/gems/passenger-4.0.45/lib/phusion_passenger/request_handler.rb:356:in `trap'
App 10033 stderr: :
App 10033 stderr: Invalid argument - SIGKILL
App 10033 stderr: (
App 10033 stderr: Errno::EINVAL
App 10033 stderr: )
I've noticed that the ruby version that shows up is ruby-2.1.2#rails-4.0 and I think it should be 2.4.2 because is the version that I'm specifying on VirtualHost file:
<VirtualHost *:80>
ServerName example.com
DocumentRoot /.../current/public
PassengerRuby /home/user/.rvm/wrappers/ruby-2.4.2#global/ruby
<Directory
/home/user/.../current/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
I've read about this bug on https://github.com/phusion/passenger/issues/1362 but I don't know if I can update Passenger without messing up other sites that I'm running with old versions of Ruby.
I've found the answer to my question. I will explain what I did:
rvm install 2.4.2 (Install Ruby version 2.4.2)
rvm use 2.4.2 (Use Ruby 2.4.2 version)
gem install passenger (Install Passenger gem)
passenger-install-apache2-module (This will guide you throught the installation of the Passenger module for Apache. It takes around 3 minutes)
After the installation process of the Passenger module, I've updated my httpd.conf file with new LoadModule and PassengerRoot specified by the installation summary)
rvmsudo passenger-config validate-install (Check if Passenger installed correctly)
sudo service httpd restart (Restart Apache)
After did the above commands, my new application with Rails 5.1 is working as well as every other site in the server running on lower Ruby/Rails versions.
I've installed passanger to run as apache module, I installed passenger with gem install passenger as my user ruby in a rvm gemset while running ruby 2.1.2.
On apache this is my main configuration for passenger:
LoadModule passenger_module /home/ruby/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.50/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /home/ruby/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.50
PassengerDefaultRuby /home/ruby/.rvm/gems/ruby-2.1.2/wrappers/ruby
PassengerResolveSymlinksInDocumentRoot on
</IfModule>
My project uses a different ruby version and I want to use it, so on my virtualhost I'm setting PassengerRuby
PassengerRuby /home/ruby/.rvm/gems/ruby-2.2.1#estas/wrappers/ruby
It exists, and I can use that ruby#gemset to launch for example rails console.
But when I go to the url it raises an error complaining about missing gems.
Could not find rake-10.4.2 in any of the sources (Bundler::GemNotFound)
/home/ruby/.rvm/gems/ruby-2.1.2/gems/bundler-1.7.2/lib/bundler/spec_set.rb:92:in `block in materialize'
....
Ruby interpreter command
/home/ruby/.rvm/gems/ruby-2.1.2/wrappers/ruby
Environment variables
rvm_bin_path = /home/ruby/.rvm/bin
GEM_HOME = /home/otheruser/deploy/shared/bundle/ruby/2.1.0
SHELL = /bin/bash
IRBRC = /home/ruby/.rvm/rubies/ruby-2.1.2/.irbrc
PASSENGER_DEBUG_DIR = /tmp/passenger.spawn-debug.XXXXU7p7Dp
MY_RUBY_HOME = /home/ruby/.rvm/rubies/ruby-2.1.2
PATH = /home/ruby/.rvm/gems/ruby-2.1.2/bin:/home/ruby/.rvm/gems/ruby-2.1.2#global/bin:/home/ruby/.rvm/rubies/ruby-2.1.2/bin:/home/ruby/.rvm/gems/ruby-2.2.1#myproject/bin:/home/ruby/.rvm/gems/ruby-2.2.1#global/bin:/home/ruby/.rvm/rubies/ruby-2.2.1/bin:/home/ruby/.rvm/bin:/usr/local/jdk/bin:/home/otheruser/perl5/bin:/usr/local/jdk/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin:/usr/local/bin:/usr/X11R6/bin:/home/otheruser/bin
Im curious about the PATH, why does it has both ruby-2.1.2 and ruby-2.2.1? when running passenger, what sets this PATH?
What I'm doing wrongly or why this is not working? I'm doing this project to learn about capistrano and passenger, any help will be greatly appreciated.
I'm having a problem with deploying my rails app on my server. I'm deploying using Passenger for serving up pages. The following error is listed on my page when I start the server. It seems like the version of passenger I have installed is referencing ruby 1.8.7 but my app has been built in 2.0.0. I've tried removing ruby 1.8.7 and reinstalling Passenger, but no luck so far. If I run ruby -v from my directory it lists the version as 2.0.0.
Your Ruby version is 1.8.7, but your Gemfile specified 2.0.0 (Bundler::RubyVersionMismatch)
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0#global/gems/bundler-1.3.4/lib/bundler/definition.rb:361:in ` validate_ruby!'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0#global/gems/bundler-1.3.4/lib/bundler.rb:116:in `setup'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p0#global/gems/bundler-1.3.4/lib/bundler/setup.rb:17
/usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:59:in `gem_original_require'
/usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:59:in `require'
/var/lib/gems/1.8/gems/passenger- 4.0.0.rc4/lib/phusion_passenger/loader_shared_helpers.rb:212:in `run_load_path_setup_code'
/var/lib/gems/1.8/gems/passenger-4.0.0.rc4/helper-scripts/rack-preloader.rb:73:in `preload_app'
/var/lib/gems/1.8/gems/passenger-4.0.0.rc4/helper-scripts/rack-preloader.rb:127
My apache2.conf file has the following additions:
Include sites-enabled/
<ifmodule mod_ssl.c>
NameVirtualHost *:443
</ifmodule>
LoadModule passenger_module /var/lib/gems/1.8/gems/passenger 4.0.0.rc4/libout/apache2/mod_passenger.so
PassengerRoot /var/lib/gems/1.8/gems/passenger-4.0.0.rc4
PassengerRuby /usr/bin/ruby1.8
Edit: ANSWER
I was using sudo to install passenger and apache2 module. Should have just typed:
gem install passenger -pre
passenger-install-apache2-module
WITHOUT sudo.
your passenger config is pointing to ruby 1.8
LoadModule passenger_module /var/lib/gems/1.8/gems/passenger 4.0.0.rc4/libout/apache2/mod_passenger.so
PassengerRoot /var/lib/gems/1.8/gems/passenger-4.0.0.rc4
PassengerRuby /usr/bin/ruby1.8
It should probably look something like this...
LoadModule passenger_module /var/lib/gems/2.0.0/gems/passenger 4.0.0.rc4/libout/apache2/mod_passenger.so
PassengerRoot /var/lib/gems/2.0.0/gems/passenger-4.0.0.rc4
PassengerRuby /usr/bin/ruby2.0.0
Passenger installation is very helpful and it prints these lines for you on the console after successful installation. You should just copy those lines and paste them into your apache conf
You should try install passenger again.
This is why I switched from using RVM to RBENV. You won't run into this problem with RBENV. Plus its just better.
If you upgrade ruby using RVM on your production server, you'll be forced to reinstall passenger/nginx (in your case it looks like just passenger).
Huge pain, and causes server downtime.
Use RBENV instead to save yourself this headache. With RBENV/Capistrano, upgrading can simply be done via your gemfile, and the rest just works.
I've installed Apache2 and it runs okay.
And I've installed rvm following this link.
After that, I've execute follow commands as its order. Actually some of these commands are from this link installing redmine.
rvm install 1.8.7
rvm use 1.8.7
gem install rails -v=2.3.5
gem install postgres-pr pq
gem install i18n -v=0.4.2
gem install passenger
passenger-install-apache2-module
and append this to apache2.conf
LoadModule passenger_module /home/myhome/.rvm/gems/ruby-1.8.7-p330/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
PassengerRoot /home/myhome/.rvm/gems/ruby-1.8.7-p330/gems/passenger-3.0.2
PassengerRuby /home/myhome/.rvm/wrappers/ruby-1.8.7-p330/ruby
This is log for Apache after restart
[notice] Apache/2.2.16 (Ubuntu) PHP/5.3.3-1ubuntu9.3 with Suhosin-Patch Phusion_Passenger/3.0.2 configured -- resuming normal operations
But!!!, if I open my redmine root page, it just shows file list in public directory. I think Passenger may not work correctly.
Why? and how to fix this? I've tried everything what I can do for 2 days T-T
Have you added this section to apache config? It tells apache that you are using Rails application:
<VirtualHost :*80>
ServerName myapp
DocumentRoot /root-to-your-path/public
</VirtualHost>
And restarted Apache? Read more here: http://www.modrails.com/documentation/Users%20guide%20Apache.html#_deploying_a_ruby_on_rails_application
You should view the Passenger Integration guide from RVM, or the more detailed guide from Phusion (the makers of Passenger).
Note that in Phusion's guide, you should omit the --pre when installing the gem, as the guide was written when Passenger 3 was still in beta.
I've got a fresh install of Ruby EE (1.8.6-20090610) and Passenger (2.2.5) on Debian Lenny. REE is installed in /opt/ruby-enterprise and it is added to the $PATH of all users through /etc/environment, and PassengerDefaultUser is set to root. The problem is when loading a rails app, the Passenger error says the rails 2.3.3 gem is missing. However it was installed with Passenger and a rails -v as root says it's there. What could be going wrong?
Found the error:
PassengerRuby /usr/bin/ruby1.8
should have been
PassengerRuby /opt/ruby-enterprise/bin/ruby