New Tasks / Recipes
The following recipes are exposed to consumers of capistrano-extensions. You’ll likely want to create custom recipes that group some of these together a la passenger-recipes . Also check out Properties and Code Extensions.
deploy:create_shared_file_column_dirs
Creates shared filecolumn directories and symbolic links to them by
reading the :content_directories property. Note that this task is not invoked by default,
but rather is exposed to you as a helper. To utilize, you’ll want to override
deploy:default and invoke this yourself.
deploy:gem_update
Invokes geminstaller to ensure that the proper gem set is installed on the target server.
Note that this task is not invoked by default, but rather is exposed to you as a helper.
log:pull
Tarballs deployable environment’s rails logfile (identified by
RAILS_ENV environment variable, which defaults to ‘production’) and copies it to the local
filesystem
local:backup_db
Backs up deployable environment’s database (identified by the
RAILS_ENV environment variable, which defaults to ‘production’) and copies it to the local machine
local:restore_db
Untars the backup file downloaded from local:backup_db (specified via the
FROM env
variable, which defaults to RAILS_ENV), and imports (via mysql command line tool) it back into the database
defined in the RAILS_ENV env variable.
ToDo: implement proper rollback: currently, if the mysql import succeeds, but the rm fails,
the database won’t be rolled back. Not sure this is even all that important or necessary, since
it’s a local database that doesn’t demand integrity (in other words, you’re still going to have to
fix it, but it’s not mission critical).
local:backup_content
Downloads a tarball of uploaded content (that lives in public/ directory, as specified by
the :content_directories property) from the production site back to the local filesystem
local:restore_content
Restores the backed up content (env var
FROM specifies which environment was backed up,
defaults to RAILS_ENV) to the local development environment app
local:sync_db
Wrapper for local:backup_db and local:restore_db
$> cap local:sync_db RAILS_ENV=production RESTORE_ENV=development
local:sync_content
Wrapper for local:backup_content and local:restore_content
$> cap local:sync_content RAILS_ENV=production RESTORE_ENV=development
local:sync
Wrapper for local:sync_db and local:sync_content
$> cap local:sync RAILS_ENV=production RESTORE_ENV=development
remote:restore_db
Uploads the backup file downloaded from local:backup_db (specified via the
FROM env variable),
copies it to the remove environment specified by RAILS_ENV, and imports (via mysql command line
tool) it back into the remote database.
remote:sync_db
Backs up target deployable environment’s database (identified by the
FROM environment variable,
which defaults to ‘production’) and restores it to the remote database identified by the TO
environment variable, which defaults to “staging.”
Because multiple capistrano configurations must be loaded, an external executable
(capistrano-extensions-sync_db) is invoked, which independently calls capistrano. See the
executable at $GEM_HOME/capistrano-extensions-0.1.3/bin/capistrano-extensions-sync_db
$> cap remote:sync_db
FROM=production TO=staging
remote:restore_content
Uploads the backup file downloaded from local:backup_content (specified via the
FROM env variable),
copies it to the remote environment specified by RAILS_ENV, and unpacks it into the shared/
directory.
remote:sync_content
Backs up target deployable environment’s shared content (identified by the
FROM environment
variable, which defaults to ‘production’) and restores it to the remote environment identified
by the TO envrionment variable, which defaults to “staging.”
Because multiple capistrano configurations must be loaded, an external executable
(capistrano-extensions-sync_content) is invoked, which independently calls capistrano. See the
executable at $GEM_HOME/capistrano-extensions-0.1.2/bin/capistrano-extensions-sync_content
$> cap remote:sync_content
FROM=production TO=staging
remote:sync
Wrapper fro remote:sync_db and remote:sync_content.
$> cap remote:sync
FROM=production TO=staging