This website is under heavy load, rails app - ruby-on-rails

I am getting error, I tried searching a lot. And seen many posts but nothing worked for me. Any suggestions on how to fix this.
This website is under heavy load
We're sorry, too many people are accessing this website at the same time. We're working on this problem. Please try again later.
when I run free -m, this is the memory status
and seeing nginx configuration file, these are my settings
I tried modifying settings, according to different things specified by people on stackoverflow. But I still facing the issue

The Passenger documentation and the following article explain what this error is, why you get it, and how you can make it go away:
https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_max_request_queue_size
What is optimal value for Phusion passenger PassengerMaxRequestQueueSize

Related

"allow the origin of the assets in your Rails config file" ? (Heroku to Railway - no styling, images not loading)

along with many others it would seem, I have attempted to shift my hobby apps from Heroku to Railway. I haven’t had tremendous success as both of the apps I’ve transferred (which work fine locally and on Heroku) experience the same problem on Railway – no styling and images not loading.
I raised the issue on the Railway community help system and a member of the team replied
“My guess here is that you need to allow the origin of the assets in your Rails config file”. I asked if he could expand on this, but didn’t get a reply.
Can anyone provide a further clue. Is there a particular line of code I should add to the config/environments/production.rb file?
Thanks
Daniel
I managed (with guesswork) to (at least temporarily) solve this. I changed the ‘builder’ on the Railway dashboard from the default Railway setting ‘Nixpacks’ to ‘Heroku Buildpacks’ (which is said to be deprecated). Images and styling now as expected. Noone from the Railway team has indicated they are investigating the issue or trying to fix it...

Trouble with Heroku Deployment and Interpreting Heroku Log

This is my last resort to figure this out. I've searched through stackoverflow and googled various topics, but it seems to come down to how to interpret/analyze my own Heroku log. There's so much going on that I'm not sure where to look first. I see things like eager_load and direction to files app/config/environment:rb:5 and there also seems to be issues with my Unicorn configurations and relationship associations. I've gone through my files and haven't been able to locate what my logs are referring to, up until now it's been really easy to interpret errors.
A little background: I had originally built my rails app with the default Sqlite3 settings and I have attempted to switch it to Postgres. So maybe there's some conflicts with that going on as well. I want to be able to read my Heroku Logs in the future on my own and know exactly where to look. So if someone could provide a good tutorial about reading Heroku Logs that would be great as well.
Here's where I've looked so far:
I've looked on devcenter on heroku's website, but I'm not making the connection from their instructions, to the issue in my code. I'm just a that stuck point, but have been trying to figure it out for days! I'm worried that I'm just missing something basic, which is why I haven't been able to figure this out yet.
I've also looked at association_basics.html on ruby on rails guides because I've been having some syntax issues.
I've used foreman start to see if my Procfile is working and have gotten another huge list. I've also used heroku ps, which gives me web.1 crashed
Here's the Heroku Log that's also connected to my app's github page:
https://github.com/jsmit032/seasons-app/issues/29
If any other information is required, please let me know and I'll edit my questions so hopefully this can help others as well.
2014-11-21T19:27:58.271705+00:00 app[web.1]: has_many :user, through :user_to_destinations
doesn't look right - it should be
has_many :user, through: :user_to_destinations
at /app/app/models/destination.rb:3
So I got the whole app to deploy! Turns out it was a pre-complied issue.
So I went through the guide on Heroku for pre-compiling assets in Rails 4: https://devcenter.heroku.com/articles/rails-4-asset-pipeline
I also went through the heroku guide for prepping your rails 4 app:
https://devcenter.heroku.com/articles/getting-started-with-rails4#migrate-your-database
Also went through the heroku guide for SQLite on Heroku and the Deploying Rails Applications with Unicorn guide.
Looking through the console errors on the actual site was a huge help. It's how we figured out that the assets pipeline might not be working.

Redmine 404 on some pages

I have installed Redmine on a shared Bluehost account and at first sight it seems to be working.
I followed both of these tutorials: https://my.bluehost.com/cgi/help/redmine and http://www.redmine.org/projects/redmine/wiki/RedmineInstall
But just as i started navigating around i noticed that there seem to be a routing problem because some of the pages are returning a 404 error code for a reason i don't understand yet.
The error log shows no information regarding this problem.
The url is on redmine.example.com , the user/pass are still admin/admin.
I have identified that any URL regarding a project is failing, for example:
http://redmine.example.com/projects/new
http://redmine.example.com/projects/21
http://redmine.example.com/projects/21/issues
(Currently i have reset the DB for privacy concerns)
In order to prove my theory that it was regarding the projects issue, i went into the projects controller file found in app/controllers/projects_controller.rb and tried to put some abort("Foo") here and there but i couldn't see my message with any of the links that are not working so i thought maybe the problem is not there and is probably in the routing process. So i checked the config/routes.rb file and comparing it with my local version they seem identical
I am not sure what to try next as i am not a Ruby developer. Let me know what kind of info you need in order to help debug this problem.
Eventually i got it working by using FastCGI.
In order to do that, i simply created a .htaccess file and a dispatcher.fcgi as shown in the answer here : Redmine 2 on Hostmonster apache fcgi: Rails application failed to start properly
Don't forget to SetEnv GEM_PATH to your ruby gems path in your .htaccess file and it should work after restarting (pkill dispatcher.fcgi)

how to debug web server on RoR?

I currently have a problem with a project.
it freezes before it shows the "Started GET ...." seems like it hits an infinite loop.
now i dont really have much experience with debuggers in ROR, can anyone recommend anything i can use to trace the exact origin of the problem. if i can get an error code somewhere then i might be able to fix it.
currently i am using webrick, i tried thin and it gave the exact same error.but i am willing to use anything to find the exact origin of this error.
it seems to be related to the project because all other projects works fine on my environment.
Take a look at the Rails guide on debugging.
Also try running the Rails console ("rails c"); if you can get to a command prompt at all that means that the issue is not in loading the Rails environment (e.g. a problem in application.rb) but is somewhere in the process of making a web request. If there's a failure it may give you a better error message.

Newbie help with Rails/Ruby. Totally lost! (Mongrel related, I think) 503 Errors

I am on the verge of actually hiring someone to fix this
for me, but I hope it doesn't come to that.
I have no experience with Rails/Ruby, but I do know my way around
computers in general.
I have two domains on one server (Hostingrails, I am beginning to hate
them more and more these days).
My secondary domain works 100% fine.
But for the past few days, my primary domain has not been working, it
has been giving me 503 Errors. I've opened a ticket regarding this, and
they told me to SSH into my server and reset "Mongrel". I've done this
using the code they gave me; "mongrel_rails start -d -e production
-p13930"
It seemed to have worked, but the problem was still there. The log says
the error is something about:
"require': no such file to load -- dispatcher (LoadError)"
I've re-opened a ticket concerning this, and Hostingrails basically told
me that it is not their problem anymore and that it's solely up to me to
fix it. Brilliant.
So I spent a good part of the day looking and changing things around
through SSH (probably wasn't the greatest idea) but I still keep getting
503'd on my website.
However, I recently found out that my index file HAS to be index.html,
or it will not render the page. index.htm or index.php will result in a
503. If I set the index page to index.html, it worked. Which is strange,
my htaccess file allowed for all.
Another problem, I think I have inadvertently changed something in my
settings while I was SSH'd in. When I do "bundle install" it installs
the gems into my own private webspace, for example /home/mywebsite. But
I believe on my shared plan, all the rails/ruby/gems etc are all under
/usr/local/rvm/gems/ruby-1.9.2-p0/ which I don't think I have access to.
How do I change the directory to the default one? For example, before
the error log said:
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
`require': no such file to load -- dispatcher (LoadError)
Now it says:
/home/mysite/.gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
`require': no such file to load -- dispatcher (LoadError)
I think that's everything for now. Here are the rails installed on my
server by the host:
Installed at (3.0.0): /usr/local/rvm/gems/ruby-1.9.2-p0
(2.3.8): /usr/local/rvm/gems/ruby-1.9.2-p0
(again, I think my mongrel is looking in the wrong place, as my gems are
now being installed into /home/mywebsite/ instead of
/usr/local/rvm/gems/) Is it possible to someone reset the settings I've
changed back into my host's default one?
Would anyone be willing to take the time and try and fix this with me? I
am pretty annoyed at Hostingrails, since I didn't do anything to create
this problem, and they are outright refusing to help me. Why is my
primary domain getting 503 errors when my secondary domain works fine?
Mongrel is not compatible to ruby 1.9.2. You need use a fork of mongrel to use it https://github.com/kyusik/mongrel_cluster
I advice you to user thin/passenger or unicorn instead of mongrel.
I found a little blog post about problem with Mongrel and ruby 1.9.2 http://xaop.com/blog/2010/08/04/deploying-rails-3-on-ruby-1-9-2/
Maybe you could try using Ruby 1.8.7 - it causes less trouble in general at this time.
Not an answer to your question in particular, but if you're new to Ruby and Rails, then hosting your own stuff can be a daunting task.
Instead, try Heroku - simply push your Rails app to Heroku with git and you're good to go. They support custom domainnames for free.

Resources