Fork me on GitHub

Automatically set proper permissions

As described by the Symfony2 documentation, you must set the proper permissions for the app/cache and app/logs directories, since they need to be writable by your webserver.

NOTE : This feature is not available for versions prior to 2.1.X


There are 4 parameters to care about when using this task:

NOTE : The :acl method relies on the setfacl command which may not be available by default on your system (i.e. Debian). You’ll need to enable ACL support before using it.

NOTE : The :chmod method uses +a mode which may not be available on your system (i.e. Debian). You’ll need to choose rather :acl or :chown, first one is preferred.

NOTE : The :chown method must only be used if neither :acl nor :chmod can be used on your system. Please note that to use this method you have to set the :use_sudo variable to true!

Here is a basic example of what these parameters might look like in your deploy.rb:

set :writable_dirs,       ["app/cache", "app/logs"]
set :webserver_user,      "www-data"
set :permission_method,   :acl
set :use_set_permissions, true

NOTE : For multistage usage you just have to override these variables on stage specific files if ever needed.

Found a typo? Something is wrong in this documentation? Just fork and edit it !