0

I am having problems deploying a rails 3.2 app with heroku, I am getting the above error when I load the app. Here are my logs:

→ heroku logs

2013-07-14T01:15:03+00:00 heroku[slug-compiler]: Slug compilation finished
2013-07-14T01:15:11.541229+00:00 heroku[web.1]: Starting process with command `bundle exec     rails server -p 46418`
2013-07-14T01:15:14.054907+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-07-14T01:15:14.054907+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-07-14T01:15:14.492621+00:00 app[web.1]: => Call with -d to detach
2013-07-14T01:15:14.492621+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2013-07-14T01:15:14.492621+00:00 app[web.1]: => Rails 3.2.13 application starting in production on http://0.0.0.0:46418
2013-07-14T01:15:14.492621+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-07-14T01:15:14.492621+00:00 app[web.1]: => Booting WEBrick
2013-07-14T01:15:15.901411+00:00 app[web.1]: [2013-07-14 01:15:15] INFO  ruby 2.0.0 (2013-06-27) [x86_64-linux]
2013-07-14T01:15:15.901411+00:00 app[web.1]: [2013-07-14 01:15:15] INFO  WEBrick 1.3.1
2013-07-14T01:15:15.901769+00:00 app[web.1]: [2013-07-14 01:15:15] INFO  WEBrick::HTTPServer#start: pid=2 port=46418
2013-07-14T01:15:16.447320+00:00 heroku[web.1]: State changed from starting to up
2013-07-14T01:15:17.584921+00:00 app[web.1]: Started GET "/" for 71.202.122.134 at 2013-07-14 01:15:17 +0000
2013-07-14T01:15:17.646525+00:00 app[web.1]: Processing by HomeController#index as HTML
2013-07-14T01:15:17.722541+00:00 app[web.1]: Completed 500 Internal Server Error in 76ms
2013-07-14T01:15:17.724418+00:00 app[web.1]:                                         ^
2013-07-14T01:15:17.724418+00:00 app[web.1]: :             SELECT a.attname, format_type(a.atttypid, a.atttypmod),
2013-07-14T01:15:17.724418+00:00 app[web.1]: 
2013-07-14T01:15:17.724418+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR:  relation "houses" does not exist
2013-07-14T01:15:17.724588+00:00 app[web.1]: ):
2013-07-14T01:15:17.724588+00:00 app[web.1]: 
2013-07-14T01:15:17.726539+00:00 heroku[router]: at=info method=GET path=/ host=frozen-spire-1369.herokuapp.com fwd="71.202.122.134" dyno=web.1 connect=1ms service=149ms status=500 bytes=643
2013-07-14T01:15:17.724588+00:00 app[web.1]:   app/controllers/home_controller.rb:3:in `index'
2013-07-14T01:15:17.724418+00:00 app[web.1]: LINE 5:              WHERE a.attrelid = '"houses"'::regclass
2013-07-14T01:15:17.724418+00:00 app[web.1]:                AND a.attnum > 0 AND NOT a.attisdropped
2013-07-14T01:15:17.724418+00:00 app[web.1]:               FROM pg_attribute a LEFT JOIN pg_attrdef d
2013-07-14T01:15:17.724418+00:00 app[web.1]:                      pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
2013-07-14T01:15:17.724588+00:00 app[web.1]:              ORDER BY a.attnum
2013-07-14T01:15:17.724418+00:00 app[web.1]:                 ON a.attrelid = d.adrelid AND a.attnum = d.adnum
2013-07-14T01:15:17.724418+00:00 app[web.1]:              WHERE a.attrelid = '"houses"'::regclass
2013-07-14T01:15:17.724588+00:00 app[web.1]: 
2013-07-14T01:15:18.221829+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=frozen-spire-1369.herokuapp.com fwd="71.202.122.134" dyno=web.1 connect=9ms service=17ms status=200 bytes=0
2013-07-14T01:20:10.025198+00:00 app[web.1]: Started GET "/" for 71.202.122.134 at 2013-07-14 01:20:10 +0000
2013-07-14T01:20:10.048127+00:00 heroku[router]: at=info method=GET path=/ host=frozen-spire-1369.herokuapp.com fwd="71.202.122.134" dyno=web.1 connect=2ms service=24ms status=500 bytes=643
2013-07-14T01:20:10.035374+00:00 app[web.1]: Processing by HomeController#index as HTML
2013-07-14T01:20:10.038857+00:00 app[web.1]: Completed 500 Internal Server Error in 3ms
2013-07-14T01:20:10.040758+00:00 app[web.1]: 
2013-07-14T01:20:10.040758+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR:  relation "houses" does not exist
2013-07-14T01:20:10.040758+00:00 app[web.1]: LINE 5:              WHERE a.attrelid = '"houses"'::regclass
2013-07-14T01:20:10.040758+00:00 app[web.1]:                                         ^
2013-07-14T01:20:10.040758+00:00 app[web.1]:                      pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
2013-07-14T01:20:10.040758+00:00 app[web.1]:               FROM pg_attribute a LEFT JOIN pg_attrdef d
2013-07-14T01:20:10.040758+00:00 app[web.1]:                 ON a.attrelid = d.adrelid AND a.attnum = d.adnum
2013-07-14T01:20:10.040758+00:00 app[web.1]:              WHERE a.attrelid = '"houses"'::regclass
2013-07-14T01:20:10.040758+00:00 app[web.1]:                AND a.attnum > 0 AND NOT a.attisdropped
2013-07-14T01:20:10.040927+00:00 app[web.1]:              ORDER BY a.attnum
2013-07-14T01:20:10.040927+00:00 app[web.1]: ):
2013-07-14T01:20:10.040927+00:00 app[web.1]: 
2013-07-14T01:20:10.040927+00:00 app[web.1]: 
2013-07-14T01:20:10.040927+00:00 app[web.1]:   app/controllers/home_controller.rb:3:in `index'
2013-07-14T01:20:10.040758+00:00 app[web.1]: :             SELECT a.attname, format_type(a.atttypid, a.atttypmod),
2013-07-14T01:20:10.388132+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=frozen-spire-1369.herokuapp.com fwd="71.202.122.134" dyno=web.1 connect=3ms service=12ms status=304 bytes=0

I am fairly new to rails/heroku, so any help is much appreciated. I am trying to deploy after alot of development. For the future, is it better to push to heroku early in the development process and then keep pushing as you go? Thanks!

user2136807
  • 251
  • 1
  • 3
  • 12
  • `ActiveRecord::StatementInvalid (PG::Error: ERROR: relation "houses" does not exist` - I would say the houses table in database is missing. – rmagnum2002 Jul 14 '13 at 01:39
  • do i have to migrate the db to the heroku server? if so how do i do this? – user2136807 Jul 14 '13 at 01:43
  • using heroku toolbelt, `heroku run rake db:create --app my_app2` `heroku run rake db:migrate --app my_app2`. I am not much of an expert in heroku, just used it a few timed so I can't tell you much about it – rmagnum2002 Jul 14 '13 at 01:46
  • with a normal deploy the migrations will run automatically so you don't have to run them by yourself. – rmagnum2002 Jul 14 '13 at 01:54
  • That is what i thought... – user2136807 Jul 14 '13 at 01:58
  • possible duplicate of [Converting existing rails app to postres from sqlite](http://stackoverflow.com/questions/17643326/converting-existing-rails-app-to-postres-from-sqlite) – Mike Szyndel Jul 14 '13 at 21:04

1 Answers1

0
  1. ActiveRecord::StatementInvalid (PG::Error: ERROR: relation "houses" does not exist.

    I would say the houses table in database is missing, you can run migrations using heroku toolbelt: heroku run rake db:create --app my_app2 - to create the database, heroku run rake db:migrate --app my_app2 - to run migrations. Setting up a deploy with Capistrano will run all the things for you with one command.

    Heroku Toolbelt - https://toolbelt.heroku.com/

    Capistrano - https://github.com/capistrano/capistrano

  2. For the future, is it better to push to heroku early in the development process and then keep pushing as you go?

    At the project I am currently working with our team, we have 2 instances of heroku, means 2 apps, one is for production, the second for testing, changes are pushed to testing app first and if all goes well we move it to production.

Edit

As I found out your are using sqlite for development:

Heroku uses postgresql. https://devcenter.heroku.com/articles/sqlite3

Remove sqlite3 or move it into a development group in your Gemfile like this:

group :development do
  gem 'sqlite3'
end

group :production do
  gem 'thin'
  gem 'pg'
end

remove Gemfile.lock run bundle install --without production

git add .
git commit -am "bundle updating sqlite3"
git push heroku master

or easier, just use PG on your local computer for development. You might have some sql statements that will work in sqlite and will not work in postgres on heroku, so in your place I would use PG on development.

rmagnum2002
  • 11,341
  • 8
  • 49
  • 86
  • when running `heroku run rake db:create --app my_app2` I get the following error: `No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)`. Going into the heroku console, it seems like none of my tables exist. Could it be a problem that I developed the app using sqlite and heroku uses postgre for deployment? – user2136807 Jul 14 '13 at 09:13
  • sure it is, heroku runs on PG. https://devcenter.heroku.com/articles/sqlite3 didn't know your app is on sql – rmagnum2002 Jul 14 '13 at 09:21
  • it's a common thing here to accept answer if it helped you. If not, tell me and I'll remove my answer so other do not get confused. – rmagnum2002 Jul 14 '13 at 20:20
  • Sorry, Im pretty new to SO, I did not know about accepting answers. This was helpful! I am not trying to convert to PG for development which In hind sight would have been a good idea from the get go... – user2136807 Jul 14 '13 at 20:34
  • Do you have your app on github? Post the link to it and I'll take a look at your migrations, will try to fix them – rmagnum2002 Jul 14 '13 at 20:53
  • [github](https://github.com/zyskowsk/90Castro) I deleted some old migrations that were dropping unwanted columns and tables, and that fixed the migration issue, now I am having trouble with associations between my models, I posted a question about it here: [new question](http://stackoverflow.com/questions/17643701/many-to-one-association-converting-to-postres) – user2136807 Jul 14 '13 at 21:00
  • Do you have any important data to keep? Or it's a plain new app? – rmagnum2002 Jul 14 '13 at 21:15
  • It is an app I have been working on for a week or so, functionality works, the data is not important, only exists for testing – user2136807 Jul 14 '13 at 21:20
  • See the answer at your relation question that you posted above. – rmagnum2002 Jul 14 '13 at 21:22