I am trying to deploy an updated version of a rails app to a droplet on DigitalOcean using mina
When I run mina deploy
I get the error Missing encryption key to decrypt file with. Ask your team for your master key and write it to /home/my_rails_project/app/tmp/build-153920174210305/config/master.key or put it in the ENV['RAILS_MASTER_KEY']
.
I was expecting this error as I haven't yet worked out how to add the details to the server.
A number of articles suggest there are two means of doing this:
Option 1: Place the
config/master.key
file in the server. You’ll normally want to symlink this file to a shared folder in the server filesystem. Again, do not version yourconfig/master.key
file.Option 2: create a
RAILS_MASTER_KEY ENV
variable. Rails will detect it and use it as your master key, e.g. in heroku:heroku config:set RAILS_MASTER_KEY= < your-master-key-here >
.
I have tried option 1 using FileZilla, however, I am unable to access the folder which is where the article suggests the file should be stored /home/deploy/my-rails-project/shared/config/master.key
-> Error: Directory /home/my-rails-project/app/shared/config: permission denied
. I am also unable to see the master.key
file on my local computer through FileZilla. Similarly, if I use the console on Digital Ocean I get the permission denied
error
Please could you advise me how to move master.key
to the production server
Thanks in advance for your help
export RAILS_MASTER_KEY="xxx"
on.bashrc
– Lief