Questions tagged [capistrano]

Capistrano is a developer tool for deploying web applications. It is typically installed on a workstation, and used to deploy code from your source code management (SCM) to one, or more servers.

Capistrano is an open source tool for running scripts on multiple servers; its main use is deploying web applications. It automates the process of making a new version of an application available on one or more web servers, including supporting tasks such as running database migrations.

Capistrano is written in the Ruby language and is distributed using the RubyGems distribution channel. It is an outgrowth of the Ruby on Rails web application framework, but has also been used to deploy web applications written using other frameworks, including ones written in PHP.

Capistrano is implemented primarily for use on the bash command line. Users of the Ruby on Rails framework may choose from many Capistrano recipes; e.g. to deploy current changes to the web application or roll back to the previous deployment state.

Originally called SwitchTower, the name was changed to Capistrano in March 2006 because of a trademark conflict.

Resources:

Related tags:

Implementation specific tags

When you are asking a question about capistrano you could also add more specific tags. Here is the list of available tags:

Online Screencasts

  1. Codeschool Deployment: Capistrano - Part 1
  2. Codeschool Deployment: Capistrano - Part 2
  3. Railscasts Capistrano Tasks - Do you know how to make Capistrano tasks? See how to change default deployment behavior with custom tasks in this episode.
  4. Capistrano Tasks (revised) - Learn the basics of writing Capistrano tasks, how to set variables, and run commands on a remote server
3868 questions
32
votes
10 answers

bundle install doesn't work from capistrano

I want to deploy my simple rails 4.0 application via capistrano 3.0. I use bundler 1.3.5 so I add capistrano-bundler gem to integrate bundler with capistrano. I have pretty simple configuration (almost default): set :bundle_gemfile, -> {…
freemanoid
  • 14,592
  • 6
  • 54
  • 77
31
votes
5 answers

How to use secrets.yml for API_KEYS in Rails 4.1?

In one of my recent projects I started out by .gitignoring the files containing secrets and environment variables. So the entire project is committed to the repo except the files that contain third party secrets such as that of Stripe, Twitter API…
Marvin Danig
  • 3,738
  • 6
  • 39
  • 71
30
votes
5 answers

Set default stage with Capistrano 3

Is there a way to set a default stage in Capistrano 3? I've tried putting set :stage, :production inside deploy.rb but that didn't work, it gives the error: Stage not set, please call something such as `cap production deploy`, where production is a…
Brad Dwyer
  • 6,305
  • 8
  • 48
  • 68
30
votes
3 answers

Capistrano with PostgreSQL, error: database is being accessed by other users

I have a Rails app that uses PostgreSQL as a backend with a cert environment that tries to mimic production, except that it needs to have the database reset periodically for QA. When I attempt to execute db:reset from a Capistrano task during…
Graham Conzett
  • 8,344
  • 11
  • 55
  • 94
29
votes
4 answers

Restart nginx without sudo?

So I want to be able to cap:deploy without having to type any passwords. I have setup all private keys so I can get to the remote servers fine, and am now using svn over ssh, so no passwords there. I have one last problem, I need to be able to…
tesserakt
  • 3,231
  • 4
  • 27
  • 40
29
votes
9 answers

/usr/bin/env ruby no such file or directory: Using capistrano 3, capistrano/rbenv, capistrano/bundler and capistrano/rails (using rails 4)

I'm using capistrano, capistrano/rbenv, capistrano/bundler and capistrano/rails. I get this error in the step where capistrano compiles the assets: DEBUG [49a50df6] /usr/bin/env: DEBUG [49a50df6] ruby DEBUG [49a50df6] : No such file or…
patriciomacadden
  • 497
  • 1
  • 4
  • 9
28
votes
2 answers

replace git submodule protocol from git to http

I add a submodule from a git@... URL, to be able to develop in it. Now I want to deploy the app and replace the URL with an git://... one, so it doesn't need authentication to the submodule's repo from Capistrano. Is editing the URL in .gitmodules…
Alexy
  • 1,520
  • 2
  • 16
  • 30
28
votes
2 answers

deploy with capistrano using a pem file

We have a EC2 instance, and our capistrano setup requires ssh. To connect through ssh normally, I use a .pem file for connecting to the server. how do I utilize this .pem file when using capistrano to deploy?
Tyler Jones
  • 1,283
  • 4
  • 18
  • 38
26
votes
4 answers

Capistrano and several SSH keys

I need Capistrano to use 2 different SSH keys. One is for the git repository, one is for the server to deploy to. Whichever key I rename to id_rsa in my .ssh folder, works. The other one doesn't. If I rename the git key to id_rsa, Capistrano can…
MrB
  • 2,155
  • 7
  • 27
  • 33
26
votes
1 answer

Deploying on Heroku with Capistrano?

I'm still getting used to the Rails development ecosystem. Recently I learned how to use capistrano for deploying to my servers using apache and passenger, and I love how I can put a rather complex set of deployment instructions into my deploy.rb so…
amatriain
  • 263
  • 4
  • 5
25
votes
5 answers

Carrierwave files with Capistrano

I'm using rails 3.2 with asset and carrierwave for upload some images, they store in /public/uploads/photo/..... but when I do a cap:deploy (with capistrano) my current directory application doesn't contain the files I uploaded, because capistrano…
eveevans
  • 4,392
  • 2
  • 31
  • 38
25
votes
2 answers

Capistrano to deploy rails application - how to handle long migrations?

So I am using Capistrano to deploy a rails application to my production server (apache+passenger) and at the moment deployment usually goes along the lines: $cap deploy $cap deploy:migrations It got me wondering, let's say my db:migrations took a…
Clinton
  • 3,638
  • 3
  • 26
  • 33
24
votes
1 answer

What does :except => {:no_release => true} mean in Capistrano DSL

For example in: task :restart, :roles => :app, :except => { :no_release => true } do end
denysonique
  • 16,235
  • 6
  • 37
  • 40
24
votes
3 answers

RVM error with deploying Rails app via Capistrano

History: Read into Deploying Rails3 app to a Mediatemple DV server. Installed RVM on the server, ruby, and essential gems. Site works fine if I FTP it up. All good. I then decided to do a proper deployment and setup for GIT/cap deploy as per…
Adrian
  • 734
  • 1
  • 5
  • 14
24
votes
2 answers

How to capture output from a remote command in Capistrano?

I want to run a remote command (git diff of current_revision and HEAD in a few folders) and capture the output. I've tried run("git diff rev1 rev2 -- folder | cat"), but the method always returns seems to return nil (even when I can see the diff…
Richard Johansson
  • 430
  • 1
  • 5
  • 12