ruby-on-railspostgresqlamazon-web-servicesamazon-rdsaws-opsworks

AWS OpsWorks Chef 11 Multiple Databases


I would like to know how to prevent OpsWorks sym-linking database.yml. And instead use the database.yml file included in the Github Ruby on Rails app repository?

If not possible I would like to know what is the JSON syntax for adding a primary and secondary database to a stack.

It works with a single DB

        "database": {
            "host": "...",
            "database": "...",
            "username": "...",
            "password": "...",
            "adapter": "postgresql",
            "port": 5432,
            "pool": 100,
            "encoding": "utf8"
        },

Not Working With Primary and Secondary

  "database": {
    "primary": {
      "host": "...",
      "database": "...",
      "username": "...",
      "password": "...",
      "adapter": "postgresql",
      "port": 5432,
      "pool": 100,
      "encoding": "utf8"
    },
    "secondary": {
      "host": "...",
      "database": "...",
      "username": "...",
      "password": "...",
      "replica": true,
      "adapter": "postgresql",
      "port": 5432,
      "pool": 100,
      "encoding": "utf8"
    }
  }

Thanks in advance


Solution

  • Solution

    Note: Ensure database configuration and repository information are private.

    1. Copy ./config/database.yml to ./config/database.bak.yml

    2. Add the following to config/application.rb

      config.paths["config/database"] = "./config/database.bak.yml"