Like I said in my original post Capistrano Deploy for Shared Hosting with GIT Repository, I would add the ability to rotate log files and backup your database. Also added a couple of niceties while I was at it.
- Updated for Capistrano 2.3
- Added backup of mysql database to local machine
- Added log rotation and backup to local machine
- DRYed things up just a touch (delete_files, delete_directories)
Just run a ‘cap -T’ to see all the new functions.
[sourcecode language=”ruby”]
cap -T
[/sourcecode]
CAP db:backup
‘cap db:backup’ will execute a mysqldump, so obviously, this only works on mysql databases. But you could adapt that to any db fairly easily. It dumps the file and bzips it and then downloads it into a ‘/backups’ directory in your project.