0

I am having trouble with deploying rails 3.1. app to heroku.

After some research, I found out that the main reason behind the issue is this - http://devcenter.heroku.com/articles/how-do-i-use-sqlite3-for-development

After changing my gem file:

group :production do
 gem 'pg'
end
group :development, :test do
 gem 'sqlite3'
end

Still the "We're sorry, but something went wrong." page error.

Here is the log file:

 ←[36m2011-11-26T16:34:31+00:00 heroku[api]:←[0m Add-on add logging:basic by emil
 [email protected]
 ←[36m2011-11-26T16:34:31+00:00 heroku[api]:←[0m Release v2 created by emils.veve
 [email protected]
 ←[36m2011-11-26T16:34:31+00:00 heroku[api]:←[0m Add-on update shared-database
 ←[36m2011-11-26T16:34:31+00:00 heroku[api]:←[0m Release v3 created by emils.veve
 [email protected]
 ←[33m2011-11-26T16:43:15+00:00 heroku[slugc]:←[0m Slug compilation started
 ←[36m2011-11-26T16:44:17+00:00 heroku[api]:←[0m Deploy 277a3f4 by emils.veveris@
 thrillengine.com
 ←[36m2011-11-26T16:44:17+00:00 heroku[api]:←[0m Release v4 created by emils.veve
  [email protected]
 ←[32m2011-11-26T16:44:18+00:00 heroku[web.1]:←[0m State changed from created to
  starting
 ←[33m2011-11-26T16:44:18+00:00 heroku[slugc]:←[0m Slug compilation finished
 ←[32m2011-11-26T16:44:28+00:00 heroku[web.1]:←[0m State changed from starting to
  up
 ←[35m2011-11-26T17:09:51+00:00 heroku[nginx]:←[0m 81.198.241.178 - - [26/Nov/201
  1:09:09:51 -0800] "GET / HTTP/1.1" 500 728 "-" "Mozilla/5.0 (Windows NT 5.1; rv:
  8.0) Gecko/20100101 Firefox/8.0" stormy-night-6239.heroku.com
 ←[32m2011-11-26T18:12:59+00:00 heroku[web.1]:←[0m Idling
 ←[32m2011-11-26T18:13:00+00:00 heroku[web.1]:←[0m State changed from up to down
 ←[32m2011-11-26T18:13:00+00:00 heroku[web.1]:←[0m State changed from down to cre
  ated
 ←[32m2011-11-26T18:13:01+00:00 heroku[web.1]:←[0m State changed from created to
 starting
 ←[32m2011-11-26T18:13:02+00:00 heroku[web.1]:←[0m Stopping process with SIGTERM
 ←[32m2011-11-26T18:13:02+00:00 app[web.1]:←[0m >> Stopping ...
 ←[32m2011-11-26T18:13:02+00:00 heroku[web.1]:←[0m Process exited
 ←[32m2011-11-26T18:13:11+00:00 app[web.1]:←[0m >> Thin web server (v1.2.6 codena
  me Crazy Delicious)
 ←[32m2011-11-26T18:13:11+00:00 app[web.1]:←[0m >> Maximum connections set to 102
  4
 ←[32m2011-11-26T18:13:11+00:00 app[web.1]:←[0m >> Listening on 0.0.0.0:29604, CT
 RL+C to stop
 ←[32m2011-11-26T18:13:12+00:00 heroku[web.1]:←[0m State changed from starting to
 up
 ←[32m2011-11-26T19:16:24+00:00 heroku[web.1]:←[0m Idling
 ←[32m2011-11-26T19:16:25+00:00 heroku[web.1]:←[0m State changed from up to down
 ←[32m2011-11-27T11:29:48+00:00 heroku[web.1]:←[0m Unidling
 ←[32m2011-11-27T11:29:48+00:00 heroku[web.1]:←[0m State changed from down to cre
 ated
 ←[32m2011-11-27T11:29:50+00:00 heroku[web.1]:←[0m State changed from created to
 starting
 ←[32m2011-11-27T11:29:53+00:00 heroku[web.1]:←[0m Starting process with command
 `thin -p 16668 -e production -R /home/heroku_rack/heroku.ru start`
 ←[32m2011-11-27T11:29:59+00:00 app[web.1]:←[0m >> Thin web server (v1.2.6 codena
 me Crazy Delicious)
 ←[32m2011-11-27T11:29:59+00:00 app[web.1]:←[0m >> Maximum connections set to 102
 4
 ←[32m2011-11-27T11:29:59+00:00 app[web.1]:←[0m >> Listening on 0.0.0.0:16668, CT
 RL+C to stop
 ←[32m2011-11-27T11:30:00+00:00 heroku[web.1]:←[0m State changed from starting to
 up
 ←[31m2011-11-27T11:30:01+00:00 heroku[router]:←[0m GET stormy-night-6239.heroku.
 com/ dyno=web.1 queue=0 wait=0ms service=230ms status=500 bytes=728

I don't see any errors there.

I also tried running heroku rake db:migrate And gotthis error :

rake aborted!
An error has occurred, this and all later migrations canceled:

PGError: ERROR:  column "location_id" of relation "trips" already exists
: ALTER TABLE "trips" ADD COLUMN "location_id" integer

Currently I really don't understand what do, where to look and what to change. Everything works fine on my local machine, tough!

Thanks for any help/ROR Newbie!

UPDATE:

after heroku rake db:reset

 Couldn't drop dahrzbhlza : #<ActiveRecord::StatementInvalid: PGError: ERROR:  mu
 st be owner of database dahrzbhlza
 : DROP DATABASE IF EXISTS "dahrzbhlza">
 dahrzbhlza already exists
 -- create_table("categories", {:force=>true})
 -> 0.0595s
 -- create_table("categories_trips", {:id=>false, :force=>true})
 -> 0.0031s
 -- create_table("details", {:force=>true})
 -> 0.0129s
 -- create_table("details_trips", {:id=>false, :force=>true})
 -> 0.0042s
 -- create_table("images", {:force=>true})
 -> 0.1982s
 -- create_table("locations", {:force=>true})
 -> 0.1065s
 -- create_table("trips", {:force=>true})
 -> 0.0422s
 -- create_table("users", {:force=>true})
 -> 0.1486s
 -- add_index("users", ["email"], {:name=>"index_users_on_email", :unique=>true})

 -> 0.0102s
 -- initialize_schema_migrations_table()
 -> 0.0017s
 -- assume_migrated_upto_version(20111116120713, ["/app/db/migrate"])
 -> 0.0091s

After heroku rake db:migrate:redo

 ==  AddTitleToImages: reverting ===============================================
 -- remove_column("images", :title)
 -> 0.0058s
 ==  AddTitleToImages: reverted (0.0059s) ======================================

 ==  AddTitleToImages: migrating ===============================================
 -- add_column(:images, :title, :string)
 -> 0.0032s
 ==  AddTitleToImages: migrated (0.0033s) ======================================

Another Question - why it is migrating only those two columns above - not all ?

3 Answers 3

1

another thing you'll want to do is move to the Cedar stack for Rails 3.1 sites - you're running on Bamboo from that stack trace - heroku create --stack cedar and then repush. You also won't need the rubyracer gem listed in your gemfile, it's very memory hungry and not required anymore on Cedar.

Sign up to request clarification or add additional context in comments.

Comments

1

Try rebuilding the database by pushing a working copy from your local machine. You can use taps for that, like so

#On your local machine, that has a working database
$heroku db:push

Once they're the same, your migrations should start making more sense.

1 Comment

I've tried heroku db:push - still no changes, still the "We're sorry, but something went wrong. error"
0

try this

group :production do
  # gems specifically for Heroku go here
  gem 'therubyracer-heroku', '0.8.1.pre3'
  gem "pg"
end

5 Comments

Ok I did it, but now I have another PGError: ERROR:. this time it is : ←[0m ActionView::Template::Error (PGEr ror: ERROR: relation "categories" does not exist - how can you fix them ?
run again heroku rake db:migrate and now it's only PGError: ERROR: column "location_id" of relation "trips" already exists : ALTER TABLE "trips" ADD COLUMN "location_id" integer
Now it seems your DB is broken in migration. If there is no important data in your DB, try to reset the DB with heroku db:reset and redo the migration.
Nope, still no luck - I've updated my question above, after heroku rake db:reset and heroku rake db:migrate:redo
hmmm, I had a similar problem for a few days and my answer above resolved this - sorry it hasn't brought you much luck. Another command to consider is 'heroku run rake db:migrate' as opposed to omitting the 'run' in your command. I will pop back again tomorrow when I am in the office and try to shed some light further if you are still stuck.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.