Some notes about Ruby on Rail app deployment on Heroku

31 Dec 2011

If you get an error when you do database migration, during the deployment process:

1
2
3
4
$ heroku rake db:migrate
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.)Tasks: TOP => db:migrate => db:load_config
(See full trace by running task with --trace)

Add PostgreSQL gem, replace the line gem ‘sqlite3’ with:

1
2
3
4
5
6
group :development, :test do
  gem 'sqlite3'
end
group :production do
  gem 'pg'
end

This ensures the production using PostgreSQL, since Heroku does not support sqlite3.

If after success deployed the rail app, the application gives an error page like: “We’re sorry, but something went wrong…” This is actually a generic error message. It might be caused by the assets loading problem. I did forget to compile the assets before deploy the app.

Run the following command before deployment to compile the assets to public/ directory

</del>

1
<del>bundle exec rake assets:precompile</del>

Then do the deployment again:

1
git push heroku master

Liy at 00:00