User:Hawkwoodye/sandbox

Capistrano (Draft for CSC517)
Capistrano is an open source, Ruby, Rake, and SSH language-based, remote server automatic deployment tool. It can be easily used to deploy projects of any language or framework, such as Rails, Java, or PHP, and is also very scriptable to be integrated with other Ruby software. After Capistrano connects to the remote server via SSH, it then executes steps that are either user specified tasks written in Rake or pre-build task libraries by Capistrano community.

History
Capistrano was first released in 2008. The latest version 3 was released on 1st June, 2013, with the following design goals: get away from our own DSL solution; better modularisation; easier debugging; higher performance (speed); and applicability.

=== Example of Cap === Capistrano is designed as a framework which builds deployment scripts automatically. It is written by Ruby and could be easily implemented to design projects of any language or framework, such as Rails, Java, or PHP.

Once installed, Capistrano provides a cap tool to perform deployments via command line. Cap tool is used for viewing and running the tasks and it is the main command in Capistrano.

Capistrano reads its instructions from a capfile. (similar with “makefile” or “rakefile”). The Capfile is where you will tell Capistrano about the servers you want to connect to and the tasks you want to perform on those servers. After a capfile created, Capistrano reads it and processes the instructions in it.

Run the deploy command:

 

“cap invoke” is a simple command, when called on the command line, user can simultaneously send one command to all servers:

 

User can also execute “cap invoke” command under root permission.

“cap shell” is the command to give user an interactive prompt from entered adhoc commands and even execute tasks. After “cap shell” executed, all connections that are established during the duration of the shell session are cached and reused.

Strong conventions
A standard deployment process is defined in Capistrano and all Capistrano-enabled projects should follow it. In this case, Capistrano will decide how to structure your scripts, where place deployed files on the server, and how to perform common tasks et al by itself. User does not consider and worry those works.

Multiple stages
Once an user defines its deployment, it is easily parameterize Capistrano for multiple stages (environments), such as qa, staging, and production. For user, it only need to specify what is different for each stage, like IP addresses, does not need to copy-and-paste details manually.

Parallel execution
Capistrano is a Ruby based deployment tool which executes commands in parallel on multiple remote machines, via the SSH protocol. Each deployment task can be executed concurrently across those servers and uses connection pooling for speed.

For example, with Capistrano you can deploy your Rails application on N servers with one single command from your dev machine. You even don’t need to login via SSH to your server. The “cap” command can rollout your application on N servers as fellowing:

 

Server roles
There are lots of different types of servers such as a database server, two app servers, and job queue work server available in Capistrano project design. User can tag each server with one or more rules in order to control where tasks are executed.

Community driven
The Rubygems package manager is easily implemented and extended in Capistrano. When Deploying a Rails app, Wordpress, orLaravel, programmer could find lots of Capistrano tasks which has already written and distributed as a gem by others. Those gem are good choice to built-in your project design.

Limitations

 * Need users to specify tasks' dependency
 * Capistrano's underlying SSH connection needs to be key-based.
 * Need Capistrano users to install all required softwares.
 * Capistrano have limited support to tasks that require sudo requirements.