Skip to content
This repository was archived by the owner on Aug 26, 2019. It is now read-only.

Handbook: Remote

Sergey Smagin edited this page Nov 22, 2015 · 4 revisions

Remote functions don't work!

Sorry, for now nothing from the description below works. Maybe one day I'll figure out a good way to fix it.

Quickstart

Put the rush code tree on the server you wish to access remotely, and make sure rushd is the path. The client must be able to connect via ssh (ideally, with an authorized_keys to avoid excessive password prompting).

Load a rush shell on the client and type:

remote = Rush::Box.new('user@your.remote.host')
remote['/'].ls

It will establish an ssh tunnel, launch rushd on the remote machine, and if everything worked, you'll get a directory listing of the root dir of the remote machine.

Details

rushd is a Mongrel handler which runs on port 7770. It uses http basic authentication to authorize the connection, and as such, should not be used bare over the internet. Currently rushd uses ssh tunnels, although a standard webserver SSL wrapper could also be used.

Credentials are stored in ~/.rush/credentials on the client side and ~/.rush/passwords on the server side. Credentials are auto-generated if they don't exist, and auto-added server side. This is not intended to be a strong security measure, but an extra layer of protection to avoid other users on the same local machine from being able to connect to your rushd.

Tips

You can copy or move files or directories between two remote machines, although this pipes the data through the client. For example:

box1['/usr/lib/ruby/gems'].copy_to box2['/usr/lib/ruby/']

rush is designed such that anything you can do locally can also be done remotely, and entries referenced on different machines can be interchanged in a single action. You could even do an operation on a collection of files which reside on different machines as if they were in one place. For example, to check all the access log formats in all the nginx config files on three remote webservers:

nginx_confs = %w(www1 www2 www3).map { |n| Rush::Box.new(n)['/etc/nginx/nginx.conf'] } 
nginx_confs.search(/access_log/)

Any box you access frequently should probably be aliased into a variable in your ~/.rush/env.rb file. For example, your env.rb might look like this:

work_box = Rush::Box.new('workstation175.mycompany.com') 
work     = work_box['/home/adam/']

This allows you to immediately begin manipulating your remote machines, instead of building up the Rush::Box objects first. Perhaps pull that project you left at work down onto your local machine:

work['myproj/'].copy_to home

Previous: Environment

source: https://web.archive.org/web/http://rush.heroku.com/handbook/remote

Clone this wiki locally