Capistrano ssh key forwarding

I had quite some problems getting capistrano to check out the repository. After some hours i found this bug  report:
So there is an error with ssh key forwarding in jruby. This is fixed in version JRuby 1.7.0.pre2. So i installed the jruby-head version
In order to get torquebox server installed i needed to increase the max heap memory that can be used.

jruby -J-Xmx1024m -S gem install torquebox-server -v '2.1.2'  

You can set these options in the deploy.rb with (–1.9 sets the compatibility mode to ruby 1.9)
set :jruby_opts, “-J-Xmx1024m –1.9”

The next problem appeared at compiling the assets. It seems like ruby is calling itselt again, and it is not adding the jruby path. After short googling i found the solution:

set :default_environment, {
  ‘PATH’ => “/opt/torquebox/jruby/bin:$PATH”

After that the deployment worked, for me the Capfile looks like this:

load ‘deploy’

Uncomment if you are using Rails’ asset pipeline

load ‘deploy/assets’

require ‘torquebox-capistrano-support’
require ‘bundler/capistrano’

load ‘config/deploy’ # remove this line to skip loading any of the default tasks

And the deploy.rb:# Forward Agent
sshoptions[:forwardagent] = true


set :gateway, YOUR-GATEWAY’

Keep a local repo copy on remote, and enable submodules

set :deployvia, :remotecache
set :gitenablesubmodules, 1

set :application, “Planetech”
set :repository,  “YOURREPOURL”

 set :scm, :git

set :scm_verbose, true # Enable Verbose scm output for debugging

set :branch, “master”

Or: accurev, bzr, cvs, darcs, git, mercurial, perforce, subversion or none

your log folder to share between different releases

you can add more folders here…

set :symlinks, {“log” => “log”}

role :web, “”                          # Your HTTP server, Apache/etc
role :app, “”                          # This may be the same as your Web server
#role :db,  “”, :primary => true # This is where Rails migrations will run
#role :db,  “your slave db-server here”

set :group, “www-data”
set :usesudo, false
set :torquebox
home, ‘/opt/torquebox’
set :jbosshome, ‘/opt/torquebox/jboss’
set :jruby
home, ‘/opt/torquebox/jruby’
set :jrubyopts, “-J-Xmx1024m –1.9″set :defaultenvironment, {
  ‘PATH’ => “/opt/torquebox/jruby/bin:$PATH”

Sets root path for deployment

set :deploy_to, “/var/www/torquebox/planetech”

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *