Skip to content

devlanes is in beta and not ready for production use.Report an issue

Connect to a box

When a box runs your project, connecting to it puts the box’s lanes on your machine under the hostnames and ports the box gave them.

::example{slug="remote-ssh-box"}

The box has to be ready first, as Prepare a box describes.

Your daemon runs the system ssh, so give the box an entry in your SSH config and keep its key in an SSH agent, so that reconnects need no prompt.

~/.ssh/config
Host my-vps
HostName 203.0.113.10
User you

The box serves only machines it has paired with. Get a one-time code on the box, then connect with it under the name your SSH config gives the box.

on the box
$ devlanes daemon pair
on your machine
$ devlanes remote connect my-vps --code K7QM-3XWD --background

Your machine keeps a token for later connections, so the code is needed once. Without --background the command stays in the terminal until you end it, and the connection carries on either way.

Check the connection, then open the box’s URLs in your browser as you would on the box.

on your machine
$ devlanes remote ls
$ devlanes url ls

A lane on your own machine with the same hostnames keeps them, even when it is stopped, and devlanes remote ls then lists the box’s lane as skipped. Hand the hostnames to the box’s lane, and take them back later with --local.

on your machine
$ devlanes remote use my-vps myapp@0
$ devlanes remote use --local myapp@0

Your daemon reconnects by itself after sleep, a network change or a restart. When a reconnect needs you, such as for a passphrase, run the connect again in a terminal. When the box asks for a new pairing, get a new code and connect with it as above. Disconnect a box you no longer use.

on your machine
$ devlanes remote connect my-vps
$ devlanes remote disconnect my-vps

On the box, list the machines paired with it and revoke one by its name. Remove its SSH key from the box as well; Security explains why.

on the box
$ devlanes daemon clients
$ devlanes daemon revoke laptop

Set remote.allow_connections to false in its user config.

Set remote.require_pairing to false in the box’s user config, so each machine that SSH lets in connects without a code. Security covers what that gives up.