Pushing rails app to heroku not working - ruby-on-rails

I'm trying to use git push heroku master to upload my rails 3 app to heroku, but I keep getting the following error:
-----> Heroku receiving push
-----> Removing .DS_Store files
-----> Rails app detected
! Heroku Bamboo does not include any Rails gems by default.
! You'll need to declare it in either .gems or Gemfile.
! See http://docs.heroku.com/gems for details on specifying gems.
! Heroku push rejected, no Rails gem specified.
error: hooks/pre-receive exited with error code 1
I've tried deleting the on the heroku website and starting again, i've also tried wiping out my git repo and doing init again, and I keep getting the same error. My Gemfile is as follows:
source :rubygems
gem 'rails', '3.0.3'
gem 'recaptcha', :require => 'recaptcha/rails'
gem 'devise', '1.1.3'
gem 'acts-as-taggable-on'
gem 'ruby-debug'
# for sass
gem 'haml'
gem 'mocha'
gem 'ruby-pg'
I've run bundle package to package teh gems into vendor cache, but it doesn't seem to change the result.
I upgraded this app from rails 2.3, so i'm wondering if that has anything to do with it?

This is the answer I got from Heroku:
Hi,
The problem seems to be that your Gemfile is called GemFile. While that'll work on some platforms like the Mac, that won't work on a strictly case-sensitive filesystem, such as ours.
In order to rename the file in a case-retaining, case-insensitive file system like HFS or NTFS, you'll need to do it in two steps:
git mv GemFile Gemfile.temp
git mv Gemfile.temp Gemfile

Try adding these to your Gemfile
gem 'pg' # Heroku's DB runs on postgresql
gem 'heroku'

Related

Heroku deployment stalls with my rails app, any suggestions?

I'm trying to deploy an app to heroku. I'm running an ubuntu VM. I just had a lot of trouble getting postgres set up, but I think I'm good to go with that.
I've run
heroku create
and i've committed the most recent changed upon my master branch. When I run bundle install - everything is ok. And when I run
git push heroku master
Everything is smooth, including the installing of the gems. Until I reach the line
------> Writing config/database.yml to read from DATABASE_URL
Everything stalls and I'm greeted with this message 15 minutes later
Timed out compiling ruby app (15 minutes)
for good measure here is my database.yml code
development:
adapter: postgresql
database: saasbook
pool: 5
password:
And here is my gem file
gem 'rails', '4.0.2'
gem 'rails_12factor' , group: :production
gem 'pg'
gem 'saas-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'oauth2'
gem 'figaro'
gem 'rake'
gem devise'
gem 'bootstrap-sass'
gem 'rails_layout'
gem 'zxing'
gem 'rmagick'
gem 'carrierwave'
gem 'rqrcode_png'
ruby "2.0.0"
The heroku deployment tutorial stated to insert the line ruby "2.0.0" after bundle install, and before the commit. I am currently running ruby 1.9.3 if that matters/ would have a conflict.
Any suggestions would be a huge help! thanks!
Edit
I'll leave this out here in case this problem ever arises again for someone
Alas, heroku doesn't like java/C dependent gems, and the QR decoding gem ZXING cannot be used on heroku, that was the reason it was stalling.
For starters, you're missing a quote in your Gemfile for devise:
gem devise' should be gem 'devise'
I would also recommend moving the ruby "2.0.0" line to the top of the Gemfile. It may not matter, but it's worth a shot.
Could be a network issue. Be sure the network you are using has all the appropriate ports open for GIT and heroku. You will need more than port 80.
I am sure you solved this already but for ref:
Make sure that your IDE (mine is RubyMine) is not open on that project or the build will stall/fail.

Heroku: push rejected - failed to install gems via bundler

I've tried to push an app to Heroku in the same way I have always done. I'm using Ruby 1.9.2 and Rails 3.2.1. However, now I'm getting this error message. I did what it recommends
make sure that `gem install sqlite3 -v '1.3.5'` succeeds before bundling.
Note, it's doing this even though I did in my gemfile
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
but doing gem install sqlite3 -v '1.3.5' in the terminal, but the push is still being rejected. I'm not sure how to check the Gem files it refers to in the tmp directory but even if I did, i wouldn't understand them
Any suggestions?
Gem files will remain installed in /tmp/build_1timyd7o5k59l/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.5 for inspection.
Results logged to /tmp/build_1timyd7o5k59l/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.5/ext/sqlite3/gem_make.out
An error occurred while installing sqlite3 (1.3.5), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.5'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
I always just comment out the SQLite3 gem and it works well for me, so when I push to heroku my gemfile looks like this:
# Development Database
#gem 'sqlite3'
# Production Database
gem 'pg'
EDIT:
The above solution works, and is easy if you don't want to update your gems for whatever reason. The better long term solution to this problem is to do the following:
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
then delete your gemfile.lock file.
You'll need to generate a new gemfile.lock file that reflects your changes. In the terminal run:
bundle update
Finally, update your repository and push to heroku by doing the following in the terminal:
git add .
git commit -m "commit message"
git push heroku
Actually your initial Gemfile code was correct if you wanted to use sqlite3 locally. like you showed, you put this in the gem file:
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
then you have to delete your local Gemfile.lock, and run:
bundle update
to re-build the .lock file. then add and re-commit the Gemfile:
git add Gemfile
git commit -m "Gemfile commit message"
then push the new Gemfile to the repo:
git push master
change the GIT details accordingly of course, but you get the point. it's all about adding/committing/pushing the Gemfile.
As far as I know Heroku does not support sqlite3, but instead you with a PostgreSQL database. You'll need to modify your Gemfile as such, and your database.yml. So for your production group, in your Gemfile, you'll want:
https://devcenter.heroku.com/articles/rails3
edit:
There appears to be a more detailed answer here, so this may be a duplicate: Pushing Rails with SQLite3 to Heroku fails
you must add updated Gemfile.lock to git and try git push heroku master...
it worked for me and for sure it will for you too
and donot forget to add
config.action_controller.perform_caching = true

Heroku does not accept push even though I have sqlite in development block

I have the following lines in my Gemfile:
gem 'rails', '3.1.1'
group :production do
gem 'pg'
end
group :development, :test do
gem 'sqlite3'
end
I also ran bundle install to have my Gemfile.lock updated.
When I push to heroku I still get the following error:
!
! Failed to install gems via Bundler.
!
! Detected sqlite3 gem which is not supported on Heroku.
! http://devcenter.heroku.com/articles/how-do-i-use-sqlite3-for-development
!
! Heroku push rejected, failed to compile Ruby/rails app
What am I missing?
Hoppla. I made quite a silly mistake here. I was currently working on a branch but I pushed the master branch to Herokum, like I was used to.
So git push heroku master did push an old version of the branch, which did of course not contain my changes to the Gemfile.
I had sqlite3 in development block, but I had recently installed mailcatcher, a useful gem to catch sent emails and display them to you in your browser.
mailcatcher has sqlite3 as a dependency. Moving it back where it belongs fixed the problem:
group :development, :test do
gem 'sqlite3'
gem 'mailcatcher'
end
If you have this error but are sure you do not include sqlite3 outside of the development mode, look for other gem requiring it.

Heroku's trying to install development gems even after I've told it not to

I'm diving into RoR and I'm using Heroku to host the test app I'm building. When I do a push to Heroku, it crashes when trying to intall the linecache19 gem (which is used by ruby-debug19 gem)...
Installing ruby_core_source (0.1.4)
Installing linecache19 (0.5.11) with native extensions /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
After searching all over the web for this problem, everyone's solution was...
heroku config: add BUNDLE_WITHOUT="test development" --app app_name
But the push to Heroku still crashes even after I did that. Here's my Gemfile...
source 'http://rubygems.org'
gem 'rails', '3.0.5'
gem "carrierwave"
gem "mini_magick"
gem "fog"
group :development do
gem 'annotate-models', '1.0.4'
gem 'sqlite3'
gem 'ruby-debug19'
gem 'sqlite3-ruby', :require => 'sqlite3'
end
I even uninstalled the ruby-debug19 gem and it's still crashing and trying to install the linecache19 gem. Why won't this linecache19 gem go away? I'm new to all this and, as such, I'm sure I'm missing something obvious. Your thoughts?
Thanks for your wisdom!
Your heroku config command is malformed. You have a space before add and you are missing the colon between development and test.
$ heroku config:add BUNDLE_WITHOUT="development:test" --app app_name
Docs are here.
Also, are you remembering to run bundle install locally and commit both your Gemfile and Gemfile.lock into git?

Heroku deployment using Mongo

Can someone tell me what I am doing wrong? I am trying to push a simple rails app to Heroku that uses MongoDB. My Gemfile contains the following line:
gem "mongo"
When pushing the app to Heroku it error's out with: no such file to load -- mongo
-----> Heroku receiving push
-----> Rails app detected
-----> Detected Rails is not set to serve static_assets
Installing rails3_serve_static_assets... done
-----> Gemfile detected, running Bundler version 1.0.3
Unresolved dependencies detected; Installing...
/usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- mongo (LoadError)
Here is my whole gemfile:
require 'rubygems'
require 'mongo'
source 'http://gemcutter.org'
gem "rails", "3.0.0"
#gem 'rails', :git => 'http://github.com/rails/rails.git'
gem "mongo_mapper"
gem 'mongoid', '2.0.0.beta.20'
gem 'devise', :git => 'git://github.com/plataformatec/devise.git'
gem 'heroku', '1.13.7'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
You dont need either of these lines in your Gemfile:
require 'rubygems'
require 'mongo'
Neither of those are required for bundler to update or install your gems.
Also, is there a reason why you're installing both mongoid and mongo_mapper?
Perhaps another approach that you can use, is to use something like https://mongolab.com, connect you application with the database on the cloud, and then make the deployment (only the rails application).I've been using MongoLabs for a while, and works pretty good, you can check your collections directly from there (you don't need to use the JS shell). This is just a suggestion, to make the deployment easier :)

Resources