Capistrano is not deleting the old releases. The deploy user (“deploy”) is a member of the group that owns the directories (“www”) and I have confirmed that the group owns and has write access to the entire releases tree.
This is the last part of the error output:
Tasks: TOP => deploy:cleanup
(See full trace by running task with --trace)
The deploy has failed with an error: #<SSHKit::Runner::ExecuteError: Exception while executing on host
[host fqdn]: rm exit status: 1
rm stdout: Nothing written
rm stderr: Nothing written
Can you try running that again with log level as debug? Usually Capistrano outsides the full command it’s running. The #1 rule to Cap debugging is to SSH onto your server and manually run the entire cmd and see what the output is.
The problem seems to be with the W3 Total Cache plugin. The config/master.php file is created by the plugin and thus has the www-data:www ownership. I put the config folder path into the gitignore file to keep it in the deploy files. I checked the permissions after the latest deploy and the config directory is now owned by deploy:www so I should be able to rm -rf it when the cleanup runs again.