How to store secret variables in capistrano

Viewed 806

I am writing a Rails app with automated deployment using Capistrano. In the deploy.rb script I have:

set :deploy_to, '/my/deploy/path/'

And in production.rb I have:

server 'example.com', user: 'secret_user_name', roles: %w{web app db}

Currently the app is private. But assume I wanted an open source app like this. Then I wouldn't want secret_user_name and /my/deploy/path to be stored in the repo. In the Rails project if I encountered an issue like this I would store the secret values in secrets.yml and access them from there. However I don't have access to secrets.yml from Capistrano. So I could manually load the secrets file but I'm sure there is a better way to do this.

So my question is: How can I have an automated deployment process without exposing server information using Capistrano? Is there a recommended way to store secrets like there is in Rails?

3 Answers
Related