One of my Ruby on Rails apps is Bargain Stock Funds (https://github.com/jhsu802701/bsf), and it relies on a Ruby gem called bsf_scrape (https://github.com/jhsu802701/bsf_scrape) to obtain and process data on stock funds and then save the results in a PostgreSQL database. As you well know, the config/database.yml file needs the database name, the username, and the password. My procedures for handling this work but are clunky and probably not considered to be best practices. From what I've heard, using Chef is the best practice. However, Chef is complicated, and I'm having difficulty making sense of it. In the source code for bsf_scrape (Ruby gem), I have functions in the lib/bsf_scrape.rb file that do the following: 1. Set the database name (stores it in a file) 2. Get the database name (read it from a file) 3. Set the path to the directory containing the username and password (necessary for the production environment, as the database username is different from the server username): Please note that while the database name is the same in the development and production environments, the username and password are different. 4. Get the path to the directory containing the username and password (production environment) 5. Reads the username from a file (production environment) 6. Reads the password from a file (production environment) In the source code for bsf (Rails app), I have procedures that obtain the database parameters during the deployment process. Running the deployment script (config/deploy.rb) involves running the update script (config/update.rb), that provides the database name, database username, and database password and retains these parameters in files for use by the bsf_scrape Ruby gem. I know this process is convoluted, but I can't replace it until I figure out how to do it correctly in Chef. Are there any good Chef tutorials/examples that will help me with this? My needs aren't that complex at the moment, but most of the tutorials/examples I've looked at are.
on 2013-11-01 18:59