I've been stuck on this for a few weeks and I've run out of ideas.
I am trying to move two Ruby sites to a new server. One is working flawlessly and the other gives the Connection closed error.
It should be a standard Apache + Passenger 3.0 + Ruby 1.8.7 + Rails 2.3.18 setup.
Both Ruby sites are based on the same code with slight differences.
I'm also not a Ruby guy, I just administer the servers however the developers are out of ideas on this issue.
Apache's error log with Passenger debugging turned to maximum shows this:
[ pid=23816 thr=139877253064448 file=ext/common/ApplicationPool/Pool.h:939 time=2013-05-15 14:19:28.87 ]: Spawning a process for /home/xxxxx because there are none for this app group
[ pid=23816 thr=139877253064448 file=ext/common/ApplicationPool/../SpawnManager.h:289 time=2013-05-15 14:19:28.88 ]: Spawning a new application process for /home/xxxxx...
[ pid=23816 thr=139877253064448 file=ext/common/ApplicationPool/Server.h:292 time=2013-05-15 14:19:34.141 ]: Client 28: SpawnException occured (with error page)
So it tries to spawn the app and it fails. I can't locate any logs which explain why it is failing however.
Running ./script/server from the app's root folder works fine so everything must be more or less working correctly with the app.
The Apache config file is pretty straight forward and fairly basic: (simplified slightly)
PassengerRoot /var/lib/gems/1.8/gems/passenger-3.0.19
PassengerRuby /usr/bin/ruby1.8
PassengerEnabled off
PassengerUserSwitching on
PassengerLogLevel 3
<VirtualHost *:80>
ServerName xxxxx.com
ServerAdmin webmaster#agentpoint.com.au
DocumentRoot /home/xxxxx/public
PassengerEnabled on
PassengerAppRoot /home/xxxxx
PassengerTempDir /home/xxxxx/tmp
PassengerUploadBufferDir /home/xxxxx/tmp/uploads
</VirtualHost>
Does anyone know how this error could be occuring given the fact that a nearly identical code base works fine? And what logging should show a spawn error like that? I really am missing that crucial step that is failing and I can't figure out what it is doing precisely.
Could you upgrade to Phusion Passenger 4? That would potentially solve your problem. If not, then Phusion Passenger 4 has much better error reporting. It will print the error reason to the logs.
Related
Has anyone encountered problem of running Puppet Dashboard on Ruby Passenger 5? If yes does it really work with that Passenger version?
I've already setup and configured the necessary files required to run Puppet Dashboard via Passenger. Currently, the Apache test page is shown instead of the dashboard menu. This will not appear if Puppet-Dashboard is run in the lightweight Webrick server.
While scouring most of the installation samples and the manuals on how to install and configure it for Centos 6. I've seen most of them were based on Passenger 3 / 4. I am currently using 5.0.10 as it is used in conjunction with Puppet 3.8.1. One thing certain is that RailsAutoDetect is deprecated in version 5 and that has been commented out.
Below my puppet-dashboard.conf file (the load module has been moved to another file to avoid double-instantiation)
On the logs, the first error reported is that the path of /usr/share/puppet-dashboard/public/reports/upload is not there, so I've created those sub-folders to see if what would be the next error.
The next error in the log file after that is now shown like:
Attempt to serve directory: /usr/share/puppet-dashboard/public/reports/upload/
External node and node terminus option has been commented out as not to disrupt normal puppet run-interval activities during office hours.
PassengerHighPerformance on
PassengerMaxPoolSize 6
PassengerPoolIdleTime 1500
PassengerStatThrottleRate 120
Listen 3000
<VirtualHost *:3000>
ServerName mi-cloud-mgmt-config-01
ServerAlias mi-cloud-mgmt-config-01.mimos.local
RailsBaseURI /
PassengerAppRoot /usr/share/puppet-dashboard/
DocumentRoot /usr/share/puppet-dashboard/public/
# UPDATE THIS TO YOUR FQDN
<Directory /usr/share/puppet-dashboard/public/>
Options None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/httpd/dashboard_error.log
LogLevel debug
CustomLog /var/log/httpd/dashboard_access.log combined
ServerSignature Off
</VirtualHost>
Yes I have encountered the same issue. I tried to be clever and use the latest passenger for my Puppet Master as per the Puppet guide... https://docs.puppetlabs.com/guides/passenger.html#install-rackpassenger
But it looks like Dashboard doesn't support Passenger 5.x. Which is fair enough considering Dashboard is basically dead.
I noticed the structure of the directories under the <DocumentRoot> and <Directory> were different for Dashboard compared to Puppet Master, namely no config.ru being present.
So on CentOS 6 I tried the version of mod_passenger from EPEL repo mod_passenger-3.0.21-11.el6 and that worked for both Puppet Master and Dashboard.
According to some knowledgeable folks in #puppet IRC there should only be a minor lowering in performance with 3.x compared to 5.x.
Although it might need some tweaking it does work on passenger 5.
I use Nginx but if it works using Nginx it should on apache as well.
I use passenger-5.0.13 with ruby 1.9.1 to run puppet dashboard.
I think I've read every question and answer on SO related to passenger/nginx and 403 errors, but none have lead me to a solution, so here I go...
I had Nginx (1.0.6) with Passenger (3.0.9) running beautifully for a rails app for many, many months with no real issues. Tonight I decided to upgrade from Passenger v3.0.9 to v3.0.12 to take advantage of a new feature. After running the install according to the provided instructions (using RVM), I went to the URL served by my rails app and got the dreaded 403 error. The nginx log file first had me thinking it was a permissions error:
directory index of "/home/SimfoUsers/public/" is forbidden, client: , server: , request: "GET / HTTP/1.1", host: ""
But after checking every possible permission, I no longer think that is the issue. I think the problem is actually that passenger is somehow not actually running, and the page is being served as a "normal" webpage by nginx. This is supported by the fact that if I add an index.html file to my rails public directory (/home/SimfoUsers/public/), nginx serves up this file as one would expect. Also, if I run passenger-memory-stats, ZERO passenger processes are running. Shouldn't nginx automatically spawn passenger processes whenever needed, or am I completely missing something here?
Here are the relevant parts of my nginx.conf file:
http {
passenger_root /usr/local/rvm/gems/ruby-1.9.2-p290#Simfo/gems/passenger-3.0.12;
passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.2-p290#Simfo/ruby;
...
server {
listen 80;
server_name simfo.info www.simfo.info;
root /home/SimfoUsers/public;
passenger_enabled on;
}
}
Basically the only thing that I changed from my previously working config file is to update the passenger_root and passenger_ruby directives to reflect the new version of passenger (3.0.12). So if this is a config file issue, I'm really at a loss to understand it...
I'm not sure whether to just delete this question, or leave it in case it can save someone else the same frustration. This definitely is a face palm moment...
In desperation, I finally rebooted the server. After that, everything worked fine. It seems that at some point the passenger-related processes died and were not re-spawned automatically. One would think that after a fresh installation and reboot of nginx, passenger would be restarted, but apparentally this is not the case. My only advice to anyone having a similar problem is to issue a ps aux | grep passenger (or tasklist on Windows?). You should see one or two processes related to passenger. If not, then something strange is going on, and a reboot might help you as well.
I just finished working on my first rails app and am ready to deploy to my VPS. I decided to try using Phusion Passenger and went through the extremely simple install process. I got all the right dependencies, so on that end things seems to be ok. Where I think my problem lies is in the routing and the apache config file.
As told I added the following at the very end of the following file: /etc/apache2/apache2.conf
LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-3.0.8/ext/apache2/mod_passenger.so
PassengerRoot /var/lib/gems/1.8/gems/passenger-3.0.8
PassengerRuby /usr/bin/ruby1.8
<VirtualHost *:80>
ServerName localhost
DocumentRoot /home/bl/gfy/public
<Directory /home/bl/gfy/public>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>
When I restart apache I get the following message:
* Restarting web server apache2 [Wed Aug 10 03:16:24 2011] [warn] module passenger_module is already loaded, skipping
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting [Wed Aug 10 03:16:26 2011] [warn] module passenger_module is already loaded, skipping
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
When I point my browser to my the IP I set up I get pointed to the sample file that comes with apache instead of to my rails app.
Any ideas would be greatly appreciated.
Thanks.
Somewhat unrelated to your problem, but still.
Both warning you see are not critical and should not affect server operations.
One means that your server hostname is not set, another just reminds you that passenger is already loaded from somewhere, probably after it stumbles upon in /etc/apache/modules.d.
All in all, you don't really want to edit /etc/apache/apache2.conf. Instead use existing structures, like /etc/apache2/sites-available etc.
Now back to your problem.
Your VirtualHost is most likely being overriden by default host.
Executing sudo a2dissite default in your shell will disable it. Assuming you don't have some exotic LAMP flavor.
Having updated Passenger and Ruby Enterprise Edition to the latest versions today, I am now seeing a directory listing instead of my Rails app. Here's the Passenger part of my Apache config:
#LoadModule passenger_module /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/passenger-2.1.3/ext/apache2/mod_passenger.so
#PassengerRoot /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/passenger-2.1.3
#PassengerRuby /opt/ruby-enterprise-1.8.6-20090201/bin/ruby
LoadModule passenger_module /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
PassengerRoot /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11
PassengerRuby /opt/ruby-enterprise-1.8.7-2010.01/bin/ruby
RailsEnv production
RackEnv production
PassengerMaxPoolSize 30
PassengerPoolIdleTime 600
PassengerMaxInstancesPerApp 10
PassengerUseGlobalQueue on
This config is definitely being loaded, the vhost is definitely pointing at the public directory of the app. The app itself works fine when run from the Rails console.
You'll see in the config above that the old passenger settings are commented out. If I comment out the new Passenger lines and uncomment out the old ones (i.e. switch to the older version of passenger), the app works fine again.
Tried reinstalling passenger/REE, no difference. There are no relevant entries in the Apache error log or Rails log.
Any help appreciated!
I was able to solve this using:
PassengerResolveSymlinksInDocumentRoot
It seems that Passenger no longer handles public directories that are symlinks to your app elsewhere by default. Turning this option on fixed all the issues.
I realized that I had /etc/hosts pointing the public URL of my app to 127.0.0.1 for my test callbacks in twitter.
It will simply keep showing a blank file listing.
removed the entry from /etc/hosts and everything came back to normal
I have an apache2 server running Phusion Passenger. On this machine I have two virtual hosts setup each look like this (path's are different for the 2nd virtualhost...but other directives are the same)
ServerName beta.mysite.us
DocumentRoot "/var/www/beta/mysite/public"
<Directory "/var/www/beta/mysite/public">
RewriteEngine on
AllowOverride All
Options FollowSymLinks
</Directory>
# http://www.modrails.com/documentation/Users guide.html
PassengerAppRoot "/var/www/beta/mysite"
RailsEnv development
PassengerMaxPoolSize 6
PassengerDefaultUser mysite
# PassengerHighPerformance does come at a trade off of lack of support for mod_rewrite
PassengerHighPerformance off
RailsSpawnMethod conservative
RailsFrameworkSpawnerIdleTime 0
RailsAppSpawnerIdleTime 0
PassengerPoolIdleTime 300
ErrorLog "/var/log/httpd/mysite-beta-error_log"
CustomLog "/var/log/httpd/mysite-beta-access_log" common
Apache starts fine. I can go to one of the virtualhosts and it will load Rails and work. When I go to the second virtualhost, a ruby process spawns ("Rails: /var/www/mysite/current" according to ps awuxf) and uses 100% CPU. This process never exits. At this point neither virtualhost is responsive. If I kill the the offending ruby process, another ruby process replaces it and uses 100% cpu. If I kill these processes about 5-6 times, then both virtualhosts respond but they, are somehow, running the same Rails app?!
I have another virtualhost on this machine that is not setup with phusion passenger..This one never exhibits any problems.
Any help / ideas would be much appreciated!
I would recommend switching to nginx
I had faced similar issues with phusion passenger, with no success in debugging. Later, I switched to apache2+mongrel with mod_proxy. I have seen best stability with nginx though. nginx FTW :)
The obvious thing would be to check you don't have any inadvertent infinite loops or impossible to finish conditions in any of your application. It's all too easy to do a find(:all) by accident on a table too massive to fit in memory.
Does it jam immediately or is there something you must do to trigger it? For example, loading a specific page, or not loading a page at all. There could be something in an initializer that causes trouble.
Being able to power up script/console is always a good sign, especially if you can load records. There's not a lot of information in your description. A copy-paste of the output of 'ps aux' would help.
Is it possible you have some code causing this? We have a number of apache/passenger installations. It's more likely something with your code than aapache/passenger.
(A reminder to my future self)
I recently inherited a Rails 2.3.x/Ruby 1.8.7 app running on Passenger and Apache2. I updated RubyGems from an old 1.3.x to 1.6.2, and immediately noticed a ruby process spiking to 100% when passenger loaded. Downgrading to RubyGems 1.5.3 resolved the issue.