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
61
votes
5 answers

How to deploy to a single specific server using Capistrano

I have a system in production that has several servers in several roles. I would like to test a new app server by deploying to that specific server, without having to redeploy to every server in production. Is there a way to ask Capistrano to deploy…
Pete Hodgson
  • 15,644
  • 5
  • 38
  • 46
61
votes
5 answers

Capistrano and environment variables

I've switched to using environment variables for configuration and it works very well - except when I have to deploy or run tasks with capistrano. Capistrano 3 seems to execute each command prefixed with /usr/bin/env which erases any environment…
60
votes
7 answers

Speed up assets:precompile with Rails 3.1/3.2 Capistrano deployment

My deployments are slow, they take at least 3 minutes. The slow Capistrano task during deploy is assets:precompile. This takes probably 99% of the total deploy time. How can I speed this up? Should I precompile my assets on my local machine and add…
Godisemo
  • 1,813
  • 2
  • 18
  • 26
59
votes
7 answers

Capistrano asks for password when deploying, despite SSH keys

My ssh keys are definitely set up correctly, as I'm never prompted for the password when using ssh. But capistrano still asks for a password when deploying with cap deploy. It doesn't ask for the password when I setup with cap deploy:setup though,…
ehsanul
  • 7,737
  • 7
  • 33
  • 43
58
votes
13 answers

Deny access to .svn folders on Apache

We have a rails application in subversion that we deploy with Capistrano but have noticed that we can access the files in '/.svn', which presents a security concern. I wanted to know what the best way to do this. A few ideas: Global Apache…
csexton
  • 24,061
  • 15
  • 54
  • 57
57
votes
3 answers

Capistrano deployment problems

When I type cap production deploy I get Capfile locked at 3.1.0, but 3.2.0 is loaded When I uninstall capistrano 3.2.0 I get Could not find capistrano-3.2.0 in any of the sources Run `bundle install` to install missing gems. Me gemfile has gem…
Kamil Lelonek
  • 14,592
  • 14
  • 66
  • 90
54
votes
6 answers

How to Configure Capistrano to Deploy from Local Git Repository?

What changes do I need to make to the deploy.rb file below to make it deploy my app from a local git repo? If I can't deploy from a local repo, can I have capistrano use the working copying instead? set :application, "my_app" set :repository,…
DaneS
  • 653
  • 2
  • 6
  • 7
54
votes
9 answers

Capistrano SSH::AuthenticationFailed, not prompting for password

I've been using capistrano successfully for a while now and all of a sudden in every project I've lost the ability to deploy. Environment: os X (Mavericks) ruby 1.9.3p194 rvm (locally, not on server) rails 3.2 and up RubyGems 1.8.25 I'm not using…
Sparkmasterflex
  • 1,837
  • 1
  • 20
  • 33
53
votes
8 answers

Rails 3 -- Bundler/Capistrano Errors

I have a basic Rails 3 app working locally on my development box, but want to test out deploying early on to make sure everything works. I'm using Capistrano to deploy. When I run cap deploy (after all the other necessary setup), it breaks on this…
T.J. Schuck
  • 3,645
  • 2
  • 19
  • 20
50
votes
7 answers

Capistrano & Bash: ignore command exit status

I'm using Capistrano run a remote task. My task looks like this: task :my_task do run "my_command" end My problem is that if my_command has an exit status != 0, then Capistrano considers it failed and exits. How can I make capistrano keep going…
nicholaides
  • 19,211
  • 12
  • 66
  • 82
50
votes
6 answers

Capistrano - How to put files in the shared folder?

I am new to Capistranoand I saw there is shared folder and also option :linked_files. I think shared folder is used to keep files between releases. But my question is, how do files end up being in the shared folder? Also, if I want to symlink…
Fajarmf
  • 2,143
  • 4
  • 19
  • 23
47
votes
6 answers

Why is a cap deploy giving Permission denied (publickey)?

Ok, I'm confused about something... I am able to commit to my github repository just fine, but when I try to do a cap deploy from my local folder to my staging server I get Permission denied (publickey). If I run ssh git@github.com I actually get an…
GiH
  • 14,006
  • 13
  • 43
  • 56
45
votes
5 answers

How do I invoke one Capistrano task from another?

How do I invoke one Capistrano task from another? For example: task :foo do # stuff end task :bar do # INVOKE :foo end
weicool
  • 2,613
  • 5
  • 22
  • 19
45
votes
2 answers

Deploying a Rails App to Multiple Servers using Capistrano - Best Practices

I have a rails application that I need to deploy to 3 servers - machine1.com, machine2.com and machine3.com. I want to be able to deploy it to all machines at once and each machine individually. Can someone help me out with a skeleton Capistrano…
Louise
  • 451
  • 1
  • 5
  • 3
45
votes
9 answers

Rails 4, Capistrano 3.0.0, cannot load such file -- deploy

I just ran bundle update and capistrano got updated to 3.0.0 but now when I run cap deploy I get an error and can't figure out how to fix this. I have been updating my server every day without problem until this update. cap aborted! cannot load such…
markhorrocks
  • 1,199
  • 19
  • 82
  • 151