Weird Capistrano problem

I’m having problems launching the spin process via the deploy.rb task.

Everything works great when is run the script manually via:

% ssh [email protected] /Web/Rails/Example/current/script/spin

However, when I run ‘cap spinner’ or ‘rake remote:exec ACTION=spinner’,
I get the following errors:

% cap spinner
loading configuration
/opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/recipes/standard.rb
loading configuration ./config/deploy.rb

  • executing task spinner
  • executing “/Web/Rails/Example/current/script/spin”
    servers: [“monterey.example.net”]
    Password:
    [monterey.example.net] executing command
    ** [out :: monterey.example.net]
    /Web/Rails/Example/current/script/process/…/…/config/boot.rb:6:in
    require' ** [out :: monterey.example.net] : ** [out :: monterey.example.net] No such file to load -- pathname ** [out :: monterey.example.net] ( ** [out :: monterey.example.net] LoadError ** [out :: monterey.example.net] ) ** [out :: monterey.example.net] from /Web/Rails/Example/current/script/process/../../config/boot.rb:6 ** [out :: monterey.example.net] from /Web/Rails/Example/current/script/process/spinner:2:in require’
    ** [out :: monterey.example.net] from
    /Web/Rails/Example/current/script/process/spinner:2
    command finished
    /opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/command.rb:45:in
    process!': command "/Web/Rails/Example/current/script/spin" failed on monterey.example.net (RuntimeError) from /opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/actor.rb:176:in run’
    from
    /opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/actor.rb:425:in
    execute_on_servers' from /opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/actor.rb:173:in run’
    from ./config/deploy.rb:106:in load' from /opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/actor.rb:125:in spinner’
    from
    /opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/cli.rb:246:in
    execute_recipes!' from /opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/cli.rb:246:in execute_recipes!’
    from
    /opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/cli.rb:221:in
    execute!' from /opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/cli.rb:12:in execute!’
    from
    /opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/bin/cap:11
    from /opt/local/bin/cap:18

Why would the require ‘pathname’ fail for cap and not ssh? It is my
understanding that the deployment tasks are all handled by ssh…

For completeness, here is my spin script:

#!/bin/bash
/Web/Rails/Example/current/script/process/spinner
-c ‘/Web/Rails/Example/current/script/process/spawner -p 7000 -i 5’

-d

And the deploy.rb task:

desc “Start the spinner daemon”
task :spinner, :roles => :app do
run “#{current_path}/script/spin”
end

Pretty much the same as the Capistrano docs.

Any help or suggestions would be greatly appreciated.

-ch

Craig H. wrote:

Why would the require ‘pathname’ fail for cap and not ssh? It is my
understanding that the deployment tasks are all handled by ssh…

Capistrano doesn’t open a login shell, so you don’t have access to the
environment set in your .profile or .bashrc files. ssh does.

Ray

Ray B. wrote:

Craig H. wrote:

Why would the require ‘pathname’ fail for cap and not ssh? It is my
understanding that the deployment tasks are all handled by ssh…

Capistrano doesn’t open a login shell, so you don’t have access to the
environment set in your .profile or .bashrc files. ssh does.

Ray, thanks for the info. I was just about to figure that out for myself
– was reading the bash man page when I checked the forum. :slight_smile:

So what is the best way to adjust my PATH so that the spin and the
script/process stuff works?

I can change my spinner task to:

run "source ~/.profile && #{current_path}/script/spin"

But I still have problems with the built-in restart task.

Is there some way to hook into the run command (e.g. before_run) or
should I just rewrite the restart task?

-ch

How do i unsubscribe from this list

understanding that the deployment tasks are all handled by ssh…
I can change my spinner task to:

Posted via http://www.ruby-forum.com/.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Take charge with a pop-up guard built on patented Microsoft® SmartScreen
Technology.
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines
Start enjoying all the benefits of MSN® Premium right now and get the
first two months FREE*.

As seen on all emails showing here.

http://lists.rubyonrails.org/mailman/listinfo/rails

At the bottom of the page.

On 5/26/06, Step M. [email protected] wrote:

Craig H. wrote:
So what is the best way to adjust my PATH so that the spin and the

Take charge with a pop-up guard built on patented Microsoft(r) SmartScreen
Technology.
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines
Start enjoying all the benefits of MSN(r) Premium right now and get the
first two months FREE*.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

You might also run into a problem with the spawner not starting if
executed via capistrano unless it is prepended with a nohup to force
it to continue to run after cap exists. See our full technoweenie
discussion with solution and example: http://rails.techno-weenie.net/
question/2006/5/23/capistrano_wont_spawn_fcgi_processes

There has also been a ticket around: http://dev.rubyonrails.org/
ticket/4832

Sebastian