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
3,875
questions
160
votes
15
answers
68k
views
What is your preferred php deployment strategy? [closed]
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 ...
140
votes
13
answers
84k
views
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 ...
129
votes
4
answers
45k
views
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 ...
117
votes
7
answers
19k
views
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:$...
109
votes
17
answers
68k
views
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 ...
97
votes
21
answers
77k
views
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 ...
88
votes
19
answers
129k
views
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 ...
88
votes
2
answers
27k
views
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, '...
79
votes
4
answers
65k
views
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?
78
votes
13
answers
167k
views
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 ...
77
votes
5
answers
64k
views
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 ...
76
votes
10
answers
18k
views
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
...
71
votes
13
answers
134k
views
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 ...
71
votes
8
answers
47k
views
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 ...
67
votes
12
answers
16k
views
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 ...
62
votes
5
answers
47k
views
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 ...
61
votes
5
answers
34k
views
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 ...
60
votes
7
answers
30k
views
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 ...
59
votes
7
answers
44k
views
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 ...
58
votes
13
answers
35k
views
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 ...
58
votes
3
answers
23k
views
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 ...
54
votes
9
answers
37k
views
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)...
54
votes
6
answers
28k
views
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?
...
53
votes
8
answers
31k
views
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 ...
52
votes
6
answers
51k
views
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 ...
50
votes
7
answers
23k
views
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 ...
48
votes
6
answers
33k
views
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 (...
45
votes
5
answers
20k
views
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
45
votes
9
answers
28k
views
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 ...
45
votes
2
answers
22k
views
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 ...
43
votes
6
answers
20k
views
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 '...
43
votes
5
answers
24k
views
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 ...
41
votes
4
answers
13k
views
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 ...
39
votes
4
answers
18k
views
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=<sha targeted>
Can't seem to find the answer to ...
39
votes
4
answers
24k
views
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 ...
37
votes
5
answers
38k
views
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 ...
37
votes
3
answers
18k
views
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' (...
37
votes
5
answers
32k
views
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 ...
36
votes
6
answers
27k
views
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?
36
votes
7
answers
12k
views
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 ...
34
votes
5
answers
33k
views
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 ...
34
votes
5
answers
26k
views
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 '...
34
votes
5
answers
28k
views
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 "#...
34
votes
1
answer
12k
views
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 ...
33
votes
5
answers
17k
views
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. ...
32
votes
10
answers
29k
views
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 (...
31
votes
5
answers
39k
views
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 ...
30
votes
3
answers
29k
views
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 ...
30
votes
5
answers
22k
views
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 ...
29
votes
9
answers
33k
views
/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] ...