0
我是全新的AWS,並嘗試在Beanstalk上啓動我的Rails應用程序。我遵循recent tutorial,但我堅持讓我的應用程序連接到RDS。乘客屏幕出現了一個錯誤:Rails和亞馬遜RDS:「生產數據庫沒有配置」
production database is not configured (ActiveRecord::AdapterNotSpecified)
我database.yml
樣子:
production:
adapter: mysql2
encoding: utf8
database: <%= ENV['RDS_DB_NAME'] %>
username: <%= ENV['RDS_USERNAME'] %>
password: <%= ENV['RDS_PASSWORD'] %>
host: <%= ENV['RDS_HOSTNAME'] %>
port: <%= ENV['RDS_PORT'] %>
我確實有配置和運行的RDS實例。我也參加了EC2實例,並驗證了我可以通過RDS_USERNAME,RDS_HOSTNAME等成功連接到RDS。
想到也許我需要在MySQL中手動創建我的數據庫我使用MySQL客戶端來完成那,但我仍然得到相同的錯誤。
所以再次我手動檢查了我的項目,跑bundle exec rake db:migrate --trace
獲得其中它的失敗的更完整的畫面EC2實例:
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
rake aborted!
production database is not configured
/usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:39:in `resolve_string_connection'
/usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:25:in `spec'
/usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:129:in `establish_connection'
/usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/railtie.rb:82:in `block (2 levels) in <class:Railtie>'
/usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
/usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
/usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
/usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:42:in `each'
/usr/share/ruby/1.9/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
/usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/base.rb:721:in `<top (required)>'
/usr/share/ruby/1.9/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/railties/databases.rake:6:in `block (2 levels) in <top (required)>'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:227:in `call'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:227:in `block in execute'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:222:in `each'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:222:in `execute'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/usr/share/ruby/1.9/monitor.rb:211:in `mon_synchronize'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:159:in `invoke_with_call_chain'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:187:in `block in invoke_prerequisites'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:185:in `each'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:185:in `invoke_prerequisites'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:165:in `block in invoke_with_call_chain'
/usr/share/ruby/1.9/monitor.rb:211:in `mon_synchronize'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:159:in `invoke_with_call_chain'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:152:in `invoke'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:141:in `invoke_task'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:99:in `block (2 levels) in top_level'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:99:in `each'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:99:in `block in top_level'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:108:in `run_with_threads'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:93:in `top_level'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:71:in `block in run'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:158:in `standard_exception_handling'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:68:in `run'
/usr/share/ruby/1.9/gems/1.9.1/gems/rake-10.0.2/bin/rake:37:in `<top (required)>'
/usr/bin/rake:23:in `load'
/usr/bin/rake:23:in `<main>'
Tasks: TOP => db:migrate => db:load_config
非常感謝你的提示! –