Trouble with Heroku Deployment and Interpreting Heroku Log - ruby-on-rails

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.

Related

How to reload rails environment? Is `reload!` command depracated?

I tried to reload rails environment with the reload! command, I think it might be depracated. Does anyone know the modern way of reloading the rails environment? This book is available free for download, Im on page 79, it's Michael Hartl's "RailsSpace: Building a social networking website with ruby on rails", published in 2007, several people suggested that I give up on the book already, I just wanted to make sure it wasn't a modern way of doing things before I gave up on the book. So many experts on stackoverflow helped me get through the book already, I decided to take my chances.
Here is a link to the book: https://pdfs.semanticscholar.org/ca98/3b5098cd5957dc1842bb4bf3175406624bca.pdf?_ga=2.121598472.1814901715.1569094472-1963651489.1569094472, its one of the only FREE sources out there for building a social media website thats why I cant give up on it so easily, even though it was published in 2007 and its a bit outdated. Plus I just want to see what stackoverflow can do for me before I just give up on the book. So many experts on stackoverflow helped me make it this far, Im curious to find out if I can get through the entire book with stackoverflow. If anyone knows a better source that's free, please send me a link. Right now page 79, is the roadblock, its that reload! command that might be depracated. Maybe its an expert on stackoverflow that knows the knew command for it. If that's you please help. I already tried googling it, it took me straight here to stackoverflow lol. I decided to post a question of my own, that other guy's question doesn't seem to match mine so here I am. Please help if you can.
Within the Rails console (rails c, or more formally bundle exec bin/rails c) you should be able to run:
reload!
That reloads the active environment, specifically anything within app/ and config/routes.rb, but other things will not be reloaded until you exit and restart the console. This has always been the case.
Note that this is only within the Ruby interactive environment, as in you'll have a prompt that looks like this:
irb(main):001:0>
If you see something else you may not be in the Rails console and are trying to run the command in the wrong context. A common mistake is trying to run this in he shell itself where you'll get an error like:
-bash: reload!: command not found
One other thing you may need to do if you're having trouble getting things to load that should be there is to stop the Spring launcher, forcing it to reload:
spring stop
That kicks the Spring application preloader which can sometimes get confused about what's going on and needs a reset.

Ruby scaffolding link not working

So I believe that I have searched on here and not found any question that pertains to my issue so hopefully someone can guide me. I was required (for a course) to create a Ruby scaffolding "products" page. My page links all worked on the local host rails server but when I tried it on Heroku (also required) all the links work EXCEPT the new product page.
I have exhaustively googled but I must admit that all the computer lingo is new to me so I am unsure what any of it means and of what steps are safe. For the reason that if I make things worse, I will never know what to look for to reverse anything. I have included the error that shows up in Heroku. When I searched that I found many different answers causing me to be unsure which is correct.
If anything else is needed just let me know. Many thanks to any and all that reply!
Error on Heroku
The error says, "relation products" does not exist.
Did you make sure to run heroku run rake db:migrate ? After you migrate you'll need to heroku restart
This gets me a lot as part of my Heroku deployments, so I make sure to write a script or rake task which does the git push to deploy to Heroku, then runs these two commands. Then I always use that script to deploy, instead of manually doing a push.

This website is under heavy load, rails app

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

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.

Ruby on Rails fails to connect to Mongodb locally using MongoMapper

I'm very new to rails and have been trying to experiment with using Mongodb on a web app.
I have been following this railscast tutorial here word for word and have been running into issues with it not connecting to my local Mongodb.
I'm sure Mongodb is up and running since mongod shows up in my activity monitor and going to
http://localhost:28017/
shows:
http://imgur.com/KJ0JI.png
The problem is when I go to 0.0.0.0:3000/projects/new and try to add a new project name,
this comes up:
http://imgur.com/yxRwC.png
Here is my output when running script/server:
http://imgur.com/A9JTE.png
On my other apps, I have been using sqlite and haven't been having any issues.
I tried uninstalling mongodb and running it anyways for testing purposes and I get
the exact some issue. I guess Mongodb simply isn't being detected through rails and MongoMapper.
Anyone have any idea how to fix this thing?
I spent many hours trying to fix this and resorted to getting a stackoverflow account
and asking on here.
Let me know if there's anything else anyone needs to possibly help diagnose the problem.
Any help would be appreciated.
note: sorry, since I'm new, I can't post pictures of the errors.
I hope you can take the time to view them on imgur

Resources