Search code examples
rvmcapistranochmodrvm-capistrano

Deploying with capistrano does ignore group setting


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

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

so when using cap:setup I expected capistrano to chown the folders with root:www-data

But all folders and files are root:root.

Any ideas where this problem could come from?

Information: I'm Using system-wide-rvm.


Solution

  • as for my understanding you should do it manually, what setup does is to use the user to login, not to set the rights to directory.

    I have found no group setting for capistrano, maybe you were using some extensions for it?

    What you could do to change it could be:

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

    But in first place you should not use root for deployment, as @Julian mentions in comment better practice is to use separate user for this task and set his group to proper group, then it will not require the above task and will work automatically.