I have a ROR app (version 6.1.4.1) with Ruby 2.7.4 on a Raspberry Pi 4 with 4 GB RAM and a 32 GB SD card. I installed Passenger 6.0.12 using the tarball installation and am running it with nginx. passenger start in the app directory works successfully, but when I try running it as with nginx (/opt/nginx/sbin/nginx) on port 80, I get the above error when visiting the site.
I'm accessing the app via IP address, which is configured in the nginx.conf and the app is installed in /home/pi/src/bogie_can. There is a .bundle directory with a config file in the app directory, and that's where the gems are installed. I'm running the app in "development" mode, which is configured in the server section of the nginx.conf file using passenger_app_env.
The specific error is that the app cannot find racc-1.5.2. The Bundler info is #<struct Bundler::Settings::Path explicit_path="/home/pi/src/bogie_can/.bundle", system_path=false, default_install_uses_path=false>.. So, we note that the .bundle path is correct and in the .bundle/ruby/2.7.0/gems/ directory, racc-1.5.2 is indeed installed and owned by the user "pi".
I've cleared out old bundle installations and tried switching the app user from pi to root (which was nobody) and back. Also, I'm using rbenv, so I also ran rbenv rehash after the fresh bundle install. I've also carefully reviewed the "Detailed diagnostics" from the Passenger error page (which is super helpful!) and do not see anything that is obviously wrong.
Using the Passenger error page as a guide, it seems that:
The gems are indeed installed as needed
The user, either root or pi, have permissions to access the gems
pi is a reasonable user to run the app
The passenger_root and passenger_ruby are coming from the passenger-config about subcommands and are verified as well.
At this point, there must be some configuration I've overlooked or gotten wrong and I would greatly appreciate some questions and pointers.
I found the root cause of the problem.
I had set passenger_ruby to the result of passenger-command about ruby-command, which gave me:
passenger-config was invoked through the following Ruby interpreter:
Command: /usr/bin/ruby2.7
Version: ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [arm-linux-gnueabihf]
To use in Apache: PassengerRuby /usr/bin/ruby2.7
To use in Nginx : passenger_ruby /usr/bin/ruby2.7
To use with Standalone: /usr/bin/ruby2.7 /usr/src/passenger-6.0.12/bin/passenger start
The following Ruby interpreter was found first in $PATH:
Command: /home/pi/.rbenv/shims/ruby
Version: ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [arm-linux-gnueabihf]
To use in Apache: PassengerRuby /home/pi/.rbenv/shims/ruby
To use in Nginx : passenger_ruby /home/pi/.rbenv/shims/ruby
To use with Standalone: /home/pi/.rbenv/shims/ruby /usr/src/passenger-6.0.12/bin/passenger start
I was using /usr/bin/ruby2.7 and having the problem with racc not being found. I switched it to use the rbenv shim and Passenger was able to correctly find all the gems in the [APP_ROOT]/.bundle/ directory
I also cleared out the default nginx installation, which was still trying to be started with nginx.service and then added my own /etc/init.d/nginx script and added it to the init.d database so that it now starts with the OS.
Related
I'm updating the passenger for my app with rvm. Afterwards I used passenger-config --root to find the passenger and added it to my nginx.conf. This is the directory:
shared/bundle/ruby/2.3.0/gems/passenger-5.0.30
I'm not sure why the passenger root is this one. I thought it'll be the one installed under .rvm. Anyway, I got this error:
Unable to start Phusion Passenger: Support binary PassengerAgent not found...
I am able to use back my previous passenger, and I noticed the difference is the new package has no buildout/support-binaries/PassengerAgent. Am I missing something here?
Setup:
Ubuntu 14.04
rvm 1.29.3
rails 4.2.10
ruby 2.3
capistrano 3
It seems that I installed passenger with rvm. So I need to follow the instructions here and run passenger-install-nginx-module to do it correctly.
I'm installing a new version of Redmine under Debian 8. I followed the steps described here: http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_on_Debian_8_with_Apache2-Passenger
I had some problems with passenger so I installed it using:
gem install passenger
passenger-install-apache2-module
I added
PassengerDefaultUser www-data
on the passenger confing file and on the appache config file as well to avoid permission problems
The problem is that passenger is still running as nobody.
result of top | grep "passenger" gives 3 process named PassengerAgent, 2 of them runs as root and one runs as nobody. What should I do to have the effect of the configuration i added?
I have :
Redmine version 3.3.0.stable
Ruby version 2.1.5-p273 (2014-11-13)
Rails version 4.2.6
Try to set www-data as owner for /config.ru file.
A month ago we completed testing a standard Rails Cloud Server install process.
We installed more than a dozen Cloud Servers running Rails applications. They we took a break from installing new applications. (all that to say the process was solid)
Today we built a new cloud server and installed one of the Rails applications we have previously installed successfully. We followed the same documented process at at the very end, when issuing the passenger start command
rvm-exec ruby-1.9.3-p286 ruby -S passenger start -p 4000 -e production > /dev/null & disown
we received this error message:
ruby: No such file or directory -- passenger (LoadError)
we have been searching and cannot find this error mentioned anywhere on the net.
Has anyone seen this error before?
After some exploration we determined the passenger gem had to be installed (again) in the global gemset. We knew the passenger gem was installed, but it was not found in any of the gemsets. Installing passenger explicitly in the global gemset resolved the problem.
I have just built a RackSpace cloud server with Ubuntu 12 LTS and performed a "standard" Ruby on Rails installation. I created a user (bob) and added it to the sudu group.
I then logged out of root and logged in as bob. Then issued sudo su from the /home/bob directory. I then installed everything needed to run the Rails Application 'as root'.
I then installed the Rails code in /home/bob and passenger started up when I issued:
RAILS_ENV=production passenger start -p 3000
however, since I want to run multiple Rails applications on this server, I then created another directory /home/bob/newapp and installed Rails code there. (ideally I would want to put all the different Rails applications in their own subdirectory below /home/bob)
When I issue the command (shown below) from /home/bob/newapp
RAILS_ENV=production passenger start -p 3000
I get
passenger: command not found
why is passenger only accessible from /home/bob ?
NEWS: just discovered, passenger is 'available' until the moment I complete the edit of the content of /config/database.yml thus as long as I do NOT edit the database.yml file, passenger will start. After I edit database.yml the "passenger: command not found" appears. How bizarre is that?
SNAP: looks like when I installed passenger it used Ruby-2.1.1 however the old application wants ruby-1.9.3-p194. I need to figure out how to get passenger to run with ruby 1.9.3 or install a second version of passenger (???)
More News:
Thank you,Hongli, for your response. I followed your links/suggestion to read the passenger documentation. I had read it before without recognizing the needed information. This time I found the "magical" command:
rvm-exec ruby-version ruby -S (eg: rvm-exec ruby-1.9.3-p194 ruby -S )
this has turned out to be very helpful, although I did end up following a process which has resulted in two different version of passenger being installed.
Read the About environment variables section of the Phusion Passenger manual to learn what "command not found" errors are, why they occur, and what you can generally do about them.
In your case, entering /home/bob automatically makes RVM change your PATH to include a specific Ruby version's bin directory. Read the When the system has multiple Ruby interpreters section of the Phusion Passenger manual to learn how to deal with that.
The article Hongli suggested I read definitely moved me in the correct direction.
The use of: rvm-exec 'ruby-version' ruby -S allows me to get passenger started, provided a version of passenger has been installed using the version of ruby required by the Rails application.
Thus if I load up a Rails application built with ruby-1.9.3-p194, I will need a version of passenger installed with the same version of ruby.
If I load up another Rails application built with ruby-1.9.3-p286, I will need a version of passenger installed with that version of ruby.
Then starting each version of passenger can be accomplished with the rvm-exec command with the appropriate ruby version.
Perhaps there is a more elegant solution, but the above works for me.
I've got a server that predominantly runs Ruby 1.8.7, but now I have a Rails 3.2 app that needs 1.9.3. I've installed Passenger 4 as it supports the ability to run multiple Rubies on a per-virtual server basis.
However, it appears that while you can assign a particular Ruby, the application doesn't have access to that Ruby's gemset. So I have my virtual server configured with the 1.9.3 Ruby, as confirmed on the error page my application now gives:
Ruby interpreter command
/home/aaron/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
But the GEM_HOME parameter tells a different story:
GEM_HOME = /home/aaron/.rvm/gems/ruby-1.8.7-p352
Looking through the configuration directives for Passenger 4, I see no way to specify a different gemset. Am I missing something, or is this thing just not ready for prime time?
From your gemset dir run:
$ passenger-config --ruby-command
It will tell you ruby path for Apache and Nginx.
Command: /home/deric/.rvm/wrappers/ruby-2.0.0-p247#my_gemset/ruby
Version: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
To use in Apache: PassengerRuby /home/deric/.rvm/wrappers/ruby-2.0.0-p247#my_gemset/ruby
To use in Nginx : passenger_ruby /home/deric/.rvm/wrappers/ruby-2.0.0-p247#my_gemset/ruby
Nginx: For Passenger 4 you can specify multiple ruby versions. So for specific server config:
your_site.conf:
server {
listen 80;
root /home/aaron/web/public;
passenger_enabled on;
passenger_ruby /home/aaron/.rvm/wrappers/ruby-2.0.0-p247#your_gemset/ruby;
}
nginx.conf: (this works for new passenger 4.0.17)
http {
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
}
Just run from your gemset dir this:
$ passenger-status
It will check whether passenger_native_support.so is available. Depending on your RVM installation, you might need to run it with rvmsudo
$ rvmsudo passenger-status
For Debian/Ubuntu there are now binary packages of nginx and passenger available which makes the installation much easier.
As Tombart pointed out: If you use the precompiled Passenger modules (in my case for for Apache2) you end up with a system up and running.
However, if using RVM I stumbled upon the fact that you need to use the "wrapper directory" to select the correct RVM ruby version and gemet like so in your Apache vhost config:
PassengerRuby /home/of_your_ruby_user/.rvm/wrappers/ruby-x.y.z-p123#gemset/ruby
This way Passenger knows how to find the correct gemset relative to this directory (../../gems/ruby-x.y.z-p123#gemset/gems). Otherwise Passenger would use the "standard ruby gemset" which is odd if you want to run multiple apps with the same ruby version. I can only guess that this is similar for Nginx.