mina-deploy / mina

Blazing fast deployer and server automation tool
https://rubygems.org/gems/mina
Other
4.36k stars 492 forks source link

master.key #712

Open rubydesign opened 2 years ago

rubydesign commented 2 years ago

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

dillonhafer commented 2 years ago

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.

rubydesign commented 2 years ago

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.

Frexuz commented 2 years ago

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? 🤔

dillonhafer commented 2 years ago

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.

elik-ru commented 1 year ago

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