OpsWorks overriding database.yml / ignoring custom JSON
Asked Answered
L

2

7

When I deploy a Rails app with OpsWorks, a new database.yml gets created in the shared directory. It ignores the existing database.yml (which rightfully shouldn't be in the repo), and I've also tried specifying custom JSON but nothing works. Maybe I have the structure wrong?

{
  "deploy": {
    "my-app-name": {
      "database": {
        "adapter": "mysql2",
        "encoding": "unicode",
        "host": "xxxxxx.rds.amazonaws.com",
        "port": "3306",
        "database": "db-name",
        "pool": "5",
        "username": "username",
        "password": "password"
      }
    }
  }
}
Lampe answered 11/6, 2013 at 16:46 Comment(2)
Just to add, because it took me some time to solve that as well after I got the JSON right. In the RDS console you need to add the security group from Opsworks Rails server to your RDS instance, so that the instance is allowed to connect to RDS. Please see here how to do: docs.aws.amazon.com/AmazonRDS/latest/UserGuide/… You can tryout if you can connect to the RDS instance from the Opsworks intance be ssh to the instance and then telnet to your RDS instance, e.g. telnet Your-RDS-Instance 3306Deuteragonist
when deploying to OpsWorks, are we not supposed to include database.yml with our app? I included it and now am getting dead symlink "Cannot read file" errors from Apache2. Very confused, not sure of where this is documented.Stereoisomer
L
2

Using the short name for the app worked (without hyphens). I was using the full name before. See: https://forums.aws.amazon.com/message.jspa?messageID=444711

Lampe answered 11/6, 2013 at 17:17 Comment(0)
C
4

Look also here:

http://wojtek.ziniewi.cz/2013/06/10/custom-symlinks-in-amazon-opsworks-ror-application/

And always remember to examine your stack-json by logging into console of one of your opsworks servers and typing:

opsworks-agent-cli get_json
Calmative answered 29/8, 2013 at 10:24 Comment(1)
Broken link. As always, it's good practice to copy the text to the answer here in case of that eventuality.Hanhana
L
2

Using the short name for the app worked (without hyphens). I was using the full name before. See: https://forums.aws.amazon.com/message.jspa?messageID=444711

Lampe answered 11/6, 2013 at 17:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.