capistrano

How can I prevent default_environment variables from getting set by Capistrano's sudo action?

My deploy.rb sets some environment variables to use the regular user's local Ruby rather than the system-wide one. set :default_environment, { :PATH => '/home/myapp/.rvm/bin:/home/myapp/.rvm/bin:/home/myapp/.rvm/rubies/ruby-1.9.1-p378/bin:/home/myapp/.rvm/gems/ruby-1.9.1-p378/bin:/home/myapp/.rvm/gems/ruby-1.9.1-p378%global/bin:/home/...

Deploying Rails app over VPN

You'll have to bear with me as I'm not a Ruby dev, but have inherited a Ruby system. I need to deploy some changes to the app from my repository to the server. I've been instructed to run cap deploy and told that that script will get the latest code from my repository and deploy it to the server. My problem is that I have to VPN to ...

Capistrano, Mercurial and branches

It is my understanding that although Mercurial has support from branches, the community generally clone repos instead of creating branches. Similar to the Darcs model, unlike the Git model. I'm deploying a Ruby on Rails app with Capistrano and there I'd like to separate the production from the development branch. Should I point Capistra...

Custom capistrano task for working with scm repository

Is there any way to create a custom capistrano task for performing other actions on a scm repository? For instance, I would like to create a task that will checkout a particular folder from my repository and then symlink it into the shared/ directory of the main project on my server. I know this can be done by creating a task and expli...

Sudo issue with Capistrano - Could not find RubyGem mongrel

I'm having a problem with one of my Capistrano scripts - specifically, using using sudo, setting the path, and finding mongrel_rails. The path is correct, and mongrel_rails is in /opt/rails/gems/1.8/bin, but I getting the following error: /usr/lib/ruby/1.8/rubygems.rb:578:in `report_activate_error': Could not find RubyGem mongrel (>...

Excluding files from being deployed with Capistrano while still under version control with Git

I want to start testing the JavaScript in my Rails apps with qUnit and I'm wondering how to keep the test JavaScript and test runner HTML page under version control (I'm using Git, of course) but keep them off the production server when I deploy the app with Capistrano. My first thought is to let Capistrano send all the code over as usua...

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 tables/attributes: the solution proposed by Heroku is to use the maintenance mode, but I want a...

How do I prevent capistrano from overwriting files uploaded by users in their own folders?

I'm using Capistrano and git to deploy a RoR app. I have a folder under which each user has their own folder. When a user uploads or saves a file, it is saved in their own folder. When I deploy new versions of the code to the server, the user files and folders are overwritten with what's on my dev machine. Is there a way to ignore som...

How to use 'nohup' command with Capistrano to deploy an app to OS X ?

Hi, I'm using Capistrano to deploy my apps on Linux servers without any problem (even using the nohup command as below). But I can't figure it out why it's not working when I try to deploy TO an OSX machine?! I have several tasks, all are working properly (using 'cp', 'ps' or other commands) apart from one. Here is the task : tas...

Wordpress Install on OS X Snow-Leopard under Sites/public for use with capistrano

I would like to put my local OS X wordpress site in my ~users/Sites/public directory, instead of the ~users/Sites so i can properly setup a capistrano deployment. When i try this i can visit the site locally by visiting http://localhost/public and everything looks and works great but if i ever try to go to http://localhost/public/wp-a...

Redirect Output of Capistrano

I have a Capistrano deploy file (Capfile) that is rather large, contains a few namespaces and generally has a lot of information already in it. My ultimate goal is, using the Tinder gem, paste the output of the entire deployment into Campfire. I have Tinder setup properly already. I looked into using the Capistrano capture method, but...

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 config file / recipe? Should it all be in deploy.rb or should I break it out in machine1.rb, ...

Multiple roles with attributes(?) in Capistrano

How can I pass along attributes to my tasks in capistrano? My goal is to deploy to multiple servers in a load balancer. I'd like to take each one out, deploy, and add it back in sequentially so no more than one server is down at any time. I'm thinking it would be something along the lines of... (and the hosts array would be generated d...

Capistrano update causes C: to be placed in the current directory (cygwin)

When I run cap deploy:update in a directory on my local machine (via cygwin), "C:" magically appears in the directory. Sure enough, I can cd to it and it's my windows C: drive. Now I'm afraid to delete it, but I definitely don't want it in this directory (a rails project under /home/username/blah/blah). Here's my config/deploy.rb file. ...

Javascript caching, rails and apache passenger?

Alright all you little geniuses you.. please help. :D I have written a Capistrano recipe to remove the all.js cached javascript file and tell the server to restart, but it still doesn't work right. And inevitably I have to go, manually delete the all.js file and then manually restart apache. (touching restart.txt doesn't always work) A...

Script spawner not found on rails

Hi, I was following this tutorial from capistrano: http://www.capify.org/index.php/From_The_Beginning#Spinners_and_Spawners But at a certain point, I couldn't go on because I don't have a script/spawner file. So, what can I do instead? Thanks in advance ...

Capistrano fails for multiple host deployments

I be at a loss here, and after scouring the seas (read: internet) for solutions I am left with none other than to hit up the stack. any help appreciated. I have capistrano running locally for deployments onto several different environments. (I'm on windows 7, fwiw). All was well until I needed to deploy to multiple :app servers during a...

Is it possible to do have Capistrano do a checkout over a reverse SSH tunnel?

I am developing an application that resides on a public host but whose source I must keep in a Git repository behind a corporate firewall. I'm getting very tired of the slowness of deploying via scp (copying the whole repository and shipping it over SSH on each deploy) and would like to have the remote host simply do a git pull to update...

Git + Capistrano = Automatic Release Notes Generator ?

We use git (github) and capistrano (like 99% of the Rails shops out there) to deploy our app to production. What I'd like to do is, after every cap * deploy generate a text file containing all the git commit comments since the last deploy. I can then take that list of commit comments, clean it up, and put it somewhere for consumption. ...

Distribute CouchDB as part of a Rails app?

I am working on a Rails project and the Architect has asked me to investigate bundling CouchDB into to application so that it can be deployed by Capistrano across multiple platforms and managed by Rake. My expectation was that I could set up the Erlang VM on the various environments and then distribute the CouchDB application with Cap...