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.
Related
I downloaded and installed Ruby, Ruby gems and with it installed Jekyll. Started a test project with Jekyll. Want to deploy it on Heroku (because gh-pages don't support plugins on Jekyll).
Read docs on Heroku for ruby, downloaded and installed JDK 8 and JRuby 9.1.17.0. Installed bundler.
Logged in Heroku, and executed following commands in terminal:
heroku create
git push heroku master
heroku open
The new heroku app build succeeded but the website fails to load. It displays error like so:
This is the error displayed when I check heroku logs
I also built a Procfile in the root folder for the test project. Entered the following code:
web: puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}
I'm not sure what went wrong. Please help!
You need to figure out what's your web-server by default. As advised by Roberto, it might be puma.
By the default, when you run rails new, it always has the web-server gem (puma, passenger, unicorn or anything else).
It seems that you've copied some settings? And that's why you don't have puma in Gemfile, but trying to run it. You might share the Gemfile list to let you know what's wrong.
running Geometry::Point.new(1,1) in development goes fine meanwhile in my production server it gives uninitialized constant MyControllerController::Geometry
on my production server, I've checked this:
bundle exec bundle show geometry returns
/path_to_app/shared/bundle/ruby/2.0.0/gems/geometry-6.2
bundle exec bundle show ruby-geometry got
/path_to_app/shared/bundle/ruby/2.0.0/gems/ruby-geometry-0.0.5
in dev , even Point(1,1) works , with no need of module and 'new', which breaks in production too. returning: NameError: uninitialized constant Point
I've tried require 'geometry' and include Geometry, but both till fails
can someone help me plz?
Make sure you you put ruby-geometry gem into your Gemfile like this:
gem 'ruby-geometry', require: 'geometry'
I probably should emphasize it even more in README file of the gem.
After 2 days trying to solve this problem the answer was in reboot the machine... reset only the nginx and unicorn do not worked... but when I do reboot the VPS, it started working ...
How did we find out?
Searching about we have run into Pow not loading gem properly while rails s works
I'm Using Ubuntu with nginx and unicorn, nothing to see with Pow ... whatever it gave some light... for no reason we decided reboot the VPS ... and it worked.
Thank you all who helped me
I updated a gem(rtf) in my ruby on rails app through the Gemfile. The app works fine on my localhost but when I pushed changes to heroku and tried 'bundle install' within heroku bash. I see that the gem has been installed based on the log
Using rtf (0.3.3)
Following this, I did a
heroku restart --a myapp
however, when i tried the app on heroku, it still cant recognize the lib installed through the gem, i get the following error(normally appears when the library cannot be reached for command "require 'RTF'").
cannot load such file -- RTF
What am I doing wrong in heroku?
I think you misunderstand how Heroku works. When you run a bash shell on your app, nothing you do on that dyno will affect any other dynos for your app (like your web dynos). Heroku runs bundle install for you when you deploy your app and if your Gemfile is configured correctly all the gems will be installed.
the answer by sevenseacat is right- i had just got the case wrong-
require 'rtf'
works fine. In OSX, it ignores case in the command require 'RTF'
I'm brand new to Rails and am following this tutorial on how to make Rails applications. I can't get the database to migrate to my heroku apps.
I'm currently at the beginning of chapter 3, trying to set up an app to use for the rest of the course.
I've been following the tutorial perfectly, and, so far, I've already built two apps and deployed them to heroku and migrated the data just fine, but the third time it's not working.
I was able to make the heroku page and push the app to it, but I just can't migrate the data.
I typed:
heroku run rake db:migrate
and got this error:
/usr/bin/env: ruby.exe: No such file or directory.
I'm assuming this means it's looking for the file in that directory and not finding it. How do I change where it's looking?
I checked "windows heroku run rake db:migrate error “/usr/bin/env: ruby.exe: No such file or directory”" and did what the answers recommended, that is, change "ruby.exe" to "ruby" in bin/bundle, bin/rails, and bin/rake, but that didn't work.
Any other tips? I have been stuck on this for hours. Thank you so much in advance.
The command is normally heroku run rake db:migrate. You should try that instead of heroku run rails db:migrate.
Make sure you've pushed your app to heroku. When it's pushing to heroku, make sure that it is also detected as a rails app. It's possible that heroku isn't detecting a rails app so the environment it sets up doesn't have ruby installed. But it may just be the error in the command name (rails instead of rake).
I had a similar problem on a repository I had ported over from windows.
It turns out that several scripts in the app's bin directory still had a shebang lines (#!/usr/bin/env ruby.exe) to ruby.exe instead of ruby. Once I fixed these scripts the problem went away.
On your local dev machine, before committing to git (and then pushing to Heroku), try changing the line endings to Unix line endings (rather than Windows line endings). On a *nix machine you'd do that by running dos2unix myfile.rb
If the line endings are wrong, the Linux loaded on Heroku will look for ruby^M and not for ruby, and will of course not find it, and give this exact error message.
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?