Skip to content

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

Share settings and choose which services start

Use this guide when a project has many services that repeat the same settings, and you rarely need all of them running at once.

::example{slug="workflows-profiles-tags"}

Share settings, tag services and group them

Section titled “Share settings, tag services and group them”

A template is a named set of service settings that services take over with extends. A tag is a label on a service, and + with its name selects every service that has it. A profile is a named selection of services to start:

devlanes.yaml
templates:
server:
run_script:
name: dev
ready:
http:
path: /healthz
services:
accounts-api:
extends: server
run_script: { file: apps/accounts-api/package.json }
hosts: "accounts.${{ lane.domain }}"
tags: [api, essential]
mailer:
extends: server
run_script: { file: apps/mailer/package.json }
tags: [worker, essential]
profiles:
default: [+essential]
backend: [+api, +worker]

Each service keeps the template’s script name and adds its own file; its own settings win, as services.<name>.extends describes. The profile named default is what a plain start runs on a lane’s first start and after you stop the whole lane.

~/dev/myapp
$ devlanes start --profile backend

The start runs the services the profile selects, and the lane remembers the profile, so a plain start after a reboot brings back the same selection. Stopping the whole lane makes it forget the profile:

~/dev/myapp
$ devlanes stop

A profile written as a mapping can set env. While the profile is active, those variables reach every unit of the lane, which means each service and task, including services the profile does not select. A service’s own env cannot override them:

devlanes.yaml
profiles:
test:
include: [+essential]
env:
DATA_FILE: "${{ lane.data_path }}/test/${{ self.name }}.json"

Set infra: false on the profile. A value that reads a container, such as a database URL, then has a value only while that container already runs, as a shared one another lane started does. Without it, each service the value reaches fails to start, and a value in global_env reaches all of them. So keep such a value with the services that use it:

devlanes.yaml
services:
api:
env:
DATABASE_URL: postgres://postgres:postgres@127.0.0.1:${{ infra.postgres.port }}/${{ lane.db_name }}
profiles:
frontend:
include: [web]
infra: false

Point a frontend at another lane’s backend builds on such a profile.