Capistrano for remotely manipulating sites and blueprints [07.08.2008]

There's a bunch of existing rake tasks for operating on blueprints and sites -- pushing and pulling data, syncing templates, installing blueprints and sites, erasing blueprints and sites, et cetera.

For the last few months, to perform these operations on remote servers (production or staging), you've had to log into the server as the deploy user, and run the rake task with the correct environment argument.

Now there are Capistrano tasks that allow you to do these things on remote servers from the comfort of your local command-line. Here's the current list of available tasks -- run cap -T for an official list.

cap site:data:pull       
cap site:data:push       
cap site:list            
cap site:retrieve        
cap site:templates:update

cap blueprint:install    
cap blueprint:migrate    
cap blueprint:uninstall  
cap blueprint:upgrade:all

Each cap task takes the same arguments as its rake equivalent. Assuming you have set up your config/hosts.yml file correctly, you can invoke them like this:

$ cap site:data:push domain=foo.org rails_env=staging

The rails_env determines which hosts the action is performed on. To save typing, you might want to set up the following bash aliases:

alias pcap='RAILS_ENV=production cap'
alias scap='RAILS_ENV=staging cap'

Then you can run the same command more succinctly:

$ scap site:data:push domain=foo.org
Only the comment field is required. Omitting the ID fields increases your risk of being mistaken for spam.

Preview or