Heroku app takes 3 to 4 minutes to work after deploying - ruby-on-rails

I have a rails app which when deployed to Heroku takes 3 to 4 minutes to go live even after successful deployment. During that that period it shows error as "request timeout". I have enabled preboot as mentioned here:
https://devcenter.heroku.com/articles/preboot but still same result. I am on Heroku enterprise and still facing this issue. Please suggest what i am missing, here is the dyno and Add-ons info that i am using

Related

Error when trying to add SendGrid add-on for Heroku Rails app

Trying to add SendGrid functionality to my heroku rails app by running heroku addons:create sendgrid:starter from my app's directory, but getting an error message each time:
Error Provisioning User - Whitelabel domain could not be located when creating customer
I'm also getting the exact same error when trying to add SendGrid Starter add-on directly through the Heroku web interface for my app.
My heroku account does have a credit card on file, so that shouldn't be the issue. This heroku app is on the free heroku tier, but I believe all the add-ons are supposed to be supported even for free heroku apps.
Has anyone run into this before? If so, any pointers on how to fix it?
It just worked. I believe it may have been the result of temporary service outage on the part of SendGrid (even though their system status pages indicated all services were up and running).
Sorry for the false alarm.

Passenger Hanging after Restart - Shared Hosting Environment

Last night I made a revision to [app-root]/config/initializers/refinery/core.rb and the touched [app-name]/tmp/restart.txt. Then I tried to reload the app to find it totally hanging. The other two RoR apps I'm running on the same server were also hanging. Per curl -v there was no response at all from the server.
Everything was working fine before I touched the restart.txt file. The following morning, seven or eight hours later, the sites are working again and my minor edit (the site name) is showing up.
Rails 3.2.16 on a hostmonster linux server.
The instance of Passenger is not running under my user so I wonder if my hang horned any other user's RoR sites?
I can't restart apache (of course) since this is a shared server. Any suggestions for how to deal with this if it happens again? I have no budget for Heroku or a VPS.
UPDATE: Did the same steps again this morning, revised the core.rb and asked for a restart by touching restart.txt and it restarted in less than a minute. The question remains valid I think - what can a person do to address a hanging Passenger or prevent it from happening?

AWS Deployment with Rails - Inaccessible

Could you tell me what happens with AWS Server now? From 3 weeks ago, util now, whenever I deploy my RoR app into AWS Server (using ElasticBeantalk tool), I meet a strange issue
Deployment time is quite good (just about 10-15 minutes), and the healthy of server is still green. But after that, the server is inaccessible. This status last about 3 - 4 hours !!! Then, everything is OK, server run fast and smoothly. I totally don't understand server healthy still un-change although this error happen. Everything I can do is "refresh browser periodically until it run"
I don't think my application is bigger enough with total deployment time like that. It just takes me about 20 minutes on local (production mode)
Here're some error I found out when server is hang:
"An error occured while starting up the preloader."
"Gateway timeout" when loading application.js (using chrome debug)
"Bad gateway" when loading application.js (using chrome debug)
Please give me some advise to solve that. I have been stucked on this issue for a long time
Thanks

403 errors from load balancer while new instances are booting

I have a RoR app running on elastic beanstalk. I have occasionally seen 403 errors from Passenger for a while. Most of the time 1 server is running but this gets increased to 3 or 4 instances in busy periods during the day.
Session stickeyness is not turned on
I have noticed that when a new server is started the ELB is sending requests to it before bundle install has finished.
If I ssh to the newly started server I can see in /var/app/current/ that the app has not yet been installed and if I run top it looks like bundler is running and compiling things with cc1, etc.
/var/app/support/log/passenger.log shows that requests to valid urls within my rails app are being received and responded to with 404. Hardly surprising because the app isn't there yet
After 5-10 minutes all of the compiling is complete and the app files appear in /var/app/current and all is well.
This doesn't seem quite right to me. How do I set up the ELB / my rails app so that the ELB can tell when it is ready to receive requests?
I found the answer to this. There was no application health check url set. In this case the ELB pings the instance to see if it's healthy, i.e. it checks that it is booted rather than if rails is up and running. Setting the health check url to '/login/' fixed it for me because this gives a 404 until rails in running and a 200 afterwards.
Elastic beanstalk demands 2 correct responses before it deems an instance to be healthy. It checks the instance every 5 minutes. This means that an instance can take a while to start serving requests. i.e. it takes boot time + waiting for next poll from elb + 5 minutes before it sees any real traffic

Postgres periodically slows down on heroku RoR application

I faced with periodic RoR 3 application unavailability. Usually I have 15 minutes unavailability period each day. The problem doesn't relates with application load and I can't find any errors in logs. The only errors I see is H12 Request timeout. I changed postgres plan to production but the problem occurs anyway.
On newrelic I see Postgres serious response time increase before H12 errors.
Please help.
Pavel.

Resources