Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialUlises Reyes
9,152 PointsIssues trying to push to Heroku
So I've been trying for the past 6 hours to get Treebook to push to Heroku, but have been running into back to back issues every single step of the way. Im pretty infuriated right now, so please don't take the tone of this post the wrong way.
Problem 1: Permission Denied (publickey)
I'm tried to push my treebook app into Heroku but I get the permission denied error even though I have typed heroku keys:add
The response is this:
Found existing public key: /Users/ureyes/.ssh/github_rsa.pub
Uploading SSH public key /Users/ureyes/.ssh/github_rsa.pub... done
However, after doing that, typing git push heroku master
gives me this error:
ssh: Could not resolve hostname heroku.com: nodename nor servname provided, or not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
A few hours later, and hundred of search queries and Forum searches, I run into this "solution":
First typing
ssh-keygen -t rsa
then
heroku keys:add
then choosing option 2 below:
Found the following SSH public keys:
1) github_rsa.pub
2) id_rsa.pub
Then
git push heroku master
BUT THEN I GET ANOTHER ERROR, YAY!
Problem 2: Could not deploy because of sqlite3
Initializing repository, done.
Counting objects: 298, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (272/272), done.
Writing objects: 100% (298/298), 108.67 KiB | 0 bytes/s, done.
Total 298 (delta 119), reused 0 (delta 0)
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using 1.5.2
New app detected loading default bundler cache
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
Using multi_json (1.8.2)
Using erubis (2.7.0)
Using builder (3.0.4)
Using journey (1.0.4)
Using rack (1.4.5)
Using hike (1.2.3)
Using tilt (1.4.1)
Using polyglot (0.3.3)
Installing rake (10.1.1)
Using tzinfo (0.3.38)
Using atomic (1.1.14)
Using bcrypt-ruby (3.1.2)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using json (1.8.1)
Using thor (0.18.1)
Installing arel (3.0.3)
Using bundler (1.5.2)
Installing i18n (0.6.9)
Installing mime-types (1.25.1)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using rack-ssl (1.3.3)
Installing orm_adapter (0.5.0)
Using sprockets (2.2.2)
Using treetop (1.4.15)
Using thread_safe (0.1.3)
Using coffee-script (2.2.0)
Using rdoc (3.12.2)
Installing warden (1.2.3)
Installing uglifier (2.4.0)
Using mail (2.5.4)
Installing sass (3.2.13)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/tmp/build_efb692cc-e6da-4268-adf2-c10831f9f368/vendor/ruby-2.0.0/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=/tmp/build_efb692cc-e6da-4268-adf2-c10831f9f368/vendor/ruby-2.0.0/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}/
--enable-local
--disable-local
Gem files will remain installed in /tmp/build_efb692cc-e6da-4268-adf2-c10831f9f368/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.8 for inspection.
Results logged to /tmp/build_efb692cc-e6da-4268-adf2-c10831f9f368/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.8/ext/sqlite3/gem_make.out
Installing activesupport (3.2.16)
An error occurred while installing sqlite3 (1.3.8), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.8'` succeeds before bundling.
Bundler Output: Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
Using multi_json (1.8.2)
Using erubis (2.7.0)
Using builder (3.0.4)
Using journey (1.0.4)
Using rack (1.4.5)
Using hike (1.2.3)
Using tilt (1.4.1)
Using polyglot (0.3.3)
Installing rake (10.1.1)
Using tzinfo (0.3.38)
Using atomic (1.1.14)
Using bcrypt-ruby (3.1.2)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using json (1.8.1)
Using thor (0.18.1)
Installing arel (3.0.3)
Using bundler (1.5.2)
Installing i18n (0.6.9)
Installing mime-types (1.25.1)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using rack-ssl (1.3.3)
Installing orm_adapter (0.5.0)
Using sprockets (2.2.2)
Using treetop (1.4.15)
Using thread_safe (0.1.3)
Using coffee-script (2.2.0)
Using rdoc (3.12.2)
Installing warden (1.2.3)
Installing uglifier (2.4.0)
Using mail (2.5.4)
Installing sass (3.2.13)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/tmp/build_efb692cc-e6da-4268-adf2-c10831f9f368/vendor/ruby-2.0.0/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=/tmp/build_efb692cc-e6da-4268-adf2-c10831f9f368/vendor/ruby-2.0.0/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}/
--enable-local
--disable-local
Gem files will remain installed in /tmp/build_efb692cc-e6da-4268-adf2-c10831f9f368/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.8 for inspection.
Results logged to /tmp/build_efb692cc-e6da-4268-adf2-c10831f9f368/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.8/ext/sqlite3/gem_make.out
Installing activesupport (3.2.16)
An error occurred while installing sqlite3 (1.3.8), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.8'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Detected sqlite3 gem which is not supported on Heroku.
! https://devcenter.heroku.com/articles/sqlite3
!
! Push rejected, failed to compile Ruby app
To git@heroku.com:agile-fortress-5448.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:agile-fortress-5448.git'
So I go to the page mentioned, https://devcenter.heroku.com/articles/sqlite3 and the first step is to go to my gemfile and replace 'sqlite3' with 'pg'. When I typed bundle install
in the terminal, it was giving me issues installing Postgres. I can no longer reproduce the error because I used homebrew to install postgress and THAT problem was solved.
Problem 3: updaing the database
Following step was to edit my config/database.yml file from
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
to
development:
adapter: postgresql
database: my_database_development
pool: 5
timeout: 5000
test:
adapter: postgresql
database: my_database_test
pool: 5
timeout: 5000
production:
adapter: postgresql
database: my_database_production
pool: 5
timeout: 5000
(I gave it a name different than "my_database")
Next step was to create and migrate my databases, but alas
Problem #3: rake db:create
and rake db:migrate
do not work
Here is the error I get after performing all these steps
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/postgresql_adapter.rb:1222:in `initialize'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/postgresql_adapter.rb:1222:in `new'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/postgresql_adapter.rb:1222:in `connect'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/postgresql_adapter.rb:324:in `initialize'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `new'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `postgresql_connection'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
/Users/ureyes/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
/Users/ureyes/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/railties/databases.rake:144:in `rescue in create_database'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/railties/databases.rake:85:in `create_database'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/railties/databases.rake:62:in `block (3 levels) in <top (required)>'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/railties/databases.rake:62:in `each'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/railties/databases.rake:62:in `block (2 levels) in <top (required)>'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task.rb:236:in `call'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task.rb:236:in `block in execute'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task.rb:231:in `each'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task.rb:231:in `execute'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/Users/ureyes/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task.rb:161:in `invoke'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:149:in `invoke_task'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:106:in `each'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:106:in `block in top_level'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:115:in `run_with_threads'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:100:in `top_level'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:78:in `block in run'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:75:in `run'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/bin/rake:33:in `<top (required)>'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/bin/rake:23:in `load'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/bin/rake:23:in `<main>'
Couldn't create database for {"adapter"=>"postgresql", "database"=>"my_database_development", "pool"=>5, "timeout"=>5000}
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/postgresql_adapter.rb:1222:in `initialize'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/postgresql_adapter.rb:1222:in `new'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/postgresql_adapter.rb:1222:in `connect'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/postgresql_adapter.rb:324:in `initialize'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `new'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `postgresql_connection'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
/Users/ureyes/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
/Users/ureyes/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/railties/databases.rake:144:in `rescue in create_database'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/railties/databases.rake:85:in `create_database'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/railties/databases.rake:62:in `block (3 levels) in <top (required)>'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/railties/databases.rake:62:in `each'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/railties/databases.rake:62:in `block (2 levels) in <top (required)>'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task.rb:236:in `call'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task.rb:236:in `block in execute'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task.rb:231:in `each'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task.rb:231:in `execute'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/Users/ureyes/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task.rb:161:in `invoke'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:149:in `invoke_task'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:106:in `each'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:106:in `block in top_level'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:115:in `run_with_threads'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:100:in `top_level'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:78:in `block in run'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:75:in `run'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/bin/rake:33:in `<top (required)>'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/bin/rake:23:in `load'
/Users/ureyes/.rvm/gems/ruby-1.9.3-p484/bin/rake:23:in `<main>'
Couldn't create database for {"adapter"=>"postgresql", "database"=>"my_database_test", "pool"=>5, "timeout"=>5000}
And now I am stuck. I have no idea what to do or change, and feel like I cant continue with the lessons if I cant even deploy my app... Any help at all would be appreciated
3 Answers
Andrew Corcoran
20,552 PointsHi Ulises,
I just encountered nearly the exact same issue and here's what I did to resolve it.
First, the config/database.yml
file should maintain sqlite3 as the database for development and test environments. However the production database should be changed to postgresql as shown below.
## config/database.yml ##
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: postgresql
database: treebook
pool: 5
timeout: 5000
Next, make sure you have changed sqlite3 to only be used for your development and test environments in the Gemfile as shown below.
group :development, :test do
gem 'sqlite3'
end
Now add the PostgreSQL gem to the Gemfile as well
gem 'pg'
Once all of these steps have been completed, go ahead and run bundle install
again, and then commit your changes to git. You should now be able to run git push heroku master
successfully.
Let me know if this works for you!
Ahmed Abdelaal
6,328 PointsHey Bob, after you've done everything Andrew Corcoran recommended make sure you add the changes in a commit and THEN push to Heroku. To generalize the process again just make sure you've done everything below.
At this point I will assume that:
- You're logged in Heroku via terminal
heroku login
- You're signed in to heroku via ssh ( or skip it and be prompted for it when you attempt pushing)
heroku keys:add
- You've added Heruko remote branches via
heroku create app_name
- app_name is optional but must be unique if included. If you don't include it, Heroku will randomly create one for you
After that :
- Make sure your Gemfile includes 2 groups that include Sqlite3 (rails default) or whatever DB you use for development and Postgres for production.
group :development do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
- Run bundle to add changes.
bundle install
- Add changes to git.
git add -A
- Commit the changes..
git commit -m "You're commit message"
- Push to Heroku.
git push heroku master
This is mostly what you need to cover from start to finish, to ensure that things run correctly. Good luck!
Bob Finkle
2,787 PointsI am stuck on this as well, getting the error
remote: An error occurred while installing sqlite3 (1.3.10), and Bundler cannot
remote: continue.
remote: Make sure that `gem install sqlite3 -v '1.3.10'` succeeds before bundling.
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Detected sqlite3 gem which is not supported on Heroku.
remote: ! https://devcenter.heroku.com/articles/sqlite3
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
remote:
I updated my database.yml :
## config/database.yml ##
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: postgresql
database: treebook
pool: 5
timeout: 5000
and my Gemfile:
source 'https://rubygems.org'
gem 'rails', '4.2.1'
gem 'bootstrap-sass', '3.2.0.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'devise', '~> 3.4.1'
gem 'jquery-turbolinks'
group :production, :staging do
gem 'pg'
end
group :development, :test do
gem 'sqlite3'
end
group :development, :test do
gem 'byebug'
gem 'web-console', '~> 2.0'
gem 'spring'
end