Capistrano 3, Rails 4.1.0.rc1, database configuration does not specify adapter

I have been deploying my Rails applications successfully using capistrano 2.x for long time now and have been procrastinating moving to new & shiny Capistrano 3.x. Finally, today I set out to convert my long time deploy scripts to Capistrano 3.x I won’t go into the intricacies of the conversion in this post, but I would like to share a strange & somewhat stupid mistake I did and wasted some time in the process. Alright, coming to the point, to help me in the process of moving to Capistrano 3.x, I created a new Rails 4.1.0.rc1 application and ended up with the following error: RAILS_ENV=production bundle exec rake assets:precompile stdout: Nothing written RAILS_ENV=production bundle exec rake assets:precompile stderr: rake aborted! database configuration does not specify adapter I googled around, tweaked a few things as per stackoverflow advice; but it did not go away! I went back to tried & tested formula: “Read the error message carefully” and figured that the error included local path: “/Users/chandreshpant/workspace/…/app/config/environment.rb:5″ and got me to the correct place. In Rails 4.1; the default database.yml template has: production: url: <%= ENV[“DATABASE_URL”] %> And changing it to: production: <<: *default database: app_production Solved the problem for me! At this point you might say that I am deviating from a good practice of keeping the production credentials in environment. But, I do not keep this database.yml in git anyway; its only my local copy! (More on this later.) Some other gotchas:
  1. You might need to enable passwordless sudo to work with Capistrano 3.x
  2. You will need to specify production secret_key_base in the environment.
Let me know if this helps you or you have faced some other issues.
Posted in deploying | Tags: ,

Leave a Reply