Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy heroku app with secret yaml configuration file without committing the file?

In other rails projects, I'd have a local database.yml and in source code repository only commit the database.sample file. When deploying, a capistrano script that would symlink a shared version of database.yml to all the releases.

When deploying to heroku, git is used and they seem to override database.yml altogether and do something internal.

That's all fine and good for database.yml, but what if I have s3 configurations in config/s3.yml. And I'm putting my project on github so I don't want to commit the s3.yml where everyone can see my credentials. It'd rather commit a sample s3.sample which people will override with their own settings, and keep a local s3.yml file uncommitted in my working directory.

what is the best way to handle this?

like image 948
Homan Avatar asked Oct 26 '11 20:10

Homan


People also ask

How do I push to Heroku without git?

You can use a plugin heroku push that is built by one of the Heroku engineers. You can find it at https://github.com/ddollar/heroku-push.

Are Heroku config vars secure?

Heroku config vars are designed to be safe for storing sensitive information. All config vars are stored in an encrypted form and safely stored. These are only decrypted and loaded when booting your app in a dyno itself.

How do I deploy a private repo on Heroku?

Heroku Buttons for private GitHub repos work the same as public ones (though they will not be listed as a Heroku Element), and adding one is a simple two-step process: Add an app. json file. Add the Heroku Button HTML or MarkDown to the README or doc where you want your button.

What are some ways you can deploy your code to Heroku?

Our first method is not only the most common, but also the simplest: pushing code from a Git repository to a Heroku app. You simply add your Heroku app as a remote to an existing Git repository, then use git push to send your code to Heroku. Heroku then automatically builds your application and creates a new release.


2 Answers

Heroku have some guidance on this -

http://devcenter.heroku.com/articles/config-vars

like image 127
ipr101 Avatar answered Sep 18 '22 05:09

ipr101


An alternative solution is to create a new local-branch where you modify .gitignore so secret-file can be pushed to heroku. DON'T push this branch to your Github repo.

To push non-master branch to heroku, use:

git push heroku secret-branch:master 

More info can be found on:
https://devcenter.heroku.com/articles/multiple-environments#advanced-linking-local-branches-to-remote-apps

Use heroku run bash and then ls to check whether your secret-file have been pushed on to heroku or not

like image 28
rocketspacer Avatar answered Sep 21 '22 05:09

rocketspacer