Skip to content

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

Work with several boxes

When two boxes, here fork-a and fork-b, run the same lanes, as copies made from one image do, your machine stays connected to both and one of them serves each lane at a time.

Two boxes know nothing of each other’s ports, so split the box’s part of the range between them, keeping your machine’s part from Prepare a box. Copies of one image start with the same ports.range, so set it on each copy before its first devlanes command.

~/.devlanes/config.yaml
# ~/.devlanes/config.yaml on fork-a
ports:
range: 28000-30399
~/.devlanes/config.yaml
# ~/.devlanes/config.yaml on fork-b
ports:
range: 30400-32767

Then connect to each box under its own name, as Connect to a box describes.

When lanes share hostnames, as lane 0 of myapp does on both boxes, your machine mirrors one of them, in this order:

  1. a lane on your machine that runs
  2. the box lane you chose
  3. a lane on your machine that is stopped
  4. the lane of the box that connected first

devlanes remote ls lists the lanes it skipped, each with the command that switches to it.

on your machine
$ devlanes remote ls

Choose the box that serves the lane.

on your machine
$ devlanes remote use fork-b myapp@0

The switch keeps the lane’s hostnames, but not its port numbers, since each box gave the lane ports from its own range. A browser follows the switch; a program that connects to a port number, such as a database client, needs the new box’s port, which devlanes remote ls shows. The choice lasts until another one replaces it or you disconnect the box.

A running local lane keeps its hostnames, so the choice is refused. Stop the lane, then choose the box again.

on your machine
$ devlanes stop
$ devlanes remote use fork-b myapp@0