Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
83 lines (50 sloc) 3.06 KB

Capistrano Taffy (Database, SSH recipes)

Capistrano recipes for deploying databases and other common tasks (managing database.yml, importing/exporting/transfering databases, SSH authorization etc.)


  • Adds database transfer recipes (via Taps)
  • Authorize SSH access
  • Manage database.yml (Soon.)

Taps is great, but having to SSH into my deployment to run the Taps server, as well as figure out the proper local/remote database urls, is a pain. I knew the Heroku gem had it figured out; I present the Capistrano friendly version.

If you are new to Taps, check out this introduction to Taps by Adam Wiggins.


gem install cap-taffy

Database Transfer

Dependency: The Taps gem is required on any server(s) you'll be transferring databases to (:app role) including your development machine (where you'll be running cap tasks from). Run:

gem install taps

Dependency: The Heroku gem is required on your development machine.

gem install heroku


To start, add the following to your Capfile

require 'cap-taffy/db'

Taffy will start a Taps server on port 5000 by default, so make sure port 5000 (or w/e port you end up using) is open on your :app server(s)

Then you can use:

cap db:push         # Or to specify a different port: cap db:push -s taps_port=4321
cap db:pull         # Or to specify a different port: cap db:pull -s taps_port=4321

SSH Local Forwarding

Some of you may not be able/want to open up ports on your servers. Instead, you can run:

ssh -N -L[port]:[port] [user]@[remote-server]

And then run:

cap db:push -s taps_port=[port] -s local=true

Substituing the appropriate values for [port], [user], and [remote-server].

Sample Usage

ssh -N -L4321: henry@load-test
cap db:push -s taps_port=4321 -s local=true

SSH Access


Add the following to your Capfile

require 'cap-taffy/ssh'

Using a public key generated from ssh-keygen (e.g. ssh-keygen -t rsa), to authorize access:

cap ssh:authorize       # authorizes local public key for SSH access to remote server(s)

Managing database.yml

Much needed and coming soon.


Thanks to developers of the Taps gem and the Heroku gem. And of course, Capistrano, awesome!

Jump to Line
Something went wrong with that request. Please try again.