Forum: Ruby on Rails Weird Capistrano problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Craig H. (Guest)
on 2006-05-26 03:36
I'm having problems launching the spin process via the deploy.rb task.

Everything works great when is run the script manually via:

% ssh removed_email_address@domain.invalid 
/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
Ray B. (Guest)
on 2006-05-26 03:56
(Received via mailing list)
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
Craig H. (Guest)
on 2006-05-26 04:31
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. :-)

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
Sebastian F. (Guest)
on 2006-05-26 13:54
(Received via mailing list)
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
Step M. (Guest)
on 2006-05-26 17:58
(Received via mailing list)
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
>removed_email_address@domain.invalid
>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...
  Start enjoying all the benefits of MSN® Premium right now and get the
first two months FREE*.
Jón B. (Guest)
on 2006-05-26 18:30
(Received via mailing list)
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. <removed_email_address@domain.invalid> 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...
>   Start enjoying all the benefits of MSN(r) Premium right now and get the
> first two months FREE*.
>
> _______________________________________________
> Rails mailing list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
This topic is locked and can not be replied to.