joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Sep-18 14:33 UTC
Apache + Mongrel weirdness
Hi, I''ve got Apache modproxing a bunch of mongrels. Everything is peachy. Except... When I use capistrano to deploy, if someone visits the site in the second or two while the mongrels are being restarted, Apache starts serving 503 errors. I have to restart Apache to get everything to work correctly. If no one visits the site during the second or two while the mongrels are being restarted, then everything''s fine. Any ideas? Thanks, Joe --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Sep-18 15:25 UTC
Re: Apache + Mongrel weirdness
joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> Hi, > > I''ve got Apache modproxing a bunch of mongrels. Everything is peachy. > Except... > > When I use capistrano to deploy, if someone visits the site in the > second or two while the mongrels are being restarted, Apache starts > serving 503 errors. I have to restart Apache to get everything to work > correctly. > > If no one visits the site during the second or two while the mongrels > are being restarted, then everything''s fine. > > Any ideas? > > Thanks, > JoeHm. Upon investigating it further, it looks like the mongrel_cluster is shutting down and then starting back up. Does it need to do that with capistrano? (I''m using the mongrel_cluster gem). I''m still confused about why Apache needs to be restarted if it can''t communicate properly once with a mongrel process. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On Sep 18, 2006, at 8:25 AM, joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> > joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: >> Hi, >> >> I''ve got Apache modproxing a bunch of mongrels. Everything is >> peachy. >> Except... >> >> When I use capistrano to deploy, if someone visits the site in the >> second or two while the mongrels are being restarted, Apache starts >> serving 503 errors. I have to restart Apache to get everything to >> work >> correctly. >> >> If no one visits the site during the second or two while the mongrels >> are being restarted, then everything''s fine. >> >> Any ideas? >> >> Thanks, >> Joe > > Hm. Upon investigating it further, it looks like the mongrel_cluster > is shutting down and then starting back up. Does it need to do that > with capistrano? (I''m using the mongrel_cluster gem). > > I''m still confused about why Apache needs to be restarted if it can''t > communicate properly once with a mongrel process.Hey Joe- Yeah mongrel does need to restart when you push new code. This is why the maintenance.html feature is there. You need a few rewrite rules in your apache vhost like this: # If there is a maintenence.html dile in your # public dir all requests will get rerouted to # this file. RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f RewriteCond %{SCRIPT_FILENAME} !maintenance.html RewriteRule ^.*$ /maintenance.html [L] Then you need to use the capistrano facility for placing a maintenance.html file right in the root of your public dir. With these rewrites and a maintenance.html in public, apache will serve maintenance.html to all requests until the cap task is done updating your code and changin the symlinks. -Ezra --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Sep-19 21:36 UTC
Re: Apache + Mongrel weirdness
Ezra Zygmuntowicz wrote:> On Sep 18, 2006, at 8:25 AM, joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > > > > joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > >> Hi, > >> > >> I''ve got Apache modproxing a bunch of mongrels. Everything is > >> peachy. > >> Except... > >> > >> When I use capistrano to deploy, if someone visits the site in the > >> second or two while the mongrels are being restarted, Apache starts > >> serving 503 errors. I have to restart Apache to get everything to > >> work > >> correctly. > >> > >> If no one visits the site during the second or two while the mongrels > >> are being restarted, then everything''s fine. > >> > >> Any ideas? > >> > >> Thanks, > >> Joe > > > > Hm. Upon investigating it further, it looks like the mongrel_cluster > > is shutting down and then starting back up. Does it need to do that > > with capistrano? (I''m using the mongrel_cluster gem). > > > > I''m still confused about why Apache needs to be restarted if it can''t > > communicate properly once with a mongrel process. > > > Hey Joe- > > Yeah mongrel does need to restart when you push new code. This is > why the maintenance.html feature is there. You need a few rewrite > rules in your apache vhost like this: > > # If there is a maintenence.html dile in your > # public dir all requests will get rerouted to > # this file. > RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f > RewriteCond %{SCRIPT_FILENAME} !maintenance.html > RewriteRule ^.*$ /maintenance.html [L] > > Then you need to use the capistrano facility for placing a > maintenance.html file right in the root of your public dir. With > these rewrites and a maintenance.html in public, apache will serve > maintenance.html to all requests until the cap task is done updating > your code and changin the symlinks.I had all that set up, but the maintenance.html file was only being created during capistrano''s long_deploy. So I''m using that from now on. Any ideas why Apache would start giving 503 errors forever if it couldn''t connect to a Mongrel process once? Process: start Apache visit site, see 503 errors start mongrel visit site, still see 503 errors restart Apache visit site, don''t see 503 errors --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---