Recipes for capistrano
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/quapistrano
spec
.document
.gitignore
.rspec
Gemfile
Gemfile.lock
LICENSE.txt
README.rdoc
Rakefile
VERSION
quapistrano.gemspec

README.rdoc

Quapistrano

A 'Work in Progress' gem with several recipes for capistrano, using a clean approach, delegating dawting tasks to provisioners. For now, it features mysql workflow management with backup support, unicorn start/stop restart/reload and shared assets' synchronization.

Recipes

db

Manage DB tasks. Currently supports mysql only. It has the following tasks:

  • (local|remote):backup - creates a local/remote snapshot of the current database state

  • (local|remote):cleanup - cleans up local/remote backup leaving up to a specified number of backups (db_backup_count)

  • (local|remote):restore - restores the local/remote database to the latest backup found in the backup directory (db_backup_dir)

  • (local|remote):setup - creates the backup folder in the given directory (db_backup_dir for remote and db_backup_local_dir for local)

  • (local|remote):sync - syncs the local/remote database with its counterpart (cap local:sync syncs local database with the remote's state)

  • remote:download - downloads the current remote database state (also creates a backup)

  • remote:upload - uploads the latest local backup (does not create a backup of either of the databses)

  • remote:create_database - creates the database in the remote (used after deploy:setup)

The db recipe also adds hooks to deploy:setup, deploy:cleanup (with the corresponding local/remote tasks) and runs remote:backup before deploy:migrate.

unicorn

Manages Unicorn in-production workflow. Supports the following tasks:

  • unicorn:setup - creates a folder to place the socket files (to be used in deploy:setup, can be changed through unicorn_socket)

  • unicorn:start - starts unicorn in daemon mode. It uses bundler if the bundler recipe is included - i.e. bundler exec unicorn_rails ... (uses unicorn_bin and unicorn_config)

  • unicorn:stop - stops the unicorn daemon by reading the pid file (uses pids_path)

  • unicorn:reload - reloads unicorn configuration (usually done after deploy:upload)

  • unicorn:restart - restarts unicorn daemon, using the current release (after deploy:update)

  • unicorn:status - lists unicorn's running processes

The unicorn recipe links deploy:restart to unicorn:restart and runs unicorn:setup after deploy:setup

shared

Manages shared paths. Paths are given in Hash form (i.e. { 'uploads' => 'public/uploads' }) through the variable shared_folders, in which the key is the shared folder path (www/shared/uploads) and the value is the symlink path (current/public/uploads). Supports:

  • shared:local:sync - Syncs local folders with remote ones

  • shared:remote:setup - Creates the folders

  • shared:remote:symlink - Creates the symlinks

  • shared:remote:sync - Syncs the remote folders with the local ones

The shared recipe adds a deploy:setup hook and runs shared:remote:symlink after deploy:update

TODO

  • Make tests

  • Update README with usage instructions

  • More recipes (ssh, bluepill, etc)

Contributing to Quapistrano

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.

  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright © 2012 Tiago Melo. See LICENSE.txt for further details.