2

I'm trying to push my app up to the production env on heroku from my dev environment. Ive transferred all my code using

git push heroku master

Now I need to push my database and Im trying this

heroku db:push

But its failing and Im getting this message at console.

ruby-1.9.3-p194@app0907api @~/Documents/myapp06     
>heroku db:push
/Users/hj/.rvm/gems/ruby-1.9.3-p194@app0907api/gems/sqlite3-1.3.6/lib/sqlite3/sqlite3_native.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

This is a bit strange since my app uses postgres for dev and production and test, I haven't used sqlite at all neither have I installed any gems for sqlite3

What could be going wrong?


 source 'https://rubygems.org/'

 gem 'rails', '3.2.8'



 gem 'rails-api'

 gem 'pg'

 gem 'taps'

 gem 'thin'

 gem 'foreman'

 gem 'rabl'



 gem 'paperclip', '~>3.2.0'
 gem 'aws-sdk', '~>1.3.4'

 group :development do

 gem 'annotate', ">=2.5.0"
 gem 'debugger'
 end

SOLUTION FOUND:

Typed in the following line on my terminal console:

 gem install heroku
 sudo gem install taps

this allowed me to run the command:

heroku db:push

...but now, while sending the db, I'm getting this error:

 Saving session to push_201209202159.dat..
 !!! Caught Server Exception
 HTTP CODE: 500
 Taps Server Error: PGError: ERROR: time zone displacement out of range: "2012-09-18 12:00:00.000000+5894853600"
 LINE 1: ...ated_at") VALUES (45, '37.785834', '-122.406417', '2012-09-1...
Leah Huyghe
  • 337
  • 1
  • 4
  • 15

2 Answers2

3

Update: Functionality to import/export PG data is now part of the CLI as heroku pg:push and heroku pg:pull

I'd highly recommend the use of the pg:transfer plugin for the Heroku CLI. You can do many things with the plugin including transferring data from your local environment up to the Heroku environment.

db:push and db:pull are very fragile for just transferring between two postgres databases. To transfer from local to remote do the following to install the plugin and transfer the data:

$ heroku plugins:install https://github.com/ddollar/heroku-pg-transfer
$ heroku pg:transfer --from $DATABASE_URL --to HEROKU_POSTGRESQL_JADE_URL

The --from $DATABASE_URL flag says to pull from the env variable DATABASE_URL as the local db location and push to your Heroku app's HEROKU_POSTGRESQL_JADE_URL database. You can find your Heroku database name using heroku config:

$ heroku config | grep POSTGRES
HEROKU_POSTGRESQL_JADE_URL: postgres://ads8a8d9asd:al82kdau78kja@ec2-23-23-237-0.compute-1.amazonaws.com:5432/resource123
Ryan Daigle
  • 11,599
  • 2
  • 36
  • 22
-1

You might have missed out some steps.

  1. bundle install

  2. git add .

  3. git commit -m 'your commit message goes here'

  4. git push heroku

  5. heroku run rake db:migrate

Also:

  1. sudo gem install heroku

  2. sudo gem install taps

Edit:

To solve rest:

$ rvm install ruby-1.9.2-p318 $ rvm use ruby-1.9.2-p318 $ heroku db:push

Benjamin Tan Wei Hao
  • 9,621
  • 3
  • 30
  • 56