explaingit

capistrano/capistrano

12,952RubyAudience · ops devopsComplexity · 3/5Setup · moderate

TLDR

Capistrano automates deploying any app to servers over SSH by running a sequence of tasks you define from your local machine, it works for any language, not just Ruby.

Mindmap

mindmap
  root((capistrano))
    What it does
      Automated deployment
      Multi server support
      Stage management
    Tech stack
      Ruby
      Rake
      SSH
    Use cases
      Rails deployment
      PHP deployment
      Multi server rollout
    Features
      Rollback support
      Plugin ecosystem
      Parallel tasks
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Automate deploying your app to one or more servers with a single command from your local machine.

USE CASE 2

Deploy to separate staging and production environments from one configuration with per-environment overrides.

USE CASE 3

Run deployment steps in parallel across a fleet of servers to speed up large-scale releases.

USE CASE 4

Roll back to a previous release instantly using Capistrano's standard directory structure on your server.

Tech stack

RubyRakeSSH

Getting it running

Difficulty · moderate Time to first run · 1h+

Requires SSH key-based authentication configured on all target servers before first deploy, does not provision servers or install dependencies.

In plain English

Capistrano is a tool for automating the process of deploying software to servers. It is written in Ruby and works by connecting to your servers over SSH and running a sequence of commands you define. Although Capistrano itself is written in Ruby, it can deploy projects built in any language, including Java, PHP, or Rails. The core idea is that you write your deployment steps as tasks (using a Ruby-based task runner called Rake), and then run a single command from your local machine that executes those steps on your server or servers. A community of plugins provides pre-written task collections for common setups, such as deploying Ruby on Rails applications or WordPress sites. Capistrano supports deploying to multiple environments, which it calls stages, from a single configuration. You define the general deployment process once and specify only what differs per stage, such as the server address for production versus staging. It can also run tasks in parallel across multiple servers, which is useful when deploying to a fleet of application servers. The tool imposes a standard directory structure on the servers it deploys to. This consistency means teams do not need to invent their own approach to where files go, which version is live, or how to roll back to a previous release. There are things Capistrano does not handle: it does not provision servers (install databases, web servers, or language runtimes), it does not know how to start or restart your application processes without you writing those steps or finding a plugin, and it requires key-based SSH authentication to be set up before you begin. It is designed for developers comfortable working with SSH and the command line.

Copy-paste prompts

Prompt 1
I want to deploy a Rails app to a Linux server with Capistrano. Walk me through the Capfile setup, deploy.rb configuration, and how to run the first deploy.
Prompt 2
My Capistrano config has staging and production stages with different server addresses. Show me how to define them so they share the same deploy steps but use different hosts.
Prompt 3
How do I write a custom Capistrano task that runs database migrations after files are copied and then restarts the application server?
Prompt 4
I need to roll back my production deployment to the previous release with Capistrano. What command do I run and what changes on the server?
Open on GitHub → Explain another repo

← capistrano on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.