Forum: Ruby DRb + SSH

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.
Saji N. Hameed (Guest)
on 2008-11-06 10:54
(Received via mailing list)
Dear Gurus,

 Any advice and sample code on how to setup DRb over SSH would
be greatly appreciated.

Thanks in advance,
saji
Ara H. (Guest)
on 2008-11-06 17:57
(Received via mailing list)
On Nov 6, 2008, at 1:51 AM, Saji N. Hameed wrote:

> Dear Gurus,
>
> Any advice and sample code on how to setup DRb over SSH would
> be greatly appreciated.
>
> Thanks in advance,
> saji


http://segment7.net/projects/ruby/drb/DRbSSL/



a @ http://codeforpeople.com/
Brian C. (Guest)
on 2008-11-06 23:18
Saji N. Hameed wrote:
>  Any advice and sample code on how to setup DRb over SSH would
> be greatly appreciated.

Google "DRbTutorial". This was hosted on the rubygarden wiki which has
sadly died, but you might be able to find a cached copy.
Saji N. Hameed (Guest)
on 2008-11-07 02:55
(Received via mailing list)
* ara.t.howard <removed_email_address@domain.invalid> [2008-11-07 00:54:27 
+0900]:

>> Any advice and sample code on how to setup DRb over SSH would
>> be greatly appreciated.
>
> http://segment7.net/projects/ruby/drb/DRbSSL/

Thanks for the suggestion. However, I thought that was for
using DRb with SSL not SSH.

saji
--

--
Saji N. Hameed

APEC Climate Center                  +82 51 668 7470
National Pension Corporation Busan Building 12F
Yeonsan 2-dong, Yeonje-gu, BUSAN 611705 
removed_email_address@domain.invalid
KOREA
Saji N. Hameed (Guest)
on 2008-11-07 02:56
(Received via mailing list)
* Brian C. <removed_email_address@domain.invalid> [2008-11-07 06:16:16 +0900]:

> Saji N. Hameed wrote:
> >  Any advice and sample code on how to setup DRb over SSH would
> > be greatly appreciated.
>
> Google "DRbTutorial". This was hosted on the rubygarden wiki which has
> sadly died, but you might be able to find a cached copy.

Thanks very much. I have been googleing to no avail. Yes, there are
pointers
to the rubygarden wiki, but as you said the link is dead and I am not
able to find a cached copy.

saji
Brian C. (Guest)
on 2008-11-07 10:39
Saji N. Hameed wrote:
>> Google "DRbTutorial". This was hosted on the rubygarden wiki which has
>> sadly died, but you might be able to find a cached copy.
>
> Thanks very much. I have been googleing to no avail. Yes, there are
> pointers
> to the rubygarden wiki, but as you said the link is dead and I am not
> able to find a cached copy.

Enter the URL into the Wayback Machine at www.archive.org

This gives you:

http://web.archive.org/web/20070711135306/http://w...

There is a section headed "Running DRb over ssh"
Saji N. Hameed (Guest)
on 2008-11-07 11:16
(Received via mailing list)
* Brian C. <removed_email_address@domain.invalid> [2008-11-07 17:37:29 +0900]:

>
> This gives you:
>
> 
http://web.archive.org/web/20070711135306/http://w...
>
> There is a section headed "Running DRb over ssh"

Thanks a lot. I appreciate it.

saji
Ara H. (Guest)
on 2008-11-07 19:54
(Received via mailing list)
On Nov 6, 2008, at 5:52 PM, Saji N. Hameed wrote:

> Thanks for the suggestion. However, I thought that was for
> using DRb with SSL not SSH.



you cannot.  you can't tunnel drb over a single connection - every drb
node is a servant and may need to open up another connection for
certain method calls.  you can tunnel the main connection over ssh,
but not subsequent ones as they are dynamic.


a @ http://codeforpeople.com/
Brian C. (Guest)
on 2008-11-07 20:08
Ara Howard wrote:
> On Nov 6, 2008, at 5:52 PM, Saji N. Hameed wrote:
>
>> Thanks for the suggestion. However, I thought that was for
>> using DRb with SSL not SSH.
>
> you cannot.  you can't tunnel drb over a single connection - every drb
> node is a servant and may need to open up another connection for
> certain method calls.  you can tunnel the main connection over ssh,
> but not subsequent ones as they are dynamic.

ssh lets you set up port forwarding in both directions. It works fine,
although of course you have to set up the ssh connection yourself first.
Robert D. (Guest)
on 2008-11-07 20:19
(Received via mailing list)
>
> Thanks very much. I have been googleing to no avail. Yes, there are pointers
> to the rubygarden wiki, but as you said the link is dead and I am not
Your message got cut right here in my mail reader, you will therefore
understand why I am *very happy* for you ;).



--
C'est véritablement utile puisque c'est joli.

Antoine de Saint Exupéry
Ara H. (Guest)
on 2008-11-07 20:23
(Received via mailing list)
On Nov 7, 2008, at 11:06 AM, Brian C. wrote:

> ssh lets you set up port forwarding in both directions. It works fine,
> although of course you have to set up the ssh connection yourself
> first.

i don't *think* that's true.  certain operations in drb will cause a
*new* connection to be opened up on a *new* port.  it's not the bi-
directionality that kills you, it's that you cannot know which ports
drb will use in advance.  it's been a while since i played with this
but block methods, iirc, involve opening up a new connection on an
unknown port

http://groups.google.com/group/ruby-talk-google/br...

possibly i'm wrong, but i played with this for quite a while and,
while i could get simple methods working but not complex ones.  i
think the testcase to use is


remote_object.each do |remote_element|
   remote_element.method
end

the block cannot be serialzed so the remote_object has to call back to
the client on a *new* connection - and that's where things get messy.

hopefully i'm wrong.

cheers.


a @ http://codeforpeople.com/
Ara H. (Guest)
on 2008-11-07 21:09
(Received via mailing list)
On Nov 7, 2008, at 11:06 AM, Brian C. wrote:

> ssh lets you set up port forwarding in both directions. It works fine,
> although of course you have to set up the ssh connection yourself
> first.

yeah looks like i might eat my words - hadn't played with that in a
while but this works

# the tunnel - ran from client
ssh -L 4242:localhost:4242 -R 4243:localhost:4243
aragorn.globe.ucar.edu -N


# the server
require 'drb'

DRb.start_service "druby://localhost:4242", %w( a b c )
puts DRb.uri
DRb.thread.join


# the client
require 'drb'

DRb.start_service 'druby://localhost:4243'
remote_array = DRbObject.new_with_uri 'druby://localhost:4242'
remote_array.each{|element| p element}



i guess NAT is an issue, but this does seem to work - not sure how
robustly - but it's promising ;-)


put this up for posterity here:
http://drawohara.com/post/58529480/ruby-drb-over-a...


a @ http://codeforpeople.com/
This topic is locked and can not be replied to.