Capistrano is remote multi-server automation deployment tool-gem.
A dynamic, open source programming language with a focus on simplicity and productivity, it has an elegant syntax that is natural to read and easy to write.
Capistrano is written in Ruby, but it can easily be used to deploy any language.
If your language or framework has special deployment requirements, Capistrano can easily be extended to support them.
The scripting and execution of arbitrary tasks is supported, also includes a set of sane-default deployment workflows.
Capistrano can be used to:
- Reliably deploy web application to any number of machines simultaneously, in sequence or as a rolling set
- To automate audits of any number of machines (checking login logs, enumerating uptimes, and/or applying security patches)
- To script arbitrary workflows over SSH
- To automate common tasks in software teams.
- To drive infrastructure provisioning tools such as chef-solo, Ansible or similar.
Capistrano is also scriptable, and can be integrated with any other Ruby software to form part of a larger tool.
It looks like this:
Addionally, Capistrano includes:
- Interchangeable output formatters (progress, pretty, html, etc)
- Easy to add support for other source control management software.
- A rudimentary multi-console for running Capistrano interactively.
- Host and Role filters for partial deploys, or partial-cluster maintenance.
- Recipes for the Rails asset pipelines, and database migrations.
- Support for complex environments.
- A sane, expressive API.
Main features of Capistrano are:
- Strong conventions
- Multiple stages
- Parallel execution
- Server roles
- Community driven
Other useful information about Capistrano can be found on it's website.
Let's figure out how to install this gem.
- Ruby version 2.0 or higher on your local machine (MRI or Rubinius)
- A project that uses source control (Git, Mercurial, and Subversion support is built-in)
- The SCM binaries (e.g.
hg) needed to check out your project must be installed on the server(s) you are deploying to
- Bundler, along with a Gemfile for your project, are recommended
Install the Capistrano gem
Add Capistrano to your project's Gemfile:
group :development do gem "capistrano", "~> 3.8" end
Then run Bundler to ensure Capistrano is downloaded and installed:
$ bundle install
Capistrano with RubyMine
A smart and easy to use integrated development environment for the Ruby language and Rails web framework.
Let's see how installation of Capistrano will effect RubyMine work.
Changes to the UI
Once installed, Capistrano introduces the following changes to the RubyMine UI:
- Capistrano node appears in the Tools menu, with the nested commands Capify application and Run Capistrano task.
- Capistrano run/debug configuration becomes available.
Capistrano support in RubyMine includes:
- Syntax and error highlighting.
- Code completion in Capfile.
- Structure view for Capfile and deploy.rb.
So doing, the Structure view shows Capistrano tasks:
- capability to run Capistrano tasks.
- Available Capistrano tasks appear in the Go to Symbol suggestion list:
You can have more information about RubyMine Capistrano support at a relevant section of JetBrains website.
Capistrano is interesting and powerful tool. There are many ways to automate deployments, from simple scripts to complex toolchains. Capistrano sits somewhere in the middle: it automates what you already know how to do manually with SSH, but in a repeatable, scalable fashion.