mina icon indicating copy to clipboard operation
mina copied to clipboard

master.key

Open rubydesign opened this issue 3 years ago • 5 comments

Hi, and mainly thanks. Banged my head against a wall with capistrano ssh for hours and got mina up in minutes. Great job

But then it did take me a while to figure out the missing master.key The docs don't mention this (oh i'm deploying rails v7 ) and i assumed mina/rails would have done this. (only got the hint when the auto generated deploy still talks about secrets. No more secrets :-) )

I could try and fix this, maybe a copy in the setup would be smooth. But at least a mention in the readme?

Thanks for the work guys, Torsten

rubydesign avatar Mar 30 '22 21:03 rubydesign

You can set an env var of RAILS_MASTER_KEY=yoursecret or put the master.key in your shared files directive:

set :shared_files, fetch(:shared_files, []).concat(%w(
  config/master.key
))

I would probably just suggest you put the value RAILS_MASTER_KEY along side your other environment variables.

dillonhafer avatar Apr 04 '22 15:04 dillonhafer

Maybe i was unclear: I do have my deploy working. (and i don't use environemt since it can be avoided)

The suggestion was mainly to update the rails part / documentation. But if you are beyond maintenance i understand, just close this.

rubydesign avatar Apr 04 '22 15:04 rubydesign

Issue here with the shared files:

set :shared_files, fetch(:shared_files, []).concat(
  ['config/credentials/staging.key', 'config/credentials/production.key']
)

Then i run

❯ bundle exec mina setup to=staging

-----> Using [Staging]
-----> Setting up /var/www/travclub.com/staging
       /home/deployer
       total 24
       drwxrwxr-x 6 deployer deployer 4096 Aug 24 15:23 .
       drwxrwxr-x 4 deployer deployer 4096 Aug 24 12:42 ..
       drwxrwxr-x 2 deployer deployer 4096 Aug 24 12:42 releases
       drwxrwxr-x 7 deployer deployer 4096 Aug 24 14:08 scm
       drwxrwxr-x 9 deployer deployer 4096 Aug 24 12:43 shared
       drwxrwxr-x 2 deployer deployer 4096 Aug 24 15:23 tmp
       Connection to 167.235.224.232 closed.

       Elapsed time: 3.35 seconds

But the key files are not there:

deployer@travclub:/var/www/travclub.com/staging/shared/config/credentials$ ls -la
total 8
drwxrwxr-x 2 deployer deployer 4096 Aug 24 12:42 .
drwxrwxr-x 3 deployer deployer 4096 Aug 24 12:43 ..
deployer@travclub:/var/www/travclub.com/staging/shared/config/credentials$

Mina v1.2.4

Anything I'm missing? 🤔

Frexuz avatar Aug 24 '22 15:08 Frexuz

You are responsible for uploading your key files to /var/www/travclub.com/staging/shared/config/credentials

Mina will simply symlink the files in the shared folder into the current release.

dillonhafer avatar Aug 24 '22 20:08 dillonhafer

Checkout this plugin for managing secret keys: https://github.com/railsblueprint/mina-secrets-transfer

elik-ru avatar Apr 21 '23 16:04 elik-ru