capistrano

How to run multiple tasks in Ruby?

I have a Capistrano deploy.rb script which has multiple tasks that can be invoked on the command line cap site1_to_live deploy cap site2_to_live deploy (...etc) I have tried combining these into a single task as follows task :all_to_live do site1_to_live site2_to_live site3_to_live end However, only one of the tasks is execut...

Rails App Maintenence Without Hindering Visitors

A Phusion Passenger error message isn't what I want my visitors to see if they landed on my site while I'm updating the back end. So how do I get around this? Is my deployment process flawed from the start? or is there something I'm missing out? Here's my process of deployment, so you get the picture: commit new updates to a git rep...

Mongrel cluster does not start on Snow Leopard

Hi, I fail to deploy my ruby (v1.8.7) rails (v2.3.5) application on Snow Leopard (10.6.3). After "cap deploy", the Mongrel-cluster (v1.1.5) fails to start up with the following output in mongrel.*.log: ** Daemonized, any open files are closed. Look at tmp/pids/mongrel.8000.pid and log/mongrel.8000.log for info. ** Starting Mongrel l...

Thinking Sphinx indexing succeeding on command line, but failing in Cron job.

I admit I've cobbled together a mostly working production setup on Ubuntu with Capistrano from the official docs (which seem dated and make a lot of assumptions) and various blog posts of varying outdatedness. Anyway, the last annoying hang up is that indexing works when I do it by hand (and on deploy I'm pretty sure), but doesn't work ...

Calling a multistage capistrano task from within a capistrano task

I have a capistrano task that consolidates the deployment of multiple stages of a Rails project. For example: task :consolidated_task do build #creates a new release branch from master, #sets a variable with the relese branch name staging deploy.migrations production deploy.migrations end Is this the ...

delayed_job restart from capistrano

Here is what I have in my enviornment.rb. I understand there have been issues with restarting because of a bug in the "daemons" gem and that the ghazel-daemons fixes it. But its not working in my case. I am using the collectiveidea 2.1.0--pre version of DJ, rails 2.3.5. config.gem 'delayed_job', :source => 'http://rubygems.org', :versio...

How can I print my git tags in Capistrano as part of my deploy task?

I've set up Capistrano to ask me which git tag I want to deploy: # deploy.rb set(:branch) { Capistrano::CLI.ui.ask('Tag to deploy:') } This works as expected - if I specify v0.75 it will deploy that tag. However, I'd love it if I could print out the list of my tags before I get asked which one to deploy, with something like this: gi...

Rails 404 error for Stylesheet or JavaScript files

Rails can't load (404 error) CSS & JS files on production but has no problem loading them in development. I'm using Capistrano for deployment and running Rails 3. My path on development is /www/myapp but my path on production is /www/myapp/current. The application itself seems to work fine, so the issue seems to be isolated to CSS/JS f...

Jammit::OutputNotWritable: Jammit doesn't have permission

I've moved my Rails app to a new server and now I'm having problems with Jammit. I deploy with Capistrano and have tried a few different routines to get Jammit to run when I deploy (which works), but everytime the Passenger app restarts it seems to want to re-reun Jammit, which I don't need it to do, it only needs to run when I deploy......

How do you define the same tasks differently for different roles in Capistrano?

I'm using Capistrano to handle my deployment, and I've got two different roles in my setup - :web and :processing. They both have the usual :deploy tasks, but the :restart task needs to be different for the two types of server. So my first attempt was something like this: task :restart, :roles => :web do run "... web related restar...

Capistrano uploads the .git directory

I am using git with capistrano. I initialized my project inside my folder on my local machine as such: git init I then pushed the project the server directory I then called cap deploy The deploy works, except that it uploads the local .git folder structure, as well as my .gitignore and Capfile to a publicly accessible folder. Here's...

cap deploy:cold fails with 'No such file or directory - git rev-parse master' error

Hi, I am trying to deploy my rails application for the first time. Server is running Ubuntu 10.4 server (64bit) Local machine is running Windows XP. Repository is at github I have successfully run cap deploy:setup but when I run cap deploy:cold I get the following error: D:\Rails\rails_apps\fx>cap deploy:cold You are running ...

Use Capistrano for Rake tasks?

Is Capistrano only used for deploying Rails apps? Basically I want a scripting framework to handle all server/client scripting for me. Examples: Updating Ubuntu, installing gems with dependencies etc. Creating a new Rails app, Git initialize it and commit, create Heroku project and upload the app. Automatize basic file/folder operati...

How to execute a command on the server with Capistrano?

I have a very simple task called update_feeds: desc "Update feeds" task :update_feeds do run "cd #{release_path}" run "script/console production" run "FeedEntry.update_all" end Whenever I try to run this task, I get the following message: [out :: mysite.com] sh: script/console: No such file or directory I figured it's because...

rails memcache dev vs production

I am using memcache for caching in my rails app and currently I have a dev and a production environment. I would like to run the dev environment without caching so that I can debug more easily but I wanna enable the caching in production obviously. I am using github and capistrano for deployment. Without doing a check at every stateme...

Deploying rake task to server

I have a couple simple rake tasks hosted at github that I would like to push to a remote server. It's essentially just a directory with a few classes and a Rakefile. What would be the best and/or simplest approach for deployment? I'm thinking the simplest might be just to clone the repo on my server and do a git pull whenever there's an...

problems deploying with capistrano from windows

Hi, I am trying to set up capistrano with github so that I can deploy from my windows XP laptop to my ubuntu server. Capistrano gives the following output when I run cap deploy: $ cap deploy * executing `deploy' * executing `deploy:update' ** transaction: start * executing `deploy:update_code' updating the cached checkout o...

Chef and application deploy

How is it possible to keep my rails application up to date using chef? While reading documentation I understood how to set up servers from scratch using knife bootstrap. But is it possible to run another tasks after this? Earlier I have used capistrano but now we have two staging and ten production servers which needs to be up to date ...

SSH not releasing terminal

Hello, When I run the following command from my macbook to my ubuntu server the terminal does not get released. It just sits there until I Control-C the command. ssh user@my-server 'sudo /etc/init.d/nginx start' When i login and then run the command everything works fine. ssh user@my-server sudo /etc/init.d/nginx start Here is the...

passing configure options to rake gems:build

On the server (where I am not root), I have compiled libxslt into /home/foo/sw. So I can install my gem like so: gem install nokogiri -- --with-xslt-dir=/home/foo/sw However, this same technique doesn't work with rake: $ rake gems:build -- --with-xslt-dir=/home/foo/sw (in /home/foo/fooapp/releases/20100915071151) If I try to forc...