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
160
votes
15 answers

What is your preferred php deployment strategy?

I'm beginning a new project in PHP and I'd love to get some feedback from other developers on their preferred strategy for PHP deployment. I'd love to automate things a bit so that once changes are committed they can be quickly migrated to a…
GloryFish
  • 13,078
  • 16
  • 53
  • 43
140
votes
13 answers

Using capistrano to deploy from different git branches

I am using capistrano to deploy a RoR application. The codebase is in a git repository, and branching is widely used in development. Capistrano uses deploy.rb file for it's settings, one of them being the branch to deploy from. My problem is this:…
Toms Mikoss
  • 9,097
  • 10
  • 29
  • 41
129
votes
4 answers

Capistrano - clean up old releases

Usually when using capistrano, I will go and manually delete old releases from a deployed application. I understand that you can run cap deploy:cleanup but that still leaves 5 releases. Is this it's intended purpose? Is there another way to cleanup…
Josh
  • 3,601
  • 14
  • 50
  • 71
116
votes
7 answers

Capistrano error tar: This does not look like a tar archive

INFO [050fe961] Running mkdir -p /home/rails/rails- capistrano/releases/20140114234157 on staging-rails DEBUG [050fe961] Command: cd /home/rails/rails-capistrano/repo && ( PATH=/opt/ruby/bin:$PATH GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/rails/git-ssh.sh…
Eric Francis
  • 23,039
  • 31
  • 88
  • 122
109
votes
17 answers

How do I run a rake task from Capistrano?

I already have a deploy.rb that can deploy my app on my production server. My app contains a custom rake task (a .rake file in the lib/tasks directory). I'd like to create a cap task that will remotely run that rake task.
Richard Poirier
  • 4,878
  • 5
  • 26
  • 21
97
votes
21 answers

Bundler: You are trying to install in deployment mode after changing your Gemfile

I'm pretty new to bundler and capistrano, and I'm trying to use them together. When I try to deploy, I get the message: You are trying to install in deployment mode after changing your Gemfile. Run `bundle install' elsewhere and add the updated…
JellicleCat
  • 28,480
  • 24
  • 109
  • 162
88
votes
2 answers

What exactly is a "role" in Capistrano?

What is the purpose and function of "roles" in a Capistrano recipe? When I look at sample recipes, I often see something like this: role :app, 'somedomain.com' role :web, 'somedomain.com' role :db, 'somedomain.com', :primary => true So it looks…
Ethan
  • 57,819
  • 63
  • 187
  • 237
87
votes
19 answers

Why won't bundler install JSON gem?

I get the following error when attempting to run cap production deploy. DEBUG [dc362284] Bundler::GemNotFound: Could not find json-1.8.1.gem for installation DEBUG [dc362284] An error occurred while installing json (1.8.1), and Bundler cannot…
Thomas
  • 2,426
  • 3
  • 23
  • 38
79
votes
4 answers

How do you roll back to the previously deployed version with capistrano?

I tried using "cap rollback" but I get the following error: $ cap rollback the task `rollback' does not exist Is there some additional setup that I need to do to get rollbacks to work?
readonly
  • 343,444
  • 107
  • 203
  • 205
77
votes
5 answers

How do I use gems with Ubuntu?

I recently upgraded to Ubuntu 9.04 and I have issues using gems. I installed Ruby, Rubygems and Rails using apt-get. The rails command does work. I then installed capistrano and other gems, such as heroku. In order to do that, I used the…
0x26res
  • 11,925
  • 11
  • 54
  • 108
77
votes
13 answers

getaddrinfo: nodename nor servname provided, or not known

I have a Ruby on Rails application that I am deploying on a computer running Mac OS X 10.6. The code where the problem arises is run by a delayed_job. The problem only occurs when it is run through delayed_job. If I run it within a console (rails…
ChronoPositron
  • 1,498
  • 2
  • 10
  • 14
75
votes
10 answers

Capistrano deploy fails after I changed the repository URL

I have a simple deployment via capistrano from a Git repository. At first I was deploying form GitHub, everything worked just fine. But then I moved my repository to BitBucket and now I'm getting fatal: Could not parse object '9cfb...'. The problem…
Jakub Arnold
  • 85,596
  • 89
  • 230
  • 327
69
votes
8 answers

Reading the first line of a file in Ruby

I want to read only the first line of a file using Ruby in the fastest, simplest, most idiomatic way possible. What's the best approach? (Specifically: I want to read the git commit UUID out of the REVISION file in my latest Capistrano-deployed…
Craig Walker
  • 49,871
  • 54
  • 152
  • 212
69
votes
13 answers

How to find the Vagrant IP?

I have been developing an automated deployment using Capistrano and using Vagrant as my test virtual server. The thing is, I need the IP of Vagrant to "ssh into it". I tried ifconfig and got the IP but it looks like it is not the exact vagrant…
Linda
  • 1,203
  • 2
  • 15
  • 23
67
votes
11 answers

Deploying a Git subdirectory in Capistrano

My master branch layout is like this: / <-- top level /client <-- desktop client source files /server <-- Rails app What I'd like to do is only pull down the /server directory in my deploy.rb, but I can't seem to find any way to do that. The /client…
Jarin Udom
  • 1,849
  • 3
  • 19
  • 23
1
2 3
99 100