Skip to content

Conversation

@Paprikas
Copy link

The problem happens when you, for example chown logrotate config files to root. Then permission issue will happen if deploy_user is not root.

The problem happens when you, for example chown logrotate config files to root. Then permission issue will happen if deploy_user is not root.
@TalkingQuickly
Copy link
Owner

Thanks for the PR, the tricky thing is that the smart_template method is used for multiple files and this change would mean that every file ending up being owned by root which isn't the behaviour needed.

Potentially we need another way of indicating that certain files should be chowned to root after upload. I'll have a bit of a play over the weekend and see if I can come up with something. Any suggestions much appreciated!

@Paprikas
Copy link
Author

Paprikas commented Apr 2, 2015

No. It's not chowned after upload.
I mean if your file is ALREADY chowned. So upload! method will fail because of lack of permissions.

Here is what I did previously to chown logrotate config.
After this line:
https://github.com/TalkingQuickly/capistrano-3-rails-template/blob/master/lib/capistrano/tasks/setup_config.cap#L29
I've added this:

sudo :chown, symlink[:chown_source], "#{shared_path}/config/#{symlink[:source]}" if symlink[:chown_source]

Now in config/deploy.rb
I've added needed option

set(:symlinks, [
    {
      source: "nginx.conf",
      link: "/etc/nginx/sites-enabled/{{full_app_name}}.conf"
    },
    {
      source: "log_rotation",
      link: "/etc/logrotate.d/{{full_app_name}}",
      chown_source: "root:root"
    }
])

So I can choose what user I need to be the owner.
Yes, its not the universal method for every uploaded file. But I had problem with logrotate config permissions. So it works perfectly for me.
I get the idea.

@ziazek
Copy link

ziazek commented Sep 9, 2016

Facing the same issue. Trying out this solution.

@ziazek
Copy link

ziazek commented Sep 9, 2016

Still not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants