0

I'm getting the following error when trying to deploy my rails app with a postgresql database:

ActiveRecord::AdapterNotSpecified: 'production' database is not configured. Available: []

And this is my database.yml file:

development:
  adapter:  postgresql
  encoding: unicode
  host:     localhost
  pool:     20
  database: app_development

test:
  adapter:  postgresql
  encoding: unicode
  host:     localhost
  pool:     20

production:
  adapter:  postgresql
  encoding: unicode
  host:     localhost
  pool:     100
  database: app_production
  username: deploy
  password: 

Any ideas?

Lukasz Szozda
  • 162,964
  • 23
  • 234
  • 275
corneljr
  • 85
  • 8
  • Is your database.yml file making it as far as the server? I.e. it is not git ignored or somesuch? – Shadwell Apr 23 '15 at 14:53
  • You also are missing the `database:` key in your test: stanza – John Paul Ashenfelter Apr 23 '15 at 15:02
  • I'm running into this issue after rebuilding the server..the same codebase was previously running successfully on the server so I don't think the database.yml file is the issue – corneljr Apr 23 '15 at 15:11
  • After taking a quick look through the active record source code, it definitely seems like it's not seeing the database.yml file for some reason – corneljr Apr 23 '15 at 15:16
  • Is the database.yml configured on the server (and linked correctly if its symlinked?) – BvuRVKyUVlViVIc7 Apr 23 '15 at 15:03
  • I'm pretty new to manual deployment...how do I configure it on the server? – corneljr Apr 23 '15 at 15:09
  • 1
    If you deploy via capistrano, you can say that config/database.yml is a shared file (http://stackoverflow.com/questions/19071179/capistrano-how-to-put-files-at-the-shared-folder). On the server then you have to create a database.yml file in the deploy-folder/shared/config/database.yml... – BvuRVKyUVlViVIc7 Apr 23 '15 at 15:15

1 Answers1

1

Ensure your database.yml and secrets.yml are in the right place, that is in your_app_name/shared/config/database.yml, same for secrets.yml.

To check, cd into the folders in your remote server and ls to list their contents.

Your database.yml should be smth like:

    # /home/deploy/my_app_name/shared/config/database.yml
production:
  adapter: postgresql
  host: 127.0.0.1
  database: my_app_name_production
  username: deploy
  password: YOUR_POSTGRES_PASSWORD
  encoding: unicode
  pool: 5
Kaka Ruto
  • 4,581
  • 1
  • 31
  • 39