Packages & restarts
Cargo determines workspace membership through Cargo.toml. Leilani builds all members, then starts only the entries in packages. For example, a workspace can contain an API, a worker, and a shared library; list the API and worker here, and leave the library out.
Use a package name whose binary target has the same name. Startup resolves each key against built executable target names, while the console lists Cargo package names. If you customize [[bin]].name, keep these names aligned. Executable names must be unique across the workspace.
| Field | Type / default | Behavior |
|---|---|---|
| args | Array of strings; [] | Arguments passed directly to the executable, in order. Each array entry is one argument; no shell is used. |
| features | Array of strings; [] | Cargo features enabled for this package, passed as package/feature. Default features stay enabled. For example, "features": ["sqlite"] enables the package’s sqlite feature. |
| restart.policy | String; on-failure | never: do not restart. on-failure: retry launch failures, nonzero exits, or signal termination. always: also retry successful exits. |
| restart.max_restarts | Unsigned integer; 5 | Retries after the initial launch, per package, over the deployment’s lifetime. Zero disables retries. A new deployment or manual Start resets the count; automatic successful restarts do not. |
| restart.delay_secs | Positive integer; 1 | Fixed delay in seconds before each retry. Zero is invalid. |
Each package is supervised independently. It runs from the source root, receives shared environment variables plus its own overrides, and writes stdout and stderr to Logs. There is no configured startup dependency order; packages that depend on one another should tolerate the other process not being ready yet.
{
"packages": {
"api": {
"args": ["--port", "3000"],
"restart": { "policy": "on-failure", "max_restarts": 5, "delay_secs": 1 }
},
"worker": {
"args": [],
"restart": { "policy": "always", "max_restarts": 10, "delay_secs": 3 }
}
}
}The API must implement the example’s --port argument. Leilani does not add command-line options to your application. Omit restart, or any of its fields, to use the defaults; unknown fields inside restart are rejected.