So this is my problem. I used Capistrano to deploy my Rails 3 app to an Ubuntu server, which has Phusion Passenger 3 installed. Everything should have worked normal, but I kept getting this error message.
Could not locate Gemfile in /var/www/rails/releases/20100916074325. (Bundler::GemfileNotFound)
The directory in the error message (which I added for clarification) does exist on the system and so does the Gemfile. Underneath the error message, the stack trace showed the error is thrown inside
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/shared_helpers.rb
So I went in there and added outputs to check the existence of the the directories on that path, and every single one returned false all the way down to 'www'. I'm incredulous.
Why can't Bundler, running under Passenger, find these paths? What can I do to resolve it? (I'm about to give up on Passenger at this point.)
This is almost definitely a permission issue. That said, please try Phusion Passenger git master; we've added aggressive permission checks so now it should tell you exactly what's wrong and what needs fixing instead of letting things error out with cryptic error messages like what you're seeing now.
Bundler thinks the paths don't exist because of permission problems. Specifically: File.directory?("/a/b/c") returns false if /, /a or /a/b don't have the right executable bits for the current process's owner.
Related
Today I tried to install a gem using bundler. It complained about super-user privileges so I ran it to install to vendor/bundle, and then all of a sudden every page in my app returns HTTP 500 for seemingly no reason. I re-ran bundler to install globally, and that didn't solve the problem.
In typical rails fashion, it just exits with the 500 error page without printing anything to the logs. Routing is functioning normally, the console says it renders the appropriate view, and active record seems to be working as normal, but after all of that it just shows an error page. No errors on the console or in logs/.
I'm not sure why bundler would cause this issue but I'm completely out of ideas. I've done a good bit of googling but all of the other similar situations I've found were because of a misconfigured model or database, which I know with certainty isn't the case. If anyone more familiar with Rails than me could give me a place to start I'd be very grateful.
Update: Running bundler doctor fails b/c the directory /opt/rubies/ruby-2.6.5/lib/ruby/gems/2.6.0/bundler doesn't exist - looking for issues related to this.
Solved; ultimately this was because I forgot to delete an old requirement in application.js. It still seems absolutely ludicrous to me that rails would exit 500 without an error message with no way to access more verbose debug logs
Trying to run a project that was provided by a client.
I have the correct versions of Ruby, Gems, Rails, Bundler, Homebrew etc installed.
When I run rails server I get the following error in terminal.
.rvm/gems/ruby-2.2.2/gems/airbrake-ruby-1.0.4/lib/airbrake-ruby.rb:288:in `call_notifier': the 'default' notifier isn't configured (Airbrake::Error)
After much time spent on Google I couldn't find a fix on this.
Here is a screenshot of the whole terminal error message which I get the feeling these other lines could be related.
It looks like a previous developer may have hardcoded a commit hook in the application, pointing to a file in their local .git folder (and which you don't have).
I'd recommend either asking the developer to provide the missing file, create a dummy file in the same place, or removing that line.
I'm getting the following error using Passenger. This seems to only be a problem when using 2.3.11. How can I fix this?
*** Passenger ERROR (ext/common/ApplicationPool/../SpawnManager.h:220):
Could not start the spawn server: /Users/oprogfrogo/.rvm/bin/ruby-1.8.7-p334#2311: Permission denied (13)
[ pid=565 thr=0x7fff70bedcc0 file=ext/apache2/Hooks.cpp:864 time=2011-06-24 08:19:03.845 ]: Unexpected error in mod_passenger: Cannot spawn application '/Users/oprogfrogo/Documents/eclipse_workspace/contracts': Could not write 'spawn_application' command to the spawn server: Broken pipe (32)
Backtrace:
in 'virtual Passenger::SessionPtr Passenger::ApplicationPool::Client::get(const Passenger::PoolOptions&)' (Client.h:750)
in 'Passenger::SessionPtr Hooks::getSession(const Passenger::PoolOptions&)' (Hooks.cpp:297)
in 'int Hooks::handleRequest(request_rec*)' (Hooks.cpp:566)
Permission denied. I would look into two places
Check the permissions on the application directory.
Check the path in the apache config file, eg should be to the public directory of the app.
Try Again
Seems the problem is with rvm. Are you using a different ruby library for this 2.3.11 app?
References
3 Good suggestions at:
http://www.modrails.com/documentation/Users%20guide%20Apache.html#_the_apache_error_log_says_that_the_spawn_manager_script_does_not_exist_or_that_it_does_not_have_permission_to_execute_it
natedavisolds, looks like it was the ruby library after all. I changed a config in my httpd.conf. It appears I was referencing the wrong location of ruby:
Before:
PassengerRuby /Users/oprogfrogo/.rvm/bin/ruby-1.8.7-p334#2311
After:
PassengerRuby /Users/oprogfrogo/.rvm/wrappers/ruby-1.8.7-p334#2311/ruby
natedavisolds & eveevans, thank you for taking the time to reply back to me quickly.
I was facing same issue when for first time I was trying to deploy an application on EC2 using passenger and nginx with rvm. My mistake was I installed passenger and nginx using sudo, so there was issue regarding permissions. I removed that installation and did rvmsudo passenger-install-nginx-module
You can refer to similar issue here.
Initially my nginx.conf file was at /etc/nginx/nginx.conf , after installation using rvmsudo it was at /opt/nginx/conf/nginx.conf
I hope this will be useful for someone.
I have a Rails app that is running on a production server with Apache and Phusion Passenger. The app works fine locally when using Mongrel, but whenever I try to load a URL on the production server, it returns HTTP 500. I know the server is working properly, because I can get the static elements of the application (e.g., JavaScript files, stylesheets, images) just fine. I've also checked the Passenger status and it is loading the app (it must be, since the app's 500 Internal Server Error page is returned, not just the default Apache one). Also, when I load the app via script/console production and do something like app.get("/"), 500 is also returned.
The problem is that there is nothing in the log files to indicate the problem. production.log is empty. The Apache error logs show no problems with Apache, either. I'm stumped as to what's going on and I'm not sure how to diagnose the problem.
I know I may have been a bit vague, but can anyone give a suggestion on what the problem may be? Or at least a way I can go about diagnosing it?
The answer for this specific situation was a problem with my app. One of the model classes used a different database connection than the rest of the app. This database connection was not configured properly. I think the reason why nothing was written to the log files is that Rails bailed out without having any idea what to do.
Since it may be helpful for others to see how I diagnosed this problem, here was my thought process:
The issue couldn't be with Apache: no errors were written into the Apache log files.
The issue probably wasn't with Passenger: Passenger wasn't writing any errors to the Apache log file, and it seemed to be loading my app properly, since passenger-status showed it as loaded and it was display my app's 500 Internal Server Error page (not the default Apache one).
From there I surmised that it must be something broken in my app that happened very early on in the initialization phase, but wasn't something that caused the app to completely bail and throw an exception. I poked around in the Phusion Passenger Google Group, and ultimately stumbled upon this helpful post, which suggested that the error may be a database connectivity issue. Sure enough, removing this misconfigured database and all references to it made the app work!
Have you tried running the app locally using Passenger?
Try running the application locally on Mongrel in Production mode, to make sure that there's no weird issues with that particular environment. If that works, then you know that it's not an issue with your codebase. Since your static components are being served properly, that tells me that Apache is working fine. The only gear in the system left is Passenger. At this point, I would say it's an improperly configured Passenger. You should post up your Passenger config file, and ask the question on ServerFault.
A couple of things to try :
Have you gone though the following from the docs:
6.3.7. My Rails application’s log file is not being written to
There are a couple things that you
should be aware of:
By default, Phusion Passenger runs Rails applications in production
mode, so please be sure to check
production.log instead of
development.log. See RailsEnv for
configuration.
*
By default, Phusion Passenger runs Rails applications as the owner
of environment.rb. So the log file can
only be written to if that user has
write permission to the log file.
Please chmod or chown your log file
accordingly.
See User switching (security) for details.
If you’re using a RedHat-derived Linux
distribution (such as Fedora or
CentOS) then it is possible that
SELinux is interfering. RedHat’s
SELinux policy only allows Apache to
read/write directories that have the
httpd_sys_content_t security context.
Please run the following command to
give your Rails application folder
that context:
Have you checked your vhost or httpf.conf file ? Do you have any logging directives ?
Check the top level apache log file
Try setting PassengerLogLevel to 1 or 2 or 3, as shown here http://www.modrails.com/documentation/Users%20guide.html#_passengerloglevel_lt_integer_gt
Do you have any rack apps installed ?
My suggestion would be to go right back to "Hello World" land and create the smallest possible Ruby example application and upload it to see if there is a problem with Passenger or Ruby on the server.
May be a silly suggestion but I suggest you start by increasing the logging levels on production while you are testing. Do this in config/environments/production.rb and use:
config.log_level = :debug
This should at least get you some sort of backtrace so you can start to find the problem.
If you still get nothing - you may find that you have an issue with something as simple as a missing gem/plugin on your production server. That sort of thing may well manifest as a "500" error and just not be very verbose for you.
Can you run the test suite on your production server?
I'm using Capistrano and have everything configured. The weird issue I have is that before, I got a nice Passenger error saying what was wrong (I hadn't fully uploaded my vendor/rails directory). After I do that, however, I'm now getting the general Rails We're sorry, but something went wrong 500 error instead of the Passenger error page. My production log shows nothing (only that the log was created). Apache logs show nothing. I don't get why I'm no longer seeing the Passenger error that tells me exactly what is wrong; fixing the error Passenger was complaining about shouldn't prevent it from getting there, should it?
Can anyone help me?
FYI I'm running several PHP-based applications on the same server, with the rails app set as a subdomain (e.g. railsapp.mydomain.com). The full stack is:
Fedora Core 8
Apache 2.2.9
MySQL 5.0.45
Rails 2.3.4
Passenger 2.2.5
You have two issues at hand:
You're log file isn't writable by Passenger. Passengers runs as Apache. So make sure the webserver has the correct rights to write to the log/ directory.
You are probably missing a gem, database or configuration file. Can you start a console session?
./script/console production