Prepare a box
Before your machine can open the lanes of a VPS or another computer, that machine has to run devlanes and the project itself, and then it is a box.
::example{slug="remote-ssh-box"}
This assumes devlanes runs on your own machine, as Install devlanes describes, and that you know lanes from A service, a port and a hostname.
Install devlanes on the box
Section titled “Install devlanes on the box”In an SSH shell on the box, install into ~/.devlanes/bin, where your machine looks for devlanes when it connects, and put that folder on your shell’s path.
$ curl -fsSL https://devlanes.run/install.sh | sh -s -- --dir ~/.devlanes/bin$ echo 'export PATH="$HOME/.devlanes/bin:$PATH"' >> ~/.profile$ . ~/.profileRun the same devlanes release on the box and on your machine, and update both together. The box also needs Git, and Docker when the project has containers. It needs no HTTPS setup, because your machine serves the box’s hostnames with its own certificates.
Give the box its own ports
Section titled “Give the box its own ports”Your machine opens the box’s services on the same port numbers the box gave them, so give each machine its own part of the port range. Set the box’s before its first devlanes command, and restart your daemon after changing yours.
# ~/.devlanes/config.yaml on the boxports: range: 28000-32767portsPort range that every lane of every project takes its block of ports from, so lanes never collide. Defaults to 20000-32767.
ports.rangePorts devlanes may hand out, written start-end (both included, start above 0); defaults to 20000-32767, below Linux's usual ephemeral range so the OS does not pick them for outgoing connections. Each lane of each project gets its own block of consecutive ports from it, so a smaller range fits fewer lanes.
# ~/.devlanes/config.yaml on your machineports: range: 20000-27999portsPort range that every lane of every project takes its block of ports from, so lanes never collide. Defaults to 20000-32767.
ports.rangePorts devlanes may hand out, written start-end (both included, start above 0); defaults to 20000-32767, below Linux's usual ephemeral range so the OS does not pick them for outgoing connections. Each lane of each project gets its own block of consecutive ports from it, so a smaller range fits fewer lanes.
$ devlanes daemon restartSee ports.range for the setting.
Keep the daemon running after you log out
Section titled “Keep the daemon running after you log out”On a Linux box, turn on linger so the daemon outlives your SSH session, and install it as a service so it comes back after a reboot.
$ sudo loginctl enable-linger "$USER"$ devlanes daemon installStart the project on the box
Section titled “Start the project on the box”Clone the project and start its lane, as on your own machine. Each service has to listen on loopback or on all addresses.
$ git clone https://git.example.invalid/myapp.git ~/dev/myapp$ cd ~/dev/myapp$ devlanes start --no-uiThe box is ready; Connect to a box opens its lanes on your machine.
If the box runs Windows
Section titled “If the box runs Windows”Install the OpenSSH Server that ships with Windows, then install devlanes with the PowerShell installer from Install devlanes, as the account you log in with over SSH.
If the box daemon cannot find Docker or a tool
Section titled “If the box daemon cannot find Docker or a tool”A daemon started by a connection gets the short path of a non-interactive SSH session. Restart it from an interactive shell on the box so it takes that shell’s path.
$ devlanes daemon restart