Capistrano Tasks I made and use in every project I work on.
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
.gitignore
Gemfile
README.md
Rakefile
capistrano-tasks.gemspec

README.md

Capistrano Tasks

Set of Capistrano opinionated Tasks I made and use in every project I work on.

Assumes you are using MySQL 5 and Apache 2.

Help, corrections, and suggestions are of course welcome.

Included Tasks

Namespace: apache

  • restart: restarts web server, tries to use sudo. :use_sudo is set to true unless it already exists on your deploy.rb file

Namespace: dump

  • create: makes a database dump
  • tidy: moves old database dumps to a folder
  • getall: downloads all database dumps from remote machine to local
  • getlast: downloads latest database dump from remote machine to local

Namespace: log

  • tail: prints the production log from the remote machine.

HOOKS: Upon invoking dump:create, dump:tidy is executed first, and after the creation, dump:getlast.

Symbols

The gem defines and uses the following symbols, which you might want to override:

  • :remote_dumps_folder => "#{shared_path}/db/backups/"
  • :remote_old_dumps_folder => "#{remote_dumps_folder}/old/"
  • :db_name => '#{application}_#{rails_env}/'

This one requires a symbol called target_local in your deploy.rb

  • :local_dumps_folder, "#{target_local}/#{application}/"

How to use

  1. Clone the git repo
  2. build the gem with gem build capistrano-tasks.gemspec
  3. Install the gem gem install path-to-the-project/capistrano-tasks-xxx.gem
  4. Include the line require 'capistrano-tasks' at the end of your deploy.rb file

NOTE: xxx stands for the version number.

Disclaimer

This still needs a lot of work. Use at your own risk.

Todo

  • Refine dump:get* tasks to avoid using scp.
  • Refine dump:getlast to fetch last without having to tidy first.
  • DONE Avoid requirement of environment variables.

Thanks

  • Tulo: for his feedback and suggestions.

License

Released under the MIT License