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
43
votes
6 answers

rails active admin deployment : couldn't find file 'jquery-ui'

when trying to deploy with capistrano, when capistrano use command bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile I have this error couldn't find file 'jquery-ui' (in…
user2016483
  • 583
  • 1
  • 5
  • 13
43
votes
5 answers

How can you check to see if a file exists (on the remote server) in Capistrano?

Like many others I've seen in the Googleverse, I fell victim to the File.exists? trap, which of course checks your local file system, not the server you are deploying to. I found one result that used a shell hack like: if [[ -d #{shared_path}/images…
Teflon Ted
  • 8,696
  • 19
  • 64
  • 78
41
votes
4 answers

Please require this file from within a Capistrano recipe (LoadError)

I'm using Capistrano 2 with Rails 3 project. Recently I rebuilt my gemset form scratch and now I receive error "Please require this file from within a Capistrano recipe (LoadError)" when I try to run rails server. Detailed error…
Leo Lukin
  • 1,201
  • 1
  • 11
  • 24
39
votes
4 answers

How to deploy resque workers in production?

The GitHub guys recently released their background processing app which uses Redis: http://github.com/defunkt/resque http://github.com/blog/542-introducing-resque I have it working locally, but I'm struggling to get it working in production. Has…
Brian Armstrong
  • 19,707
  • 17
  • 115
  • 144
38
votes
4 answers

How do I target a specific commit SHA with capistrano deploy

I am wondering how I can target a specific commit SHA in Git for deployment, using Capistrano? It should be something like cap deploy --version= Can't seem to find the answer to this after a lot of searching.
Scott Miller
  • 2,298
  • 3
  • 21
  • 24
37
votes
5 answers

Capistrano: Can I set an environment variable for the whole cap session?

I've got a staging server with both standard Ruby and Ruby Enterprise installed. As standard Ruby refuses to install a critical gem, I need to set $PATH so that ruby/gem/rake/etc. always refer to the REE versions. And since I use Capistrano to…
Xavier Holt
  • 14,471
  • 4
  • 43
  • 56
37
votes
5 answers

How to seed the production database using the Capistrano gem?

I am using Ruby on Rails 3.0.9 and I would like to seed the production database in order to add some record without re-building all the database (that is, without delete all existing records but just adding some of those not existing yet). I would…
Backo
  • 18,291
  • 27
  • 103
  • 170
37
votes
3 answers

Don't know how to build task 'start' when run 'cap production deploy' for capistrano 3.8.0 with Rails

I tried to deploy my rails site using capistrano. So when i ran cap production deploy This is what i got (Backtrace restricted to imported tasks) cap aborted! Don't know how to build task 'start' (see --tasks) Tasks: TOP => production This is my…
Varis Darasirikul
  • 3,907
  • 9
  • 40
  • 75
35
votes
7 answers

Hot deploy on Heroku with no downtime

A bad side of pushing to Heroku is that I must push the code (and the server restarts automatically) before running my db migrations. This can obviously cause some 500 errors on users navigating the website having the new code without the new…
zetarun
  • 777
  • 1
  • 8
  • 13
35
votes
6 answers

How do I configure capistrano to use my rvm version of Ruby

Does anybody know how I can tell capistrano to use my default rvm version of ruby for on the server I am pushing to. It insists on using the system version. Is it even possible?
Sam Saffron
  • 128,308
  • 78
  • 326
  • 506
34
votes
1 answer

How to have Capistrano NOT rollback if a task fails

We're using Capistrano/Webistrano (with Lee Hambley's railsless-deploy gem) to push our PHP application to production servers. I have some custom tasks that get run during various parts of the deploy process. As an example, I have tasks that…
TravellingGuy
  • 343
  • 1
  • 3
  • 4
34
votes
5 answers

Starting delayed_job at startup

I'm using delayed_job with capistrano and would like a way to start delayed_job on startup of the web application using the 'script/delayed_job start'. This way capistrano can restart it on deploy. If the server gets rebooted then my delayed_jobs…
map7
  • 5,096
  • 6
  • 65
  • 128
34
votes
5 answers

Passing parameters to Capistrano

I'm looking into the possibility of using Capistrano as a generic deploy solution. By "generic", I mean not-rails. I'm not happy with the quality of the documentation I'm finding, though, granted, I'm not looking at the ones that presume you are…
Daniel C. Sobral
  • 295,120
  • 86
  • 501
  • 681
33
votes
5 answers

Capistrano 3 sudo task

I want to write a recipe with Capistrano 3 executing a task on the remote server with sudo. With Capistrano 2 this could be done for example: default_run_options[:pty] = true task :hello do run "#{sudo} cp ~/something /something" end With…
crimi
  • 746
  • 1
  • 7
  • 8
33
votes
5 answers

Capistrano 3 execute within a directory

I'm trying to write a task for Capistrano 3 that involves executing 'composer install' within the directory of the current release. It looks something like this: namespace :composer do desc 'Install dependencies with Composer' task :install do …
Rahul Sekhar
  • 2,761
  • 5
  • 23
  • 27