Search code examples
ruby-on-railsdeploymentherokuproduction

Elementary Rails deployment


I am trying to deploy my app on Rails for the first time using Heroku.

I have spent quite a lot of time but there's a gap somewhere.

Git: created private repo, pushed to git successfully
Heroku: created free app and pushed successfully (but app 'crashes')
Local:

rake db:schema:dump #success
rake db:schema:load RAILS_ENV=production #failure: production database is not configured
rake db:create db:load RAILS_ENV=production #failure: undefined method '[]' for nil:NilClass
  active_record/railties/databases.rake:59:in 'rescue in create_database'
  active_record/railties/databases.rake:39:in 'create_database'

My database.yml file:

defaults: &defaults
adapter: mysql
username: root
password: password
host: localhost

development:
<<: *defaults
database: project_dev

test:
<<: *defaults
database: project_test


Just added:
production: <<: *defaults database: project_production

I may be making a total rookie mistake. Do you know where I might be going wrong?


Solution

  • Use the command heroku rake db:schema:load, which simply executes the command rake db:schema:load on Heroku's environment.

    You do not need to worry about the database environments are they are automatically configured by Heroku on the compilation of the slug.