{"id":13395062,"url":"https://github.com/capistrano/capistrano","last_synced_at":"2025-05-12T18:16:56.316Z","repository":{"id":510634,"uuid":"138312","full_name":"capistrano/capistrano","owner":"capistrano","description":"A deployment automation tool built on Ruby, Rake, and SSH.","archived":false,"fork":false,"pushed_at":"2025-02-09T01:32:29.000Z","size":4635,"stargazers_count":12786,"open_issues_count":59,"forks_count":1769,"subscribers_count":319,"default_branch":"master","last_synced_at":"2025-05-12T18:16:48.878Z","etag":null,"topics":["capistrano","deployment","ruby","ssh"],"latest_commit_sha":null,"homepage":"http://www.capistranorb.com","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/capistrano.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2009-02-26T16:14:04.000Z","updated_at":"2025-05-12T02:25:09.000Z","dependencies_parsed_at":"2023-02-14T10:00:27.480Z","dependency_job_id":"fa4da12e-d03b-4e02-a81d-2490ea20bc52","html_url":"https://github.com/capistrano/capistrano","commit_stats":{"total_commits":1145,"total_committers":287,"mean_commits":3.989547038327526,"dds":0.8602620087336245,"last_synced_commit":"79132433f6d191084fe618ce90a9d2f7a5b3b280"},"previous_names":[],"tags_count":114,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capistrano%2Fcapistrano","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capistrano%2Fcapistrano/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capistrano%2Fcapistrano/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capistrano%2Fcapistrano/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/capistrano","download_url":"https://codeload.github.com/capistrano/capistrano/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253795162,"owners_count":21965488,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["capistrano","deployment","ruby","ssh"],"created_at":"2024-07-30T17:01:40.762Z","updated_at":"2025-05-12T18:16:56.273Z","avatar_url":"https://github.com/capistrano.png","language":"Ruby","readme":"\n# Capistrano: A deployment automation tool built on Ruby, Rake, and SSH.\n\n[![Gem Version](https://badge.fury.io/rb/capistrano.svg)](http://badge.fury.io/rb/capistrano) [![Build Status](https://github.com/capistrano/capistrano/actions/workflows/ci.yml/badge.svg)](https://github.com/capistrano/capistrano/actions/workflows/ci.yml) [![Code Climate](https://codeclimate.com/github/capistrano/capistrano/badges/gpa.svg)](https://codeclimate.com/github/capistrano/capistrano) [![CodersClan](https://img.shields.io/badge/get-support-blue.svg)](http://codersclan.net/?repo_id=325\u0026source=small)\n\nCapistrano is a framework for building automated deployment scripts. Although Capistrano itself is written in Ruby, it can easily be used to deploy projects of any language or framework, be it Rails, Java, or PHP.\n\nOnce installed, Capistrano gives you a `cap` tool to perform your deployments from the comfort of your command line.\n\n```\n$ cd my-capistrano-enabled-project\n$ cap production deploy\n```\n\nWhen you run `cap`, Capistrano dutifully connects to your server(s) via SSH and executes the steps necessary to deploy your project. You can define those steps yourself by writing [Rake](https://github.com/ruby/rake) tasks, or by using pre-built task libraries provided by the Capistrano community.\n\nTasks are simple to make. Here's an example:\n\n```ruby\ntask :restart_sidekiq do\n  on roles(:worker) do\n    execute :service, \"sidekiq restart\"\n  end\nend\nafter \"deploy:published\", \"restart_sidekiq\"\n```\n\n*Note: This documentation is for the current version of Capistrano (3.x). If you are looking for Capistrano 2.x documentation, you can find it in [this archive](https://github.com/capistrano/capistrano-2.x-docs).*\n\n---\n\n## Contents\n\n* [Features](#features)\n* [Gotchas](#gotchas)\n* [Quick start](#quick-start)\n* [Finding help and documentation](#finding-help-and-documentation)\n* [How to contribute](#how-to-contribute)\n* [License](#license)\n\n## Features\n\nThere are many ways to automate deployments, from simple rsync bash scripts to complex containerized 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. There is no magic here!\n\nHere's what makes Capistrano great:\n\n#### Strong conventions\n\nCapistrano defines a standard deployment process that all Capistrano-enabled projects follow by default. You don't have to decide how to structure your scripts, where deployed files should be placed on the server, or how to perform common tasks: Capistrano has done this work for you.\n\n#### Multiple stages\n\nDefine your deployment once, and then easily parameterize it for multiple *stages* (environments), e.g. `qa`, `staging`, and `production`. No copy-and-paste necessary: you only need to specify what is different for each stage, like IP addresses.\n\n#### Parallel execution\n\nDeploying to a fleet of app servers? Capistrano can run each deployment task concurrently across those servers and uses connection pooling for speed.\n\n#### Server roles\n\nYour application may need many different types of servers: a database server, an app server, two web servers, and a job queue work server, for example. Capistrano lets you tag each server with one or more roles, so you can control what tasks are executed where.\n\n#### Community driven\n\nCapistrano is easily extensible using the rubygems package manager. Deploying a Rails app? Wordpress? Laravel? Chances are, someone has already written Capistrano tasks for your framework of choice and has distributed it as a gem. Many Ruby projects also come with Capistrano tasks built-in.\n\n#### It's just SSH\n\nEverything in Capistrano comes down to running SSH commands on remote servers. On the one hand, that makes Capistrano simple. On the other hand, if you aren't comfortable SSH-ing into a Linux box and doing stuff on the command-line, then Capistrano is probably not for you.\n\n## Gotchas\n\nWhile Capistrano ships with a strong set of conventions that are common for all types of deployments, it needs help understanding the specifics of your project, and there are some things Capistrano is not suited to do.\n\n#### Project specifics\n\nOut of the box, Capistrano can deploy your code to server(s), but it does not know how to *execute* your code. Does `foreman` need to be run? Does Apache need to be restarted? You'll need to tell Capistrano how to do this part by writing these deployment steps yourself, or by finding a gem in the Capistrano community that does it for you.\n\n#### Key-based SSH\n\nCapistrano depends on connecting to your server(s) with SSH using key-based (i.e. password-less) authentication. You'll need this working before you can use Capistrano.\n\n#### Provisioning\n\nLikewise, your server(s) will likely need supporting software installed before you can perform a deployment. Capistrano itself has no requirements other than SSH, but your application probably needs database software, a web server like Apache or Nginx, and a language runtime like Java, Ruby, or PHP. These *server provisioning* steps are not done by Capistrano.\n\n#### `sudo`, etc.\n\nCapistrano is designed to deploy using a single, non-privileged SSH user, using a *non-interactive* SSH session. If your deployment requires `sudo`, interactive prompts, authenticating as one user but running commands as another, you can probably accomplish this with Capistrano, but it may be difficult. Your automated deployments will be much smoother if you can avoid such requirements.\n\n#### Shells\n\nCapistrano 3 expects a POSIX shell like Bash or Sh. Shells like tcsh, csh, and such may work, but probably will not.\n\n## Quick start\n\n### Requirements\n\n* Ruby version 2.0 or higher on your local machine (MRI or Rubinius)\n* A project that uses source control (Git, Mercurial, and Subversion support is built-in)\n* The SCM binaries (e.g. `git`, `hg`) needed to check out your project must be installed on the server(s) you are deploying to\n* [Bundler](http://bundler.io), along with a Gemfile for your project, are recommended\n\n### Install the Capistrano gem\n\nAdd Capistrano to your project's Gemfile using `require: false`:\n\n``` ruby\ngroup :development do\n  gem \"capistrano\", \"~\u003e 3.17\", require: false\nend\n```\n\nThen run Bundler to ensure Capistrano is downloaded and installed:\n\n``` sh\n$ bundle install\n```\n\n### \"Capify\" your project\n\nMake sure your project doesn't already have a \"Capfile\" or \"capfile\" present. Then run:\n\n``` sh\n$ bundle exec cap install\n```\n\nThis creates all the necessary configuration files and directory structure for a Capistrano-enabled project with two stages, `staging` and `production`:\n\n```\n├── Capfile\n├── config\n│   ├── deploy\n│   │   ├── production.rb\n│   │   └── staging.rb\n│   └── deploy.rb\n└── lib\n    └── capistrano\n            └── tasks\n```\n\nTo customize the stages that are created, use:\n\n``` sh\n$ bundle exec cap install STAGES=local,sandbox,qa,production\n```\n\nNote that the files that Capistrano creates are simply templates to get you started. Make sure to edit the `deploy.rb` and stage files so that they contain values appropriate for your project and your target servers.\n\n### Command-line usage\n\n``` sh\n# list all available tasks\n$ bundle exec cap -T\n\n# deploy to the staging environment\n$ bundle exec cap staging deploy\n\n# deploy to the production environment\n$ bundle exec cap production deploy\n\n# simulate deploying to the production environment\n# does not actually do anything\n$ bundle exec cap production deploy --dry-run\n\n# list task dependencies\n$ bundle exec cap production deploy --prereqs\n\n# trace through task invocations\n$ bundle exec cap production deploy --trace\n\n# lists all config variable before deployment tasks\n$ bundle exec cap production deploy --print-config-variables\n```\n\n## Finding help and documentation\n\nCapistrano is a large project encompassing multiple GitHub repositories and a community of plugins, and it can be overwhelming when you are just getting started. Here are resources that can help:\n\n* **The [docs](docs) directory contains the official documentation**, and is used to generate the [Capistrano website](http://capistranorb.com)\n* [Stack Overflow](http://stackoverflow.com/questions/tagged/capistrano) has a Capistrano tag with lots of activity\n* [The Capistrano mailing list](https://groups.google.com/forum/#!forum/capistrano) is low-traffic but is monitored by Capistrano contributors\n* [CodersClan](http://codersclan.net/?repo_id=325\u0026source=link) has Capistrano experts available to solve problems for bounties\n\nRelated GitHub repositories:\n\n* [capistrano/sshkit](https://github.com/capistrano/sshkit) provides the SSH behavior that underlies Capistrano (when you use `execute` in a Capistrano task, you are using SSHKit)\n* [capistrano/rails](https://github.com/capistrano/rails) is a very popular gem that adds Ruby on Rails deployment tasks\n* [mattbrictson/airbrussh](https://github.com/mattbrictson/airbrussh) provides Capistrano's default log formatting\n\nGitHub issues are for bug reports and feature requests. Please refer to the [CONTRIBUTING](CONTRIBUTING.md) document for guidelines on submitting GitHub issues.\n\nIf you think you may have discovered a security vulnerability in Capistrano, do not open a GitHub issue. Instead, please send a report to \u003csecurity@capistranorb.com\u003e.\n\n## How to contribute\n\nContributions to Capistrano, in the form of code, documentation or idea, are gladly accepted. Read the [DEVELOPMENT](DEVELOPMENT.md) document to learn how to hack on Capistrano's code, run the tests, and contribute your first pull request.\n\n## License\n\nMIT License (MIT)\n\nCopyright (c) 2012-2020 Tom Clements, Lee Hambley\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","funding_links":[],"categories":["Production","Ruby","Provision, Deploy \u0026 Host","Awesome Capistrano","Happy Exploring 🤘","Tools","GitHub projects","运维自动化","ruby","生产","Ruby Tools","Ruby Tools and Frameworks","Deployment","Bonus #5 - Self-Hosted Development Tools","Python Frameworks and Tools"],"sub_categories":["Security","Deployment Automation","Gems","Interfaces","安全","Deployment Automation and Configuration Management","E-Books","Mesh networks","JavaScript Libraries for Machine Learning","Notable Mentions"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapistrano%2Fcapistrano","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapistrano%2Fcapistrano","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapistrano%2Fcapistrano/lists"}