Capistrano::SimplePermissions
Capistrano task for ensuring specific permissions (including owner and group) on files and folders on deploy.
Installation
Add this line to your application's Gemfile:
gem 'capistrano-simple-permissions'
Then add it to your Capfile
:
require 'capistrano/simple_permissions'
And then:
$ bundle install
Then Either in your server config or general deploy.rb
, you must set the :permissions_folders
variable to an array
of at least one directory; otherwise this gem won't do anything.
How it works
This gem hooks into Capistrano's deploy process by executing several chmod
and chown
commands after the
deploy:log_revision
portion of Capistrano's flow. See
the source for more details.
Options
-
set :permissions_folders, []
- Sets the folders that should be recursively affected by both
chmod
andchown
. A sensible setting to use would beset :permissions_folders, [fetch(:deploy_to)]
in yourdeploy.rb
- Sets the folders that should be recursively affected by both
-
set :chmod_folder_permissions, "775"
- Sets the permissions for folders that
chmod
will affect
- Sets the permissions for folders that
-
set :chmod_file_permissions, "664"
- Sets the permissions for files that
chmod
will affect
- Sets the permissions for files that
-
set :chown_owner, ""
- Sets the owner of the files for
chown
. Note that the command isn't run as root so changing this to anything other than the default of""
might cause errors unless your deploy user has the correct permissions.
- Sets the owner of the files for
-
set :chown_group, "web"
- Sets the group of the files for
chown
.
- Sets the group of the files for
Contributing
Bug reports and pull requests are welcome!
License
The gem is available as open source under the terms of the MIT License.