Skip to content

Capistrano

A Ruby tool that runs deployment steps on your servers over SSH from the command line.

Stars
13k
Forks
1.7k
Licence
MIT
Language
Ruby
Last update
5 days ago
Type
Dev tool

What it is

Capistrano is a framework for writing automated deployment scripts. You run the cap command, it connects to your servers over SSH, and it runs the steps needed to deploy your project. It is written in Ruby, but the README says it can deploy projects in other languages or frameworks, such as Rails, Java, or PHP.

  • Deploy a project to staging with bundle exec cap staging deploy
  • Preview a deployment with --dry-run before running it for real
  • Restart a service such as Sidekiq after each deploy by adding a custom task
  • Run different deployment steps on different server roles, such as workers or web servers

Great for

  • Developers who already deploy by logging into servers over SSH and want that process repeated reliably
  • Teams deploying the same project to several stages such as staging and production
  • Projects with multiple servers that need different tasks run on different roles
  • Ruby or Rails teams who can use existing community Capistrano tasks

Not ideal for

  • People uncomfortable working on Linux servers from the command line, since the README says everything comes down to SSH commands
  • Setups that cannot use key-based, passwordless SSH login, because the README says Capistrano depends on it
  • Projects needing heavy sudo or interactive prompts, which the README says are difficult to do with Capistrano
  • Teams wanting a tool that also provisions servers, since the README says provisioning is not done by Capistrano
Step-by-step guide: how to use CapistranoInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Ruby 2.5 or higher · Bundler (recommended) · Git, Mercurial, or Subversion binaries on the server if your project uses them

    Add to Gemfile (inside a development group, with require: false)

    gem "capistrano", "~> 3.17", require: false

    Install gems with Bundler

    bundle install

    Generate Capistrano config files in your project

    bundle exec cap install
  2. 2

    Run it

    • Run bundle exec cap install to create the Capfile and config files
    • Edit config/deploy.rb and the stage files with your project and server details
    • List available tasks with bundle exec cap -T
    • Simulate a deploy with bundle exec cap staging deploy --dry-run
    • Run bundle exec cap staging deploy to deploy for real
  3. 3

    Get the most out of it

    • Use --dry-run to check what a deploy would do before running it
    • Use --prereqs or --trace to see task order and invocations when debugging
    • Define per-stage differences such as IP addresses in separate stage files instead of copying config
    • Assign servers to roles so tasks run only on the right machines
    • Browse community gems for Rails, WordPress, or Laravel tasks rather than writing everything yourself

Downloads

Strengths

  • Follows a standard deployment process by default, so less setup is needed to decide structure
  • Can run tasks concurrently across many servers and uses connection pooling, according to the README
  • Extensible through RubyGems, with community task libraries for several frameworks

Trade-offs

  • You must write or find tasks that tell it how to start or restart your application; it does not do this on its own
  • Requires key-based SSH access and a POSIX shell on the server side, and server software must be installed separately
  • Needs a Ruby environment (version 2.5 or higher per the README) on the local machine

How it compares

ProjectStarsTypeLevelUpdatedBest for
capistrano (this)13kDev toolintermediate5 days agoDevelopers who already deploy by logging into servers over SSH and want that process repeated reliably
kamal14.7kDev toolintermediate16 days agoDevelopers who want to self-host web apps without adopting a managed platform
Fabric44.5kCLIintermediate5 days agoCommand-line users who want to run AI prompts on files or piped text
fastlane42.3kCLIintermediate4 days agoiOS developers who repeat the same build and release steps by hand
deployer11.1kDev toolintermediate2 months agoPHP developers who deploy their own applications to servers
jekyll51.7kDev toolintermediate24 days agoDevelopers who want a blog or simple website built from plain text files

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.