Ruby on Rails Monday, June 10, 2019



On Jun 10, 2019, at 12:25 AM, Ariel Juodziukynas <arieljuod@gmail.com> wrote:

Rails 6 will have this feature https://github.com/rails/rails/pull/33521

For Rails 5.2, personally, I wouldn't add the file to the source control. I would do this steps:

1- run rails credentials:edit locally
2- add the credentials for production and save
3- upload the file to your hosting at /home/user/your_app/shared/config/


You  mean, you don't even check-in the encrypted file?


4- configure capistrano to symlink that file on each deploy (at config/deploy.rb)

set :linked_files, fetch(:linked_files, [])+%W{config/credentials.yml.enc}

Now, on each deploy, capistrano runs a task that adds some symlink to the current release pointing to /shared so they are kept between releases. Your file /home/user/your_app/current/config/credentials.yml.enc will actually be a symlink to /home/user/your_app/shared/config/credentials.yml.enc. You can just have that on production, use one on development and add it to the .gitignore file so it doesn't conflict with the symlink.



I think this is interesting but sort of paradigmatically different as I am working with 12-Factor deploys (Heroku), so there isn't a symlink paradigm in these cases. 

nonetheless, thanks for the input.


-Jason



No comments:

Post a Comment