Deployment using capistrano ignores group configuration

In my deploy file, I set the group to www-data:

set :user, "root" set :group, "www-data" 

therefore, when using cap: setup, I expected capistrano to roll folders with root: www-data p>

But all folders and files have root: root.

Any ideas that this issue might come from?

Info: I am using system-wide-rvm.

+6
source share
3 answers

since, as far as I understand, you have to do it manually, which installation use the user to log in to, and not to set the rights to the directory.

I did not find the group settings for capistrano, maybe you used several extensions for this?

What you could do to change this is:

 after "deploy:setup", :setup_group task :setup_group do run "chown -R :#{group} #{deploy_to} && chmod -R g+s #{deploy_to}" end 

But first of all, you should not use root for deployment, as @Julian mentions in a comment. Best practice is to use an individual user for this task and set your group to the desired group, then it will not require the above task and will work automatically.

+8
source

Just banter: no mention of the group in the Capistrano source code. I assume this is a variant of the cult. The: user option is used only for SSH connections.

As for your question, the directories and files created by Capistrano are created with default permissions; they never chown them in any way; if you deploy as root , then they will be owned by root:root .

+2
source

Better than fixing the problem, doesn't have it in the first place:

  • First create another user to deploy with ( as Julien suggests ).
    Let's say we call it deployer .
  • Then use it to connect SSH
    set :user, 'deployer'
  • Finally, we do not want to use sudo , so disable it by adding set :use_sudo, false
    to your deploy.rb .
+2
source

Source: https://habr.com/ru/post/918869/


All Articles