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
- Authorize SSH access
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
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
Tapsgem is required on any server(s) you'll be transferring databases to (
:approle) including your development machine (where you'll be running
captasks from). Run:
gem install taps
Herokugem is required on your development machine.
gem install heroku
To start, add the following to your
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
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]:127.0.0.1:[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].
ssh -N -L4321:127.0.0.1:4321 henry@load-test cap db:push -s taps_port=4321 -s local=true
Add the following to your
Using a public key generated from
ssh-keygen -t rsa), to authorize access:
cap ssh:authorize # authorizes local public key for SSH access to remote server(s)
Much needed and coming soon.
Thanks to developers of the
Taps gem and the
Heroku gem. And of course, Capistrano, awesome!