Start a service only on demand
A service nobody needs on every start, such as a component library’s docs or a webhook tunnel, can stay stopped until you ask for it.
::example{slug="workflows-profiles-tags"}
Turn off autostart
Section titled “Turn off autostart”services: docs: run_script: file: apps/docs/package.json name: dev hosts: "docs.${{ lane.domain }}" tags: [docs] autostart: falseservicesLong-running processes of each lane, started together after infrastructure, setup and lane.start tasks. Each service gets its own port as PORT and, with hosts, HTTPS hostnames. A service that exits shows as failed and is not restarted.
services.<name>A long-running process started with the lane, such as a dev server or a worker. Each service gets its own port from the lane's block (PORT, ${{ self.port }}); devlanes stops it with the lane and never restarts it when it exits. A service needs run or run_script, directly or through extends.
services.<name>.run_scriptScript to run from a project file, as { file, name }, such as { file: apps/api/package.json, name: dev }. devlanes picks the tool from the file name (package.json, Makefile, justfile, Taskfile.yml, deno.json, pyproject.toml, Cargo.toml, go.mod, pom.xml, build.gradle(.kts), settings.gradle(.kts)), runs the script in that file's directory and checks that it exists before starting. For Maven and Gradle, name is the arguments as typed after mvn or gradle, and Maven or Gradle reports a goal or task that does not exist. Presets need it to place their flags, and a profile's run_scripts can swap the script name. Exactly one of run and run_script is required after templates are applied.
services.<name>.run_script.fileFile that defines the script, relative to the project file's directory, such as apps/api/package.json. The script runs in this file's directory. Required unless an override or extends child keeps the inherited file.
services.<name>.run_script.nameScript, target, recipe, task, binary or package name in that file. For go.mod, a bare name such as api means ./cmd/api, and . or a path with / is relative to go.mod. For pom.xml and Gradle files it is the arguments as typed after mvn or gradle, such as -pl web -am spring-boot:run or :web:bootRun; quote an argument that contains spaces, as in a shell. It must name at least one goal or task. Required unless an override or extends child keeps the inherited name.
services.<name>.hostsHostnames the devlanes HTTPS proxy routes to this service, so https://<host> reaches it. One entry or a list; an entry is a hostname or a mapping with host and optional port (a named port), fallback and host_header. A *. wildcard matches subdomains, and an exact host wins over it. The first non-wildcard host becomes public_url, non-wildcard hosts join the lane's DEVLANES_ORIGINS, and having hosts makes the default ready a TCP check. Keep them under ${{ lane.domain }} so lanes do not collide.
services.<name>.tagsLabels for selecting and grouping services. +tag selects every service with the tag in profiles, in commands such as devlanes start +api, and in the TUI filter. Tags also set the service's color: the first tag with a color under the top-level tags wins, then the first tag naming a category such as api, web or worker, so put that tag first.
services.<name>.autostartSet false for an on-demand service: a plain devlanes start without a default profile skips it unless the lane ran it before, and so do globs such as * in profiles. Naming it or its +tag, on the command line or in a profile, still starts it. An expression is evaluated for each lane and acts like the true or false it gives, such as ${{ lane.index == 0 }} to autostart only in the main lane. With replicas, the service starts all its copies when any copy's expression gives true. Defaults to true.
A plain start of the lane now leaves the service out and starts the rest. Its hostname stays routed, and a request to it gets the proxy’s DL201 Service not running page.
Start it by name
Section titled “Start it by name”Name the service, or one of its tags with a plus, as in +docs:
$ devlanes start docs --no-uiIt starts next to what the lane already runs. Until you stop it, a plain start brings it back with the rest.
If you use profiles
Section titled “If you use profiles”A profile, a named selection of services, includes an on-demand service when it names it or its tag, and a glob such as * skips it. With a profile named default, a plain start runs exactly that profile, so use one of the two to leave a service out, not both. Share settings and choose which services start covers profiles.
If only some lanes need it
Section titled “If only some lanes need it”Autostart also takes an expression, evaluated for each lane. This one starts the service in lane 0 and leaves it on demand everywhere else:
services: docs: autostart: ${{ lane.index == 0 }}servicesLong-running processes of each lane, started together after infrastructure, setup and lane.start tasks. Each service gets its own port as PORT and, with hosts, HTTPS hostnames. A service that exits shows as failed and is not restarted.
services.<name>A long-running process started with the lane, such as a dev server or a worker. Each service gets its own port from the lane's block (PORT, ${{ self.port }}); devlanes stops it with the lane and never restarts it when it exits. A service needs run or run_script, directly or through extends.
services.<name>.autostartSet false for an on-demand service: a plain devlanes start without a default profile skips it unless the lane ran it before, and so do globs such as * in profiles. Naming it or its +tag, on the command line or in a profile, still starts it. An expression is evaluated for each lane and acts like the true or false it gives, such as ${{ lane.index == 0 }} to autostart only in the main lane. With replicas, the service starts all its copies when any copy's expression gives true. Defaults to true.