Supervisor
Introduction
The supervisor keeps the application's long-running programs alive. A program is a console command, such as the queue worker, and the supervisor runs workers copies of it, each in its own process. When a process exits, the supervisor starts it again.
The queue worker is the program every application starts with:
[[program]]name = "queue"command = "queue:work"args = ["--queue=default"]workers = 1dust install starts the supervisor after the migrations, so a deploy does not need a systemd unit for each worker. The supervisor runs the queue:work command itself, and supervisor:status reports each worker's PID, CPU, memory, and restarts.
Configuration
The supervisor reads config/supervisor.toml. A new application ships one:
binary = "dust-demo"[[program]]name = "queue"command = "queue:work"args = ["--queue=default"]workers = 1restart = true| Key | Default | Meaning |
|---|---|---|
binary |
none | The application binary the programs run, such as dust-demo. Required. |
log |
storage/logs/supervisor.log |
Where the supervisor and its programs write their output. |
grace_seconds |
25 |
How long a stopping process has before it is killed. |
restart_seconds |
1 |
How long to wait before restarting a program that exited. |
Programs
Each [[program]] describes one kind of worker:
| Key | Default | Meaning |
|---|---|---|
name |
— | The name supervisor:status shows and supervisor:restart accepts. |
command |
— | The console command, such as queue:work. |
args |
none | Arguments after the command, such as ["--queue=default"] or ["--concurrency=4"]. |
workers |
1 |
How many copies run at once, each in its own process. |
restart |
true |
Whether an exited program is started again. |
env |
none | Extra environment variables for the program, as a table. |
A program's command is the same console command you would run by hand, so queue:work keeps its own options: --queue, --concurrency, --sleep, --timeout, and the rest.
Commands
| Command | What it does |
|---|---|
dust supervisor:start |
Starts the supervisor, which starts every program. |
dust supervisor:status |
Shows the supervisor, each worker's PID, CPU, memory, restarts, and start time. |
dust supervisor:programs |
Lists every configured program, running or not, with its command, workers, CPU, and memory. |
dust supervisor:restart |
Restarts every program. |
dust supervisor:restart queue |
Restarts only the named program. |
dust supervisor:stop |
Stops the supervisor and its programs. |
dust install starts the supervisor. dust restart restarts the cron daemon, the supervisor, and the relay server. Both have --no-supervisor when you want to leave it alone.
Status and statistics
$ dust supervisor:status
running, pid 214176
queue: 1 worker(s)
worker 0: pid 214211, cpu 0.4%, 62.7 MB, 0 restart(s), started 2026-12-03T06:01:44ZThe daemon samples each worker's CPU time and resident memory from /proc every two seconds and writes them to storage/framework/supervisor.json, which supervisor:status reads. dust status shows the supervisor's total CPU and memory next to the database, queue, cache, cron, and relay.
The supervisor writes storage/framework/supervisor.pid and logs to storage/logs/supervisor.log. Each program's own output goes to the same log, so the queue worker's messages appear there too.
Adding a program
Add another [[program]] for anything that must stay alive. For example, a second queue pool with more concurrency:
[[program]]name = "mail"command = "queue:work"args = ["--queue=mail", "--concurrency=4"]workers = 2Or a program of your own, registered as a console command:
[[program]]name = "relay"command = "relay:serve"workers = 1Restart one program after changing its settings:
dust supervisor:restart mailThe other programs keep running.
How it works
The supervisor starts one child process per worker and records it in the status file. Every half second it checks whether a child exited; when one did, it logs the exit status, increases the restart count, and starts it again after restart_seconds, unless the program sets restart = false.
supervisor:restart writes the program's name, or * for every program, to storage/framework/supervisor.restart. The daemon reads that file within half a second, signals the matching processes with SIGTERM, and starts them again immediately.
On SIGTERM or Ctrl+C, the supervisor signals every child, waits up to grace_seconds for them to finish their current job, then kills what is left. A queue:work process stops taking jobs immediately and finishes the one it is running, so a deploy does not lose a job.