Elastic Beanstalk Deploying Issue - Production Database Is Not Configured

1.6k views Asked by At

I am having issues deploying my Rails API to Elastic Beanstalk. I cannot seem to get rid of the following error: ActiveRecord::AdapterNotSpecified: 'production' database is not configured. Available: ["development", "test"]

Please help me figure this out. I am attaching details below.

/config/database.yml

default: &defaults adapter: postgresql encoding: unicode min_messages: warning pool: 5 timeout: 10000 username: postgres host: localhost production: <<: *defaults adapter: postgresql encoding: unicode database: <%= ENV['RDS_DB_NAME'] %> username: <%= ENV['RDS_USERNAME'] %> password: <%= ENV['RDS_PASSWORD'] %> host: <%= ENV['RDS_HOSTNAME'] %> port: <%= ENV['RDS_PORT'] %> pool: 5

/config/environments/production.rb

config.assets.compile = false

config.assets.initialize_on_precompile = false

EB Logs

[Instance: i-13bf48db] Command failed on instance. Return code: 1 Output: (TRUNCATED)...ib/rails/application.rb:389:in `block in run_tasks_blocks' /home/rof/cache/bundler/ruby/2.1.0/gems/sprockets-rails-2.3.1/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define' Tasks: TOP => environment (See full trace by running task with --trace). Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/11_asset_compilation.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.

and

+++ RUBY_VERSION=2.1.5 +++ export GEM_ROOT=/opt/rubies/ruby-2.1.5/lib/ruby/gems/2.1.0 +++ GEM_ROOT=/opt/rubies/ruby-2.1.5/lib/ruby/gems/2.1.0 ++ (( 0 != 0 )) + cd /var/app/ondeck + su -s /bin/bash -c 'bundle exec /opt/elasticbeanstalk/support/scripts/check-for-rake-task.rb assets:precompile' webapp + '[' false == true ']' + su -s /bin/bash -c 'bundle exec rake assets:precompile' webapp rake aborted! ActiveRecord::AdapterNotSpecified: 'production' database is not configured. Available: ["development", "test"] /home/rof/cache/bundler/ruby/2.1.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/connection_specification.rb:257:in `resolve_symbol_connection'

1

There are 1 answers

0
Katta Naveen Kumar On

If it is not in .gitignore, please give the credentials in your database.yml for the environment that you want to do.