Expand description
The server roles as processes of their own (M2.1): schedr master, schedr webserver and
schedr worker, and the pieces schedr standalone runs together in one process.
- master: the gRPC service workers connect to and the master’s loop, on the database
(Postgres, or SQLite on one host); it refuses an outdated schema (
schedr db migrateruns first) and picks commands up at once on Postgres (LISTEN/NOTIFY), else by polling. - webserver: the REST API on the same database.
- worker: the agent, connected to
[worker] master_url, and its log endpoint (the webserver reads task logs from it), with log retention; no database.
The internal links (worker → master, webserver → worker logs) use mTLS in [tls] mode = "app" (the default: each role needs [tls] ca, cert and key, read again when they
change) and plain traffic in mesh mode, where a service mesh encrypts. SIGTERM and Ctrl-C
stop a role (a worker drains first). See archive/PROJECT.md, Architecture: Components and roles.
Structs§
- ApiTimings
- How long the webserver waits and refreshes.
- LocalUi
- The web UI
schedr standaloneserves next to its API, over its own deployment. - Master
Outbox - The master’s notifications:
[notifications]checked, with its sender’s timings. - Observed
- How a part of a role is observed: its metrics (registered by the caller), the health it reports its loops to, and the readiness it sets once started.
- Worker
Links - How a worker reaches the master and serves its logs.
Constants§
- LOCAL_
DEPLOYMENT - The name of the deployment
schedr standalone’s UI shows (in its URLs). - REQUESTS_
GRACE - How long open requests get once a stop is asked for, before they are cut: an event stream never ends by itself, and a page reconnects to the next server (B26).
- SCHEMA_
RETRY - How often a webserver checks again for a schema it can use.
Functions§
- agent_
settings - The worker agent’s settings, from the configuration; its journal is
<data_dir>/journal/<worker ID>and its logs<data_dir>/logs/<worker ID>(other bytes than letters, digits,-,_and., and a leading., as%XX), so workers sharing a data directory never see each other’s (retention, the log endpoint). Without[worker] memory_reserve, the task budgets leavedefault_reserveof the pod’s limit out. - apply_
change_ notifications - Turns the database’s change triggers on or off as
[database] change_notificationssays (decision 38A’), logging a change; done where migrations are, holding the master’s lease. - auth_
timings - How the users and the UI’s token are followed, by
timings, and how much is remembered. - check_
timeouts - Checks that
query_timeoutandlease_periodare shorter thanloop_stall_timeout, so one hung query doesn’t look like a stuck loop, and a stuck master doesn’t lead past its restart. - check_
ui_ port - Checks that
[webserver] ui_port_in_meshis set only in[tls] mode = "mesh". - client_
timeouts - How long the UI waits for its webservers (
SCHEDR_HIDDEN__CLIENT__*, decision 493). - connect_
database - Connects to the database of the master or the webserver, whatever its schema:
[database] urlis required, SQLite is for one host (it warns). - data_
dir - Where task logs (and standalone’s SQLite file) go:
[worker] data_dir, else$XDG_DATA_HOME/schedr, else~/.local/share/schedr. - docs_
dir [ui] docs_dirwhen it is a directory;Noneotherwise ("", or not there: no/docs).- lead
- The master’s lease for
role(masterorstandalone), being taken while the role’s other parts start when the schema is usable; else, with--migrate, taken now (a standby waits) and the schema migrated by its holder; taken asholder(the master’s ID).Nonewhen a shutdown is asked for while waiting. With--migrate,[database] change_notificationsis applied by the holder. - listen
- Binds a TCP listener.
- lock_
journal - Takes the worker’s journal lock for as long as the returned file is open: one agent per worker ID and data directory.
- log_
endpoint - Where the webserver reaches this worker’s log endpoint listening on
port:[worker] log_address(else the host name), over https with TLS. - log_
mode [worker] log_modeas a mode (the loader checked it).- log_
retention - The worker’s log retention, from the configuration.
- master
schedr master: the gRPC service and the loop, until Ctrl-C or SIGTERM.- master_
host - Checks
[worker] master_urland returns its host: anhttps://URL with a host inappmode (the master’s certificate must name the host), anhttp://one inmeshmode. - master_
outbox [notifications]with the values its webhooks’ headers read fromenv.- master_
settings - The master’s timing, from the configuration.
- memory_
text - What the watchdog does, for the worker’s startup line.
- memory_
watch - How the memory watchdog watches tasks:
[worker] memory_budget, else (limit− the reserve) ÷ slots, the reserve[worker] memory_reserveordefault_reserve; without a budget or a limit it only measures. - migrate_
holding - Migrates
db(seeunlimited) while holdinglead, renewing it as the migration runs. - migrate_
leased schedr db migrate: migrates the database aturlholding the master’s lease, so no master runs on the schema meanwhile and no other migration runs at once (sqlx’s own lock is a session lock, which a pooler in transaction mode doesn’t keep). Refused while a master holds it, unlesswait.- no_
auth_ warning - The warning for the REST API listening on
addressbeyond loopback: it has no authentication of its own until the auth modes (M3.5).alternativesays how to keep it local. - no_
auth_ warning_ for - As
no_auth_warning, forwhat(the REST API,the web UI). - once_
reached attempt’s output once the database aturlanswers: while it fails because the database can’t be reached for now (schedr_db::DbError::is_transient: down, starting, busy, a time limit), tried again everyretry. A role starting before its database waits for it instead of exiting (the user, 2026-11-15, after B247); a wrong host or port fails the same way, so the warning names where it looks (the host and port, or the file: never the user or password) and why (codes only), at once and again every minute while it waits.Noneonce a shutdown is asked for, before or during a try.- role_
auth - Who the user is for the role
what(webserver,ui) listening onaddress, bysection; a UI trusted by the token inui_token_file. The safety rules (see archive/PROJECT.md, Authentication):proxy_headerbeyond a loopback address only withallow_remote(anything reaching it around the proxy could name any user),basiconly withbehind_tls_proxy(passwords would cross the network in the clear). - role_
tls - The role’s TLS material by
[tls]: none inmeshmode; inappmode the files, which must be configured and usable. - run_
worker - Runs a worker agent connected to the master until it has drained after a stop request
(
stopcounts them; seeschedr_agent::drain), with its log endpoint and log retention beside it until then. - secure_
logs - Readies the worker’s logs for
mode([worker] log_mode, B182), as it starts: the logs it creates get it, and its log directory and the logs already in it are given it. - serve_
api - Serves the REST API on
listeneruntilstop, reading task logs from workers (over mTLS withtls), showing this webserver asnode(GET /api/v1/deployment); withui, the web UI too, at/, calling this API in process. - serve_
master - Serves the master: its gRPC service on
listener(over mTLS withtls) and its loop, untilstop, onceleadershiphas taken the lease (a standby waits there). - served
server(shutting down gracefully onstop) until it ends; oncestopasks, its open requests getgraceand are then cut.- start_
ops - Binds the ops port (
[ops] bind:port) and servesopsthere untilstop, logging the address asschedr <role>: ops on http://<address>. - stop_
on_ signal - A count of stop requests (Ctrl-C or SIGTERM): the first stops a role (a worker drains), a second makes a draining worker interrupt its tasks at once. The SIGTERM handler is registered before this returns, so a SIGTERM right after start still stops the role gracefully.
- take_
lease - Waits for the master’s lease (see
Leadership::take) asholder(a new incarnation of the master ofrole:crate::node::new_master_id), logging once that it waits as a standby. - ui
- Runs
schedr ui: the web UI over the webservers of[ui] deployments, until a signal. - ui_
deployments - The deployments
[ui] deploymentsnames, each with a client of its webserver’s API. - ui_
timings - How a UI’s live pages are paced, by
timings, and how far a browser may fall behind. - unlimited
- The database at
urlwithout a query limit, for a migration (a long one must finish);limiteditself in memory, where another connection would be another database. - until
- Completes once
stopturnstrue: how every part of a role learns to stop. - until_
stopped work’s output, orNoneonce a shutdown is asked for.- wait_
for_ schema - Waits until
db’s schema is usable by this binary, checking everyretryand saying what it waits for whenever that changes (the database unreachable, then a schema to migrate, …; the master, orschedr db migrate, migrates it), so a webserver started before the migration serves once it is done instead of failing. - webserver
schedr webserver: the REST API, until Ctrl-C or SIGTERM.- worker
schedr worker: the agent connected to[worker] master_url, until Ctrl-C or SIGTERM.- worker_
timeouts - How long what a worker starts may take, and how it is paced.
Type Aliases§
- Lease
Future - The master’s lease, being taken (see
take_lease).