1

I'm a beginner at RoR, and I am trying to deploy my first app to Heroku. We are using GitHub for the repository, and keep getting an error when trying to deploy with: "git push heroku master"

Please see below the message we get when we run..

$ git push heroku master
Warning: Permanently added the RSA host key for IP address '50.19.85.156' to the list of       known hosts.
Counting objects: 69, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (55/55), done.
Writing objects: 100% (69/69), 26.38 KiB, done.
Total 69 (delta 5), reused 0 (delta 0)
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.3.0.pre.5
   Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
   Fetching gem metadata from https://rubygems.org/.........
   Fetching gem metadata from https://rubygems.org/..
   Installing rake (10.0.3)
   Installing i18n (0.6.1)
   Installing multi_json (1.6.0)
   Installing activesupport (3.2.11)
   Installing builder (3.0.4)
   Installing activemodel (3.2.11)
   Installing erubis (2.7.0)
   Installing journey (1.0.4)
   Installing rack (1.4.5)
   Installing rack-cache (1.2)
   Installing rack-test (0.6.2)
   Installing hike (1.2.1)
   Installing tilt (1.3.3)
   Installing sprockets (2.2.2)
   Installing actionpack (3.2.11)
   Installing mime-types (1.21)
   Installing polyglot (0.3.3)
   Installing treetop (1.4.12)
   Installing mail (2.4.4)
   Installing actionmailer (3.2.11)
   Installing arel (3.0.2)
   Installing tzinfo (0.3.35)
   Installing activerecord (3.2.11)
   Installing activeresource (3.2.11)
   Installing coffee-script-source (1.4.0)
   Installing execjs (1.4.0)
   Installing coffee-script (2.2.0)
   Installing rack-ssl (1.3.3)
   Installing json (1.7.7)
   Installing rdoc (3.12.1)
   Installing thor (0.17.0)
   Installing railties (3.2.11)
   Installing coffee-rails (3.2.2)
   Installing jquery-rails (2.2.1)
   Using bundler (1.3.0.pre.5)
   Installing rails (3.2.11)
   Installing sass (3.2.5)
   Installing sass-rails (3.2.6)
   Installing sqlite3 (1.3.7)
   Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
   /usr/local/bin/ruby extconf.rb
   checking for sqlite3.h... no
   sqlite3.h is missing. Try 'port install sqlite3 +universal'
   or 'yum install sqlite-devel' and check your shared library search path (the
   location where your sqlite3 shared library is located).
   *** extconf.rb failed ***
   Could not create Makefile due to some reason, probably lack of
   necessary libraries and/or headers.  Check the mkmf.log file for more
   details.  You may need configuration options.
   Provided configuration options:
   --with-opt-dir
   --without-opt-dir
   --with-opt-include
   --without-opt-include=${opt-dir}/include
   --with-opt-lib
   --without-opt-lib=${opt-dir}/lib
   --with-make-prog
   --without-make-prog
   --srcdir=.
   --curdir
   --ruby=/usr/local/bin/ruby
   --with-sqlite3-dir
   --without-sqlite3-dir
   --with-sqlite3-include
   --without-sqlite3-include=${sqlite3-dir}/include
   --with-sqlite3-lib
   --without-sqlite3-lib=${sqlite3-dir}/lib
   --enable-local
   --disable-local
   Gem files will remain installed in  /tmp/build_1um81jm55kdnc/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.7 for inspection.
   Results logged to /tmp/build_1um81jm55kdnc/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.7/ext/sqlite3/gem_make.out
   An error occurred while installing sqlite3 (1.3.7), and Bundler cannot continue.
   Make sure that `gem install sqlite3 -v '1.3.7'` succeeds before bundling.
   !
   !     Failed to install gems via Bundler.
   !
   !     Heroku push rejected, failed to compile Ruby/rails app

   To git@heroku.com:aqueous-tor-8402.git
   ! [remote rejected] master -> master (pre-receive hook declined)
   error: failed to push some refs to 'git@heroku.com:aqueous-tor-8402.git'

My gem file is as follows:

source 'https://rubygems.org'

gem 'rails', '3.2.11'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'

gem 'json'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails',   '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby

 gem 'uglifier', '>= 1.0.3'
 end

 gem 'jquery-rails'

 # To use ActiveModel has_secure_password
 # gem 'bcrypt-ruby', '~> 3.0.0'

 # To use Jbuilder templates for JSON
 # gem 'jbuilder'

 # Use unicorn as the app server
 # gem 'unicorn'

 # Deploy with Capistrano
 # gem 'capistrano'

 # To use debugger
 # gem 'ruby-debug'

When I run "sqlite3 -version I get:

 3.7.12 2012-04-03 19:43:07 86b8481be7e76cccc92d14ce762d21bfb69504af

When I do "bundle show sqlite3" I get:

 /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.7

Sorry guys, this is my first Rails app, so I'm relatively new at this stuff.

Any help would be appreciated.

UPDATE: Here is Heroku log

$ heroku logs
2013-02-12T22:04:25+00:00 heroku[api]: Enable Logplex by peterbarbosa1@gmail.com
2013-02-12T22:04:25+00:00 heroku[api]: Release v2 created by peterbarbosa1@gmail.com
2013-02-12T22:04:47+00:00 heroku[router]: at=info code= desc="Blank app" method=GET         path=/favicon.ico host=aqueous-tor-8402.herokuapp.com fwd=99.250.119.144 dyno= queue= wait=             connect= service= status=502 bytes=
2013-02-12T22:04:46+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/ host=aqueous-tor-8402.herokuapp.com fwd=99.250.119.144 dyno= queue= wait= connect= service= status=502 bytes=
2013-02-12T22:41:52+00:00 heroku[slugc]: Slug compilation started
2013-02-12T22:42:39+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2013-02-12T22:45:56+00:00 heroku[slugc]: Slug compilation started
2013-02-12T22:46:30+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2013-02-12T22:59:31+00:00 heroku[slugc]: Slug compilation started
2013-02-12T22:59:52+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2013-02-12T23:00:39+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/ host=aqueous-tor-8402.herokuapp.com fwd=99.250.119.144 dyno= queue= wait= connect= service= status=502 bytes=
2013-02-12T23:00:39+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/favicon.ico host=aqueous-tor-8402.herokuapp.com fwd=99.250.119.144 dyno= queue= wait= connect= service= status=502 bytes=
2013-02-12T23:08:25+00:00 heroku[slugc]: Slug compilation started
2013-02-12T23:08:50+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2013-02-12T23:13:09+00:00 heroku[slugc]: Slug compilation started
2013-02-12T23:13:45+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2013-02-12T23:18:14+00:00 heroku[slugc]: Slug compilation started
2013-02-12T23:18:41+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2013-02-12T23:20:03+00:00 heroku[slugc]: Slug compilation started
2013-02-12T23:20:34+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2013-02-12T23:22:39+00:00 heroku[slugc]: Slug compilation started
2013-02-12T23:23:05+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2013-02-12T23:25:50+00:00 heroku[slugc]: Slug compilation started
2013-02-12T23:26:37+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2013-02-12T23:28:52+00:00 heroku[slugc]: Slug compilation started
2013-02-12T23:29:20+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2013-02-12T23:31:20+00:00 heroku[slugc]: Slug compilation started
2013-02-12T23:32:01+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2013-02-12T23:42:41+00:00 heroku[slugc]: Slug compilation started
2013-02-12T23:43:08+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2013-02-12T23:48:22+00:00 heroku[slugc]: Slug compilation started
2013-02-12T23:48:47+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2013-02-12T23:52:52+00:00 heroku[slugc]: Slug compilation started
2013-02-12T23:53:16+00:00 heroku[slugc]: Slug compilation failed: failed to compile     Ruby/rails app
2013-02-13T00:08:04+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/ host=aqueous-tor-8402.herokuapp.com fwd=99.250.119.144 dyno= queue= wait= connect= service= status=502 bytes=
2013-02-13T00:08:04+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/favicon.ico host=aqueous-tor-8402.herokuapp.com fwd=99.250.119.144 dyno= queue= wait= connect= service= status=502 bytes=
2013-02-13T00:09:49+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/ host=pbarbosa.herokuapp.com fwd=99.250.119.144 dyno= queue= wait= connect= service= status=502 bytes=
2013-02-13T00:09:49+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/favicon.ico host=pbarbosa.herokuapp.com fwd=99.250.119.144 dyno= queue= wait= connect= service= status=502 bytes=
2013-02-13T00:09:49+00:00 heroku[router]: at=info code=H16 desc="herokuapp redirect" method=GET path=/ host=pbarbosa.heroku.com fwd="99.250.119.144" dyno= queue= wait= connect= service= status=301 bytes=
2013-02-13T00:19:18+00:00 heroku[slugc]: Slug compilation started
2013-02-13T00:19:41+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2013-02-13T00:39:17+00:00 heroku[api]: Attach HEROKU_POSTGRESQL_AQUA resource by peterbarbosa1@gmail.com
2013-02-13T00:39:17+00:00 heroku[api]: Release v3 created by peterbarbosa1@gmail.com
2013-02-13T01:27:38+00:00 heroku[slugc]: Slug compilation started
2013-02-13T01:27:59+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2013-02-13T01:29:28+00:00 heroku[slugc]: Slug compilation started
2013-02-13T01:29:52+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2013-02-13T01:31:32+00:00 heroku[slugc]: Slug compilation started
2013-02-13T01:32:01+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
2013-02-13T01:32:30+00:00 heroku[slugc]: Slug compilation started
2013-02-13T01:32:55+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app

2 Answers2

7

Heroku doesn't support sqlite databases. You need to use postgres in production. In rails, switching databases is easy:

group :production do
  gem "pg"
end

group :development, :test do
  gem "sqlite3"
end

Change your gemfile like above, then run bundle, and commit your changes to Gemfile and Gemfile.lock. Then, run git push heroku master again.

This will let you use sqlite locally in your development and test environment, and postgres as required on heroku.

By the way, one of the principal beauties of rails is that it lets you switch databases so easily. In other frameworks, doing just this could cost you hours.

Dennis Hackethal
  • 13,662
  • 12
  • 66
  • 115
  • Be sure to commit both the gemfile and gemfile.lock files and then push, so Heroku can pick up the changes – catsby Feb 13 '13 at 02:23
  • A dev db should be provided by default on Rails apps as DATABASE_URL env var. – GregB Feb 13 '13 at 02:35
0

Here are a couple of things to make sure

  1. comment out the production environment on database.yml. heroku does that for you already. and like the person said above, heroku doesn't use sqlite3 but you can use sqlite3 for test and development it doesnt make a difference
  2. before you push make sure you migrate your database if you made any changes to the database. do heroku run rake db:migrate and then try git push heroku master.

hope this solves it

for future reference, post the heroku log, easier to solve from looking at that.

TakaGoto
  • 362
  • 4
  • 17
  • I have commented out on the database, performed a rake db:migrate and still the same error. I have updated the post to include my heroku log. I also commented out the SQL for Prod on the Gemfile. Please see the updated post above – Peter Barbosa Feb 13 '13 at 01:35
  • hmm I don't think its heroku thats the problem, slug compilation failed means it failed to compress your rails app. this could be caused by many reasons though. for example an outdated rails app, or if you have pdf files in your assets or something. i would try .slugignore in your ignore file and see what happens – TakaGoto Feb 19 '13 at 03:40