Chef for setting the database parameters


#1

PLEASE NOTE: I have no experience with Chef. I’ve been going through the
getting started guides, but I have no idea what I’m doing.

I have a Rails app called Bargain Stock Funds
(http://www.bargainstockfunds.com). The source code is at
https://github.com/jhsu802701/bsf .

My Bargain Stock Funds Rails app uses a custom Ruby gem that I created called
bsf_scrape to download, scrape, process, and save data on each stock fund
covered. The data is saved to a PostgreSQL database. As you know, the
database name, username, and password need to be provided when connecting to
the database.

I already have working solutions for providing the database parameters to the
Rails app and Ruby gem. My Ruby gem bsf_scrape provides the database
parameters in the FundDatabase.rb file at


. These database parameter functions are available externally, as you can see
in the lib/bsf_scrape.rb script at
https://github.com/jhsu802701/bsf_scrape/blob/master/lib/bsf_scrape.rb .

My Rails app sets the database parameters in the config/database.yml file by
running the config/update.rb script
(https://github.com/jhsu802701/bsf/blob/master/config/update.rb). This script
is automatically run during the deployment process. And as you can see in the
source code, my Rails app uses the bsf_scrape Ruby gem to set and acquire the
database parameters.

THE BIG QUESTION: How do I go about setting and obtaining the database name,
username, and password through Chef?