Use Capistrano to set your production database password

This is a Capistrano recipe I use to configure my production database.yml. Before deploy:setup executes, this recipe will prompt for a database password and save a new database.yml file to the shared directory on your server. After each deploy, the database.yml file will be symlinked from the shared directory. You can reconfigure your database by executing cap db:configure.

Here are the goods. I’m pretty sure I got this from Jeremy Voorhis a while back, and modified it to work with Capistrano 2.

Brandon Dimcheff
Brandon Dimcheff
Chief Architect

Brandon Dimcheff is a software engineer born and raised in Ann Arbor, Michigan. He uses go for his day job, has fallen in love with Kubernetes, is an aspiring functional programming language nerd, and is an advocate of open source.