mina icon indicating copy to clipboard operation
mina copied to clipboard

Setup task should not be trying to chown or chmod

Open Bilge opened this issue 11 years ago • 7 comments

The setup task should just attempt to create the require directory structure. It is perfectly possible for the deploy user to be able to create the directories but not be permitted to run chmod/chown on them. However, if the user can create the directory structure successfully what is the need for chmod/chown to be run in the first place?

The way these commands are structure is founded on far too many assumptions. Here are the relevant lines from mina/deploy.rb.

      #{echo_cmd %{chown -R `whoami` "#{deploy_to}"}} &&
      #{echo_cmd %{chmod g+rx,u+rwx "#{deploy_to}"}} &&

These commands assume that:

  • The deploy folder and all its subfolders must be owned by the deploying user.
  • The group, which is neither defined nor managed by the setup task, must have read and execute permissions.

These assumptions are deeply flawed and I would argue that folder permissions fall well outside the purview of a deployment tool's responsibility. They should already be configured by a system provisioning tool as part of the system architecture.

For my purposes I had to clear out all of the default setup actions in order to write a sane setup script.

Bilge avatar Feb 26 '15 16:02 Bilge

You can always write your own setup task, name it something else.

The setup as it is works for most of the people but you can write a PR and we can test it out.

d4be4st avatar Mar 01 '15 16:03 d4be4st

I did one better; I wrote my own setup task and named it exactly the same. But I will probably not be writing a PR as I do not have the time for that and you do not seem to share my view on the limits of Mina's responsibility in deployment.

Bilge avatar Mar 01 '15 17:03 Bilge

Cool, thanks. If anyone has the same problem he can contact you

d4be4st avatar Mar 01 '15 17:03 d4be4st

No, he can't. Don't presume to advertise my availability on my behalf.

Bilge avatar Mar 01 '15 17:03 Bilge

sorry to be digging an old and resolved issue, but @Bilge I just had the exact same problem and had you shared your solution to the problem, even if by only pasting it on this issue, would have been great right now

hernandesbsousa avatar Sep 14 '16 12:09 hernandesbsousa

# Clear default Mina actions.
Rake::Task['setup'].clear_actions
task setup: :environment do
  queue! %(mkdir -pv -- '#{deploy_to}')
  queue! %(cd -Pe -- '#{deploy_to}')
  queue! %(mkdir -pv -- '#{releases_path}' '#{shared_path}')
end

Bilge avatar Sep 14 '16 13:09 Bilge

thanks a lot!

hernandesbsousa avatar Sep 14 '16 22:09 hernandesbsousa