capistrano / symfony

Capistrano tasks for deploying the Symfony standard edition
MIT License
353 stars 65 forks source link

Permission issue using ACL #65

Open yellowmamba opened 8 years ago

yellowmamba commented 8 years ago

Hi there,

I use ACL to set permissions on certain directories upon deployment. Here's the part of deploy.rb:

set :linked_files, ['app/config/parameters.yml']
set :linked_dirs, ["app/logs", "web/uploads"]

set :permission_method, :acl
set :file_permissions_paths, ["app/logs", "app/cache", "web/uploads"]
set :file_permissions_users, ["www-data"]

before "deploy:updated", "deploy:set_permissions:acl"

So this works on the first deployment, when you set up your directories where nothing has been created inside them yet. However, after some time, say you uploaded an image to the web/uploads directory, the file would be under the www-data user, while the directory is still owned by the deploy user. So when you deploy code again, capistrano will fail because it attempts to run acl on a directory that contains files owned by www-data.

How can I work around this?

wasbaiti commented 8 years ago

Hello, I have exactly the same problem. I tried using chmod, works fine first time, but capistrano can not delete old releases because cache directory contains files owned by www-data.

Really appreciate if someone can help with that.

yellowmamba commented 8 years ago

@wasbaiti I don't have this issue on deleting old releases due to the cache folder. Did you set up permissions correctly? http://symfony.com/doc/current/setup/file_permissions.html. Note you need to give permissions to both web server user and your whoami user for cache and/or log folder.

wasbaiti commented 8 years ago

@yellowmamba : I did set up permissions for my first release, capistrano did delete this release, bun fail to do same thing on other releases. to work around the problem, I add a task that executes commands explained in the documentation and now it works fine. I noticed that the difference is in the command options. That of Capistrano, used -n and without this option it works