Topic: Capistrano touched restart.txt, but the site doesn't load...

Hi. I'm fairly new to Rails and very new to Capistrano and Passenger.

I'm trying to deploy our Rails app in production. Our server is running Ubuntu 10.10 and Passenger 3.0.4. "cap deploy" issued on my development box seems to do all the right things on the remote server, including restarting thinking_sphinx, creating new "releases" subdirectories, issuing new symlinks, etc.. But there's no obvious sign (say by doing a ps -eaf, for example) that an instance of our app has been spun up. Passenger is running, apache is running, thinking_sphinx is running, but browsing to our host's ip address + :3000 yields a "cannot display the webpage" message in IE.

sudo apachectl start restarts apache no problem. passenger start gets passenger standalone running no problem (in development mode) and doing that allows me to see the app in a browser. ruby script/server -e production also gets our app to display in the browser. But cap deploy by itself does not.

I've posted a related question on the passenger google group without any responses.

Any ideas what I might check to see where I've gone wrong?

Thanks in advance,

Dean Richardson
Molex Fiber Optics

Re: Capistrano touched restart.txt, but the site doesn't load...

what is the url for your site? why the :3000 ? did you set up your sym links for the public_html folder tor your domain to your_rails_app/public folder?
passenger spawns apache requests when a visitor hits the site and the pool idle time setting in passenger determines how long that httpd instance stays alive so you don't run out of resources too quickly if you have a busy site.

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)

Re: Capistrano touched restart.txt, but the site doesn't load...

It's an internal server, behind our corporate firewall, so the URL is just http://mm.nn.yy.zz. I attached the :3000 out of habit, since that's always where I've gone to view the site in development mode.

My VirtualHost entry in etc/apache2/sites-available/<url of server> is as follows:

<VirtualHost *:80>
    ServerName http://mm.nn.yy.zz
    DocumentRoot /home/dean/rails_projects/my_app_name/current/public
    RailsEnv production
    <Directory /home/dean/rails_projects/my_app_name/current/public>
        AllowOverride all
        Options -MultiViews
    </Directory>
</VirtualHost>

I haven't created any symlinks myself from /public_html to my_app_name/public. For one thing, my_app_name/public doesn't exist at all. I only have /current/, /releases/, and /shared/ in the /my_app_name directory.

Also, to be honest, (I did say I was a n00b, right?) I didn't even know I should be creating symlinks from public_htmll to my_app_name/public. I thought the VirtualHost would take care of that...

What you're saying about passenger spawning apache requests sounds really relevant. I worry that I somehow have failed to get passenger to do that... I see Passenger spawn server running when I ps -eaf, but I feel like I probably should have had to configure something having to do with spawning that I haven't yet.

Thanks for your help...

--Dean

Re: Capistrano touched restart.txt, but the site doesn't load...

Passenger just works right out of the box so don't stress about configuring passenger until you find out what fine tuning is needed for performance.
I have to say your set up is a little out of my comfort zone/experience with running a server behind a fire wall. I'm guessing that :-

1) That you don't need to make use of the port in the url (which would be port 80 according to your virtualhost entry.
you could prove the point by just deploying a bare bones rails app that doesn't actually do anything other than display the standard rails public html file. this would quickly determine that you have your server configuration sorted out without the complexities of a full blown app

2) If you have managed to make a connection you should be able to see what is going on in your applications production logs. If you were getting a passenger problem then I would expect to see a web page displaying a passenger error. I just don't think you have the correct url at this stage, in which case your log files will be empty

3) I'm thinking that you have the server set up otherwise your capistrano script would be failing. So the most likely issue is a breakdown between your browser sending the request and passenger receiving the request. this could be that the domain is not pointing to your apps public folder or more likely you just don't have the right url (try without the port as suggested in point 1)

4) Other things to think about.
Did you create your database - Remember you will be using production settings in your yml file,
Can you ssh into the server and run a rails console in production mode?
Using firefox and firebug plugin are you able to determine any further information regarding the cause of being unable to display the website

But I could be wrong!

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)

Re: Capistrano touched restart.txt, but the site doesn't load...

You diagnosed this perfectly (and quickly!) Dropping the :3000 from the URL lets the site display in production mode.
Everything's working exactly as expected now.

Thanks for making my day!

--Dean

Re: Capistrano touched restart.txt, but the site doesn't load...

Cool! Glad you got it sorted smile

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)