Capistrano is an [[Remote Server Automation Tool]]. It automates the actions required to deploy a web application (uploading code, bundling, restarting processes). Capistrano is common in the [[Ruby On Rails]] world. It's command is `cap`. Some of what Capistrano can do: * Deploy a web application to any number of machines in various ways * To audit any number of machines (logins, uptimes, apply patches) * Script arbitrary workflows over SSH * Automate common tasks * Drive infrastructure provisioning tools. * Restart application servers as part of it's deploy process, such as [[NGINX]], [[Apache]], or [[Phusion Passenger]]. `cap` will run on the local machine and will enable deployments remotely via [[SSH]]. `capistrano-rails` is recommended for [[Ruby On Rails]] projects. ## Basics Capistrano has the notion of roles -- app, web, db, and so forth. You can specify different roles for your code, and different servers for the roles. `deploy.rb` contains shared deployment environment stuff. Running a deploy runs these tasks/rollbacks: https://capistranorb.com/documentation/getting-started/flow/ Tasks are hooks where certain stages are invoked. Different roles can have different tasks registered. ## References https://www.phusionpassenger.com/docs/tutorials/fundamental_concepts/ruby/#capistrano