Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

158 lines (157 sloc) 7.202 kb
capistrano: "\n\
This work is licensed under the Creative Commons\n\
Attribution-NonCommercial-NoDerivs 2.0 License. To\n\
view a copy of this license, visit\n\\n\n\n\
########## Shell Commands ##########\t\n\
$ gem install capistrano\n\n\
Add your application to Capistrano (capify):\n\
$ capify .\n\n\
# NOTE: Rake access to capistrano is deprecated in Capistrano 1.3.\n\
# Use the 'cap' command instead.\n\n\
Execute the setup task:\n\
$ cap deploy:setup\n\n\
Deploy your application:\n\
$ cap deploy\n\n\
Similar to deploy, but it runs the migrate task on the new release before\n\
updating the symlink:\n\
$ cap deploy:migrations\n\n\
Rollback a release from production:\n\
$ rake rollback\n\n\
Deploy a particular revision from Subversion\n\
$ cap deploy -s revision=1234\n\n\
Execute the disable_web task:\n\
$ rake remote_exec ACTION=disable_web \\\n\
UNTIL=\"tomorrow morning\" \\\n\
REASON=\"vital upgrade\"\n\n\
Using the invoke task:\n\
$ rake remote_exec ACTION=invoke \\\n\
COMMAND=\"svn up /u/apps/flipper/current/app/views\" \\\n\
########## Standard Tasks ##########\n\
cleans up the releases directory, leaving the five most recent releases:\n\
$ cap cleanup \n\n\
used when deploying an application for the first time. Starts the\n\
spinner (via the spinner task) and then does a normal deploy:\n\
$ cap cold_deploy \n\n\
updates all the code on your server (via update_code and symlink\n\
tasks), then restarts the FastCGI listeners on the application servers (via\n\
the restart task):\n\
$ cap deploy\n\n\
prints the difference between what was last deployed, and what is\n\
currently in your repository:\n\
$ cap diff_from_last_deploy\n\n\
puts up a static maintenance page that is displayed to visitors:\n\
$ cap disable_web\n\n\
removes the maintenance page:\n\
$ cap enable_web\n\n\
allows you to send commands directly:\n\
$ cap invoke\n\n\
changes to the directory of your current release (as indicated by the\n\
current symlink), and runs rake RAILS_ENV=production migrate:\n\
$ cap migrate\n\n\
restarts all FastCGI listeners for your application by calling the reaper\n\
command without arguments. Only executed on :app servers\n\
$ cap restart\n\n\
rolls your application back to the previously deployed version\n\
determines the previous release , updates the current symlink to point\n\
to that, and then deletes the latest release\n\
$ cap rollback\n\n\
Creates and chmods the directory tree properly:\n\
$ cap setup\n\n\
inspect the existing tasks and display them to standard out in\n\
alphabetical order, along with their descriptions:\n\
$ cap show_tasks\n\n\
starts the spinner process for your application:\n\
$ cap spinner\n\n\
updates the current symlink to the latest deployed version of the code\n\
$ cap symlink\n\n\
Checks out your source code, deletes the log and public/system\n\
directories in your new release, symlinks log to\n\
#{shared_path}/log, symlinks public/system to #{shared_path}/system:\n\
$ cap update_code\n\n\n\
########## config/deploy.rb ##########\n\
*Defining Tasks\n\
task :hello_world do\n run \"echo Hello, $HOSTNAME\"\n\
task :hello_world, :roles => [:db, :app] do\n puts \"calling hello_world...\"\n hello_world\n\
task :cold_deploy do\n transaction do\n task_one_here\n task_two_here\n end\n task_three_not_in_transaction\n\
*Capturing output with run\n\
run \"sudo ls -la\" do |channel, stream, data|\n if data =~ /^Password:/\n \"#{channel[:host]} asked for password\"\n channel.send_data \"mypass\\n\"\n end\n\
buffer = render(:template => \n\
<<EXAMPLE_TEMPLATE)\n This template will be rendered replacing variables\n <%= like_this_variable =>\n with their values.\n\
put buffer, \"path/to/save/file.txt\", :mode => 0755\n\n\
* multi-stage\n\
set :stages, %w(staging production testing) # [optional] defaults to\n\
[development, test, staging?, production].\n\
set :default_stage, \"testing\" # [optional] if omitted, cap aborts if you don't\n\
specify in args\n\
require 'capistrano/ext/multistage'\n\n\
Stage-specific code in config/deploy/staging.rb and config/deploy/production.rb.\n\
*deploy.rb variables and their defaults\n\n\
The name of your application. \n\
The location of your code\xE2\x80\x99s scm repository\n\
The address of the server to use as a gateway. \n\
The name of the user to use when logging into the remote host(s).\n\
The password to use for logging into the remote host(s).\n\
The root of the directory tree on the remote host(s) that the \n\
application should be deployed to\n\
The directory under deploy_to that should contain each deployed revision.\n\
The name to use (relative to deploy_to) for the symlink that points at \n\
the current release\n\
The name of the directory under deploy_to that will contain directories and\n\
files to be shared between all releases.\n\
This specifies the revision you want to check out on the remote machines.\n\
The source control module to use. \n\
Current supported are :subversion, :cvs, :darcs\n\
The location on the remote host of the source control executable.\n\
The subversion operation to use when checking out code on the remote host. \n\
Can be set to \xE2\x80\x9Cexport\xE2\x80\x9D\n\
Hash of additional options passed to the SSH connection routine.\n\
This lets you set (among other things) a non-standard port to connect on:\n\
(ssh_options[:port] = 2345)\n\
Whether or not tasks that can use sudo, ought to use sudo. In a shared\n\
environment, this is typically not desirable (or possible), and\n\
in that case you should set this variable to false\n\
Sets the path to sudo.\n\
variables are set via:\n\
set :application, \"flipper\"\n\n\n\
########## Interactive Shell ##########\n (requires capistrano-1.2.0)\n\
Shell is essentially a SSH interface to your\n\
servers, so you can run standard commands such \n\
as 'ls' or 'cp' as well as Capistrano-specific ones.\n\n\
Start the interactive Capistrano shell\n\
$ cap -v shell\n\n\
Execute Capistrano tasks\n\
cap> !deploy\n\
cap> !update_code symlink\n\
cap> !setup deploy\n\
cap> on !setup\n\
cap> with app,db !setup deploy"
Jump to Line
Something went wrong with that request. Please try again.