Passenger And Apache 'Something Went Wrong' Error , Works in WEBRick - ruby-on-rails

I am running Apache2 with Passenger and Rails. I am able to run my web app with 'rails s -e production' but Passenger will not run the app. It just gives the 500 error. The log is giving me the whole precompile error, but changing the config to precompile or 'rake assets:precompile:all' do nothing. I am working with an existing SQL database and it sometimes also gives a table not found error when running behind Apache, but works just fine in WEBRick. I have a "RailsEnv production" directive which did nothing either. I do not understand why it would not work with Passenger but with WEBRick, especially when I got it working with Apache before, then simply redeployed the app in a different directory and got these issues. There is also a cache: get miss error but I resolved it I believe, but my app still does not work. I have been working on it all day yesterday and today and still can not get the app to run with Apache. Already tried permissions, already tried reinstall, already tried db:migrate, already tried everything. Does anyone know why it is failing?

Related

Issue with rails production, rails console not showing updated models

So I am using rails with puma and nginx as my reverse proxy and server for a rails API server.
Every time I make an update on my files , such as updating the model , or controller. I've discovered that my files weren't updating on to production. Discovering this, I found out that I had to restart my puma and nginx each time i made a change.
After i restart both puma and nginx , i see that my APi server looks updated. So i decided to check the console through "rails c production" and I discovered that it couldn't load any of the models and would just keep returning me
NameError: uninitialized constant Post
from (irb):1
Fiddling restarting my servers back and forth , or maybe a period of time , it would magically work on it's own and my files would be updated. Could someone explain to me how do I update my rails production server ? and why is this happening.

Unable to see Ruby on Rails App deployed on Heroku?

I have successfully deployed Ruby on Rails app on Heroku. But when I visit the URL given by Heroku, error says: "The page you were looking for doesn't exist."
URL - https://cryptic-waters-2558.herokuapp.com/
Please help.
Your application is up and running, since the error message comes from Webrick. Probable cause of this error is lack of some initial data (maybe you forgot to run heroku run rake db:seed), which causes ActiveRecord::RecordNotFound error. You can check this easily with heroku logs or heroku logs -t, which works similar to tail -f.

Rails 3.2.1 logging in Passenger, Thin, or Unicorn

I've tried those 3 hosting approaches for my Rails app, and no matter what I do, I can't get consistant logging when I run in the production environment.
For my tests, I created a blank app and tried to access the root directory. I would then add a users scaffold and rake the database.
If I turn RAILS_ENV to development, the log/devlopment.log works just fine, logging everything that I would expect.
When I turn RAILS_ENV to production, the log/production.log logs in a strange manner. In Passenger, I get the first routing error. Then nothing. When I restarted apache or nginx, I would get all the routing errors that I had caused since the first (logged) one, then the log would fail to write anything new until I restarted the underlying server. apache2/error.log would get logged to if I had a configuration issue. Then it only logged cache misses
With Thin and Unicorn, I only get errors about the static assets (I did not precompile the assets). Once I precompiled the assets, no more log messages appeared.
On all 3 setups, I would get precompilation messages (when I ran assets:precompile) in production.log (indicating that Rails could at least write to the log).
Does anyone have a Rails 3.2.1 app that is running on one of the deployment gems (Passenger, Thin, or Unicorn), that is logging correctly in production mode? I've spent 5 days working on this. I'm out of ideas.
Turns out its a reported issue in Rails 3.2.x. A fix has been submitted and will hopefully be released with Rails 3.2.2.
https://github.com/rails/rails/issues/4277

Ever since Mac battery drained (and shut down), Rails app can't post anything to database

My Mac battery ran out while I was running a Rails 3 app, and after I plugged my Mac in and restarted it, I tried running my Rails app's development server (using mysql for the database). Upon trying to update something, I got "Errno::ECONNREFUSED (Connection refused - connect(2))". It turns out that I get this every time I try to post or update now.
There doesn't seem to be any actual problem with the database. I can create new rails apps that work with sqlite, mysql, or postgres, but this old app, which worked fine before, can't work with any of the databases, and I get the same "Connection refused - connect(2)" error no matter which I try. I've never seen this error before, I should note. Also, I don't know that it would matter, but I'm running Rails 3.0.1 on Ruby 1.9.2.
Does anyone know what went wrong? Something went sideways, but I'm at a loss, losing hair and sleep...
The same thing just happened to me. Im sure you've already solved this by now, but this worked for me; try this in your terminal:
rake sunspot:solr:start
rake sunspot:solr:stop
rake sunspot:solr:start
Starting sunspot then killing the process didn't fix the problem. When I stopped it through a rake task then restarted it, it did.

RoR app running on mongrel development but not production

This is my first stab at Ruby on Rails. Just deployed a very simple app to Heroku.
The thing is that my app runs flawlessly on mongrel development; When I run it with "mongrel_rails start -e production" however, I get the error "We're sorry, but something went wrong."
For the life of me, I couldn't debug this. Heroku logs is not returning anything, the Exceptional addon in Heroku is not returning anything, and I cannot find mongrel.log on my Windows machine (when I run mongrel using: mongrel_rails start -e production -d"
I'm using Rails 2.3.5 and sqlite3 with bundler to pack my gems.
I was told that probably rails is not booting up correctly. I can't find any other way to diagnose this. Any ideas?
Thanks,
ANaimi
Take a look at your log/production.log file. That should contain detailed information about what's going on. It will usually contain a line that specifies the name of a gem that needs to be installed.
Heroku doesn't use mongrel, so I'm assuming that's what you're trying to do to figure out why it isn't working when you push it to heroku.
I've found, in most cases, my heroku problems have been because of uninstalled gems. Make sure you create a gem manifest.
Try tailing logs while booting up. From the terminal in the log directory do: tail -f *.log and then launch the app from another terminal (likely it's development.log since you're probably running in development mode.)
Not sure if this got definitively answered, however, check your '%app_root%/config/environments/' folder, and compare 'development.rb' to 'production.rb'.
Make sure that you have all necessary settings in the production.rb file - might have missed something important there.

Resources