Skip to content

Machine settings

The machine settings tell localspace how to run templates on this computer. They are in the file config.yaml in the localspace home, which is ~/.localspace/config.yaml by default. If XDG_CONFIG_HOME has a value, the file is $XDG_CONFIG_HOME/localspace/config.yaml.

The file is optional. When it is not present, localspace uses the default of each key. When a key is not in the file, localspace uses the default of that key.

localspace reads the file in strict mode. An unknown key or a value of the incorrect type fails the command with the code invalid. The message gives the name of the file. See errors.

The Settings page of the dashboard edits the same file. It edits the sections proxy, mcp and usage. When it saves a section, it keeps the other sections and the comments of the file. You can also edit the file with a text editor. To see the settings of the public URLs, run lo settings.

Key Type Default Meaning
engines mapping docker and native The engines that run services. See engines.
ports string 20000-29999 The range of the host ports. See ports.
proxy mapping See proxy The proxy that serves the public URLs.
templates list of paths templates next to config.yaml The directories that hold templates. See templates.
secrets string file The secret store. See secrets.
resources mapping of kind to mapping none How each kind of resource is isolated. See resources.
logs mapping See logs The history of the logs of units.
usage mapping See usage Records of the memory and the disk that workspaces use.
mcp mapping See mcp The MCP server for coding agents.
ui mapping See ui The address of the dashboard.

An engine runs a unit. The key selects the engine for each way to run a service. localspace records the engine in the workspace when it makes the workspace.

Key Type Default Meaning
engines.container string docker The engine for services that run as containers, and for resources.
engines.process string native The engine for services that run as processes.

The value is the name of an installed engine. docker and native are built in. A plugin can add more engines, such as pm2. An engine that does not run the kind of service is invalid. See the engines guide.

ports is a range in the form <first>-<last>, for example 20000-29999. localspace takes the host ports of services and resources from this range. It takes the lowest port that is free. It saves the port in the state, so a workspace keeps its ports.

The proxy and the DNS server try their configured ports first. When one of those is busy, they take a port from the range. A value that is not a range of ports between 1 and 65535 fails with the code invalid.

The proxy gives public URLs to the services with expose: true. See the public URLs guide.

Key Type Default Meaning
proxy.provider string caddy The proxy to use. It must be installed.
proxy.address domain or ip domain How a public URL reaches a service. domain uses a host name through the proxy. ip uses an IP address and the host port of the service, with no proxy.
proxy.domain string lo The suffix of the host names in domain mode. It is one or more DNS labels with dots between them, such as lo or acme.lo. See below.
proxy.host string {service}.{workspace} The order of the service and the workspace in a host name. The values are {service}.{workspace} and {workspace}.{service}.
proxy.https boolean true The scheme of the public URLs. true gives https. A template can replace this with its field https.
proxy.http_port integer 80 The port of the proxy for HTTP. If it is busy, the proxy uses 7080.
proxy.https_port integer 443 The port of the proxy for HTTPS. If it is busy, the proxy uses 7443.
proxy.ip loopback or lan loopback The IP address in ip mode. loopback is 127.0.0.1. lan is the address of the machine in the local network.
proxy.dns_port integer 7053 The port, on 127.0.0.1, of the DNS server that answers the names in the domain.

The three ports must be different from each other and between 1 and 65535. When a configured port is busy, localspace takes a free port from the range in ports and keeps it. The domain localhost and the ip mode do not use the DNS server of localspace. For other domains, run lo proxy dns setup one time. For https, run lo proxy trust one time. See lo proxy dns setup and lo proxy trust.

Each label of proxy.domain has lowercase letters, digits and dashes only, and 63 characters or fewer. The domain has no dot at the end. The longest host name, which is a service label and a workspace label of 63 characters before the domain, must have 253 characters or fewer. A domain that has more than 125 characters is invalid.

When you change the proxy settings in the dashboard, localspace applies them. A running service keeps the URL that it started with until it restarts.

dns.domains lists the extra domains that the DNS server of localspace answers on this machine. Each entry is a domain, or a mapping of name and template. template is the template that has the domain. It is empty when you add the domain by hand.

~/.localspace/config.yaml
dns:
domains:
- acme.com
- name: foo.bar.com
template: shop
Key Type Default Meaning
dns.domains list none The domains in which the DNS server answers the names that workspaces use. See below.

The DNS server answers each name of proxy.domain. For a domain of dns.domains, it answers only the names that workspaces use there, such as front.shop-a.acme.com. It sends each other name to the resolvers of your network, so the real acme.com and www.acme.com continue to work.

An entry has the same rules as the domains of a template. It must not be the same as proxy.domain, and it must not be in the list two times. A public suffix, such as com or co.uk, is invalid.

A template adds its domains here only when you agree. Add a domain by hand with lo proxy dns add. Run lo proxy dns setup one time for each new domain, to write its resolver file. See lo proxy dns add and the public URLs guide.

templates is a list of directories. Each directory holds one subdirectory for each template, and each of these has a localspace.yaml. The name of the subdirectory is the name of the template.

When templates is not set, localspace uses the directory templates next to config.yaml. A path that starts with ~/ is in your home directory. A directory that is not present is ignored. See the template file.

secrets is the name of the secret store for ${secret:<path>}. The default and the only built-in store is file. It keeps one file for each secret in the localspace home. A plugin can add stores. See references.

resources sets the isolation of each kind of resource. The keys are kinds, such as postgres. The isolation applies to workspaces that you make after the change, and the workspace keeps it.

Key Type Default Meaning
resources.<kind>.isolation instance or database instance instance gives each workspace a separate server in a container. database gives each workspace a separate database on one shared server.
resources.<kind>.server URL none The server for database isolation, for example postgres://postgres@127.0.0.1:5432. When it is empty, localspace runs a shared server in a container.

A kind that does not support the isolation is invalid. volume supports only instance. With a server that you run, the machine must have psql to seed a postgres database. The flag --isolation of lo new replaces the isolation for one workspace. See the resources guide.

Key Type Default Meaning
logs.history boolean true Keep the log of each earlier run of a unit when the unit starts again.
logs.keep integer 20 The number of earlier runs to keep for each unit. A value of 0 or less gives the default.

Use lo runs to read the kept logs. See lo runs.

Key Type Default Meaning
usage.record boolean true Record the memory and the disk that workspaces use.

localspace uses the records to show the average use of each template. It also uses them to find out before lo up if the machine has too little free memory or disk. With record: false there is no data, and lo up does not prompt.

Key Type Default Meaning
mcp.enabled boolean false Let coding agents use lo mcp.

The MCP server is off by default, because it lets an agent start and stop workspaces and run commands in them. When it is off, lo mcp fails with the code conflict. See the MCP reference.

Key Type Default Meaning
ui.port integer 7090 The port of the dashboard. lo ui serve listens on 127.0.0.1 at this port.
ui.hosts list of strings none Host names of a reverse proxy in front of the dashboard, such as devbox.example.ts.net. See reach the dashboard from a different machine.
~/.localspace/config.yaml
engines:
container: docker
process: native
ports: 20000-29999
proxy:
provider: caddy
address: domain
domain: lo
host: "{service}.{workspace}"
https: true
http_port: 80
https_port: 443
dns_port: 7053
templates:
- ~/.localspace/templates
- ~/work/templates
secrets: file
resources:
postgres:
isolation: database
server: postgres://postgres@127.0.0.1:5432
logs:
history: true
keep: 20
usage:
record: true
mcp:
enabled: true
ui:
port: 7090