Give a server you run yourself a hostname
When you already run a server yourself, such as a docs site or pgAdmin, devlanes can give it an HTTPS hostname without starting or watching it.
This needs devlanes installed with HTTPS set up, as Install devlanes describes, and a look at A service, a port and a hostname helps.
Declare the server
Section titled “Declare the server”devlanes reads a project file, devlanes.yaml, in the folder you run it from, a Git repository or a plain folder. For a server devlanes does not start, the file names the project and the address where your server listens:
project: myapp
infra: external: docs: address: 127.0.0.1:4800 hosts: "${{ lane.domain }}"projectProject name, the same in every worktree of the repository. It builds each lane's default domain (<project>.localhost for lane 0, <project><N>.localhost for lane N), names lanes in commands (acme@2), the containers devlanes creates and DEVLANES_LANE_PROJECT, and other projects reach this one as projects.<project>. Lowercase letters, digits, dots, underscores and dashes.
infraContainers the lanes depend on (databases, brokers, object stores), started and waited on before setup, tasks and services, plus the commands that create and remove each lane's data in them.
Config referenceinfra.externalServers you run yourself on a loopback port, such as pgAdmin, keyed by name. Every lane lists them, the proxy routes their hostnames, and machines connected with devlanes remote connect mirror them while a lane of the project runs. devlanes never starts or checks them. Put personal ones in devlanes.local.yaml.
infra.external.<name>A server you run yourself on a loopback port. Every lane of the project lists it, the proxy routes its hostnames to the port, and machines connected with devlanes remote connect mirror it while a lane of the project runs. The port is the same in every lane.
infra.external.<name>.addressWhere the server listens, 127.0.0.1:<port> or [::1]:<port>. Only loopback addresses work. A port that devlanes or a lane already uses is an error. Required.
infra.external.<name>.hostsHostnames the devlanes HTTPS proxy routes to the port. One entry or a list. An entry is a hostname, or a mapping with host and optional fallback and host_header. Expressions can use lane, project, infra and env. Put the names under ${{ lane.domain }} so each lane gets its own. The first host without a wildcard becomes the unit's URL.
The hostname is the project name followed by .localhost, so this file gives myapp.localhost.
Start the lane
Section titled “Start the lane”Run one start in the folder:
$ devlanes start --no-uiThere is nothing to start, but the folder becomes a lane of the project and the proxy routes the hostname to port 4800. Open https://myapp.localhost: while your server runs, it answers; while it is down, the proxy shows an error page saying nothing listens.
The proxy lives in the daemon, and a daemon that a command started exits a while after the last command. To keep the hostname answering, run the daemon as a login service, as The daemon describes.
If only you run the server
Section titled “If only you run the server”Put the entry in the local file, devlanes.local.yaml next to the project file, which stays out of Git. Keep personal changes out of Git covers it.
If the server rejects the hostname
Section titled “If the server rejects the hostname”Some dev servers refuse a request whose Host header is not their own address. The mapping form of a hostname makes the proxy send the local address instead:
infra: external: docs: address: 127.0.0.1:4800 hosts: host: "${{ lane.domain }}" host_header: upstreaminfraContainers the lanes depend on (databases, brokers, object stores), started and waited on before setup, tasks and services, plus the commands that create and remove each lane's data in them.
Config referenceinfra.externalServers you run yourself on a loopback port, such as pgAdmin, keyed by name. Every lane lists them, the proxy routes their hostnames, and machines connected with devlanes remote connect mirror them while a lane of the project runs. devlanes never starts or checks them. Put personal ones in devlanes.local.yaml.
infra.external.<name>A server you run yourself on a loopback port. Every lane of the project lists it, the proxy routes its hostnames to the port, and machines connected with devlanes remote connect mirror it while a lane of the project runs. The port is the same in every lane.
infra.external.<name>.addressWhere the server listens, 127.0.0.1:<port> or [::1]:<port>. Only loopback addresses work. A port that devlanes or a lane already uses is an error. Required.
infra.external.<name>.hostsHostnames the devlanes HTTPS proxy routes to the port. One entry or a list. An entry is a hostname, or a mapping with host and optional fallback and host_header. Expressions can use lane, project, infra and env. Put the names under ${{ lane.domain }} so each lane gets its own. The first host without a wildcard becomes the unit's URL.
infra.external.<name>.hosts.hostHostname to route, evaluated for each lane. A leading *. makes a wildcard that matches any depth below it but not the name itself. Quote it in YAML. Labels hold letters, digits and inner hyphens. Case and a trailing dot are ignored.
infra.external.<name>.hosts.host_headerHost header the server receives. Defaults to preserve, the hostname the browser asked for. upstream sends the address devlanes connects to, such as 127.0.0.1:5050, for servers that only accept their own address.