Database.yml is not being generated by application cookbook

I’m using the application cookbook for a rails application and it is not
properly generating the database.yml file.

It downloads the application from git, installs it in the right directory,
but without database.yml

Does anybody know what could it be?

Here is my app databag file (note that I’m using an environment called
’integration’ to test it)

{
“group”: “ubuntu”,
“server_roles”: [“my_app”],
“repository”: “GIT_URL”,
“force”: {
“production”: false
},
“migrate”: {
“production”: true
},
“snapshots_to_keep”: {
“production”: “3”
},
“databases”: {
“integration”: {
“reconnect”: “true”,
“encoding”: “iso-8859-1”,
“adapter”: “mysql2”,
“username”: “USERNAME”,
“database”: “DATABASE”,
“host”: “HOST”,
“password”: “PASSWORD”
},
“production”: {
“reconnect”: “true”,
“encoding”: “iso-8859-1”,
“adapter”: “mysql2”,
“username”: “USERNAME”,
“database”: “DATABASE”,
“host”: “HOST”,
“password”: “PASSWORD”
}
},
“packages”: {
“git”: “”,
“libmysqlclient-dev”: “”
},
“memcached”: {},
“id”: “my_app”,
“type”: {
“my_app”: [“rails”, “unicorn”]
},
“revision”: {
“integration”: “master”,
“production”: “production”
},
“gems”: {
“bundler”: “1.0.21”
},
“deploy_key”: “”,
“deploy_to”: “/var/apps/my_app”,
“owner”: “ubuntu”
}

Thanks

Daniel Cukier
Software Artist

Any idea about this issue?

On Wed, Apr 25, 2012 at 5:44 PM, Daniel Cukier danicuki@gmail.com wrote:

I'm using the application cookbook for a rails application and it is not
properly generating the database.yml file.

It downloads the application from git, installs it in the right directory,
but without database.yml

Does anybody know what could it be?

Here is my app databag file (note that I'm using an environment called
'integration' to test it)

{
"group": "ubuntu",
"server_roles": ["my_app"],
"repository": "GIT_URL",
"force": {
"production": false
},
"migrate": {
"production": true
},
"snapshots_to_keep": {
"production": "3"
},
"databases": {
"integration": {
"reconnect": "true",
"encoding": "iso-8859-1",
"adapter": "mysql2",
"username": "USERNAME",
"database": "DATABASE",
"host": "HOST",
"password": "PASSWORD"
},
"production": {
"reconnect": "true",
"encoding": "iso-8859-1",
"adapter": "mysql2",
"username": "USERNAME",
"database": "DATABASE",
"host": "HOST",
"password": "PASSWORD"
}
},
"packages": {
"git": "",
"libmysqlclient-dev": ""
},
"memcached": {},
"id": "my_app",
"type": {
"my_app": ["rails", "unicorn"]
},
"revision": {
"integration": "master",
"production": "production"
},
"gems": {
"bundler": "1.0.21"
},
"deploy_key": "",
"deploy_to": "/var/apps/my_app",
"owner": "ubuntu"
}

Thanks

Daniel Cukier
Software Artist

--
Daniel Cukier
Software Artist
+55 11 9991-3913

Hi guys,

Sorry for insisting, but I really need someone in this list who could
help me with this issue...

Anyone?

Regards

Daniel

On 25/04/2012, at 17:44, Daniel Cukier danicuki@gmail.com wrote:

I'm using the application cookbook for a rails application and it is not properly generating the database.yml file.

It downloads the application from git, installs it in the right directory, but without database.yml

Does anybody know what could it be?

Here is my app databag file (note that I'm using an environment called 'integration' to test it)

{
"group": "ubuntu",
"server_roles": ["my_app"],
"repository": "GIT_URL",
"force": {
"production": false
},
"migrate": {
"production": true
},
"snapshots_to_keep": {
"production": "3"
},
"databases": {
"integration": {
"reconnect": "true",
"encoding": "iso-8859-1",
"adapter": "mysql2",
"username": "USERNAME",
"database": "DATABASE",
"host": "HOST",
"password": "PASSWORD"
},
"production": {
"reconnect": "true",
"encoding": "iso-8859-1",
"adapter": "mysql2",
"username": "USERNAME",
"database": "DATABASE",
"host": "HOST",
"password": "PASSWORD"
}
},
"packages": {
"git": "",
"libmysqlclient-dev": ""
},
"memcached": {},
"id": "my_app",
"type": {
"my_app": ["rails", "unicorn"]
},
"revision": {
"integration": "master",
"production": "production"
},
"gems": {
"bundler": "1.0.21"
},
"deploy_key": "",
"deploy_to": "/var/apps/my_app",
"owner": "ubuntu"
}

Thanks

Daniel Cukier
Software Artist

Hey Daniel,

So, first of all Im pretty sure that application::rails is being deprecated judging by the warning at the top of the recipe. So you may want to change over to what it mentions in the read me. That aside I think the problem is that your missing "database_master_role" from your data bag. which lets the search find what node is the db master.

Look at this: https://github.com/opscode-cookbooks/application/blob/master/recipes/rails.rb#L105-120

So basically if dbm is not set on line 120 it does NOT write out database.yml. Assign database_master_role as stated here: https://github.com/opscode-cookbooks/application/blob/master/examples/data_bags/apps/rails_app.json#L22-24 or modify the cookbook so it doesn't do that and takes it from the data bag directly or something like that.

I don't use that cookbook so I can't give you exact details, but I'm assuming thats what is going on. If that doesn't solve the problem then send more info to the list, the run_list of the node and a gist of chef-client -l debug.

Thanks,
Josh Pasqualetto

On May 12, 2012, at 2:19 PM, Daniel Cukier wrote:

Hi guys,

Sorry for insisting, but I really need someone in this list who could
help me with this issue...

Anyone?

Regards

Daniel

On 25/04/2012, at 17:44, Daniel Cukier danicuki@gmail.com wrote:

I'm using the application cookbook for a rails application and it is not properly generating the database.yml file.

It downloads the application from git, installs it in the right directory, but without database.yml

Does anybody know what could it be?

Here is my app databag file (note that I'm using an environment called 'integration' to test it)

{
"group": "ubuntu",
"server_roles": ["my_app"],
"repository": "GIT_URL",
"force": {
"production": false
},
"migrate": {
"production": true
},
"snapshots_to_keep": {
"production": "3"
},
"databases": {
"integration": {
"reconnect": "true",
"encoding": "iso-8859-1",
"adapter": "mysql2",
"username": "USERNAME",
"database": "DATABASE",
"host": "HOST",
"password": "PASSWORD"
},
"production": {
"reconnect": "true",
"encoding": "iso-8859-1",
"adapter": "mysql2",
"username": "USERNAME",
"database": "DATABASE",
"host": "HOST",
"password": "PASSWORD"
}
},
"packages": {
"git": "",
"libmysqlclient-dev": ""
},
"memcached": {},
"id": "my_app",
"type": {
"my_app": ["rails", "unicorn"]
},
"revision": {
"integration": "master",
"production": "production"
},
"gems": {
"bundler": "1.0.21"
},
"deploy_key": "",
"deploy_to": "/var/apps/my_app",
"owner": "ubuntu"
}

Thanks

Daniel Cukier
Software Artist