Watchfire
Persistence and run history
Persistence. With a database, Watchfire keeps the agent registry, run history, checkpoints and (with the
database queue driver) the job queue and the dead letters in watchfire_agents, watchfire_runs, watchfire_checkpoints, watchfire_jobs and
watchfire_dead_letters. A migration creates them by delegating to smeltery::watchfire::migrations::up(schema) /
down(schema); it also creates watchfire_commands (commands for agents in other processes) and gives each run the
name of the process that ran it. An app whose Watchfire migration ran before those existed adds a second migration
that calls smeltery::watchfire::migrations::up_multi_process(schema) / down_multi_process(schema) (it does nothing
when they exist). Without a database (or before the migration ran) the history and checkpoints live in memory, and
the queue too (QUEUE_DRIVER=memory). Every store call has a timeout (WATCHFIRE_STORE_TIMEOUT, 5 s); a store failure
is logged and never stops an agent.
| Variable | Default | Meaning |
|---|---|---|
WATCHFIRE_MAX_CONCURRENT |
0 |
agents running at once (0: no limit; the queue workers and the scheduler do not count) |
WATCHFIRE_WORKERS |
2 |
queue workers |
WATCHFIRE_JOB_TIMEOUT |
60 |
seconds a job may run |
WATCHFIRE_HTTP_TIMEOUT |
30 |
seconds per ctx.http() request |
WATCHFIRE_HTTP_MAX_BODY |
10485760 |
the largest response body ctx.http() reads, in bytes |
WATCHFIRE_STORE_TIMEOUT |
5 |
seconds per store or queue call |
QUEUE_DRIVER |
database with a database, else memory |
where queued jobs wait: database, redis (feature redis; the server of REDIS_URL) or memory |
QUEUE_PREFIX |
<app name in snake case>_queue_ |
the start of the redis queue driver's keys |
WATCHFIRE_DASHBOARD |
local |
who may use the dashboard: local (signed-in users the dashboard gate admits; under APP_ENV=local also requests from this machine without signing in), auth (signed-in users the gate admits, also under APP_ENV=local), off (no dashboard) |
WATCHFIRE_API_ADDR |
empty | the address work serves the API on (e.g. 127.0.0.1:8001); the agents:* commands call it (an address on this machine, or an https:// URL), else SERVER_HOST:SERVER_PORT |
WATCHFIRE_IN_SERVE |
true |
whether serve runs the agents, queue workers and scheduler (false: only work runs them) |
WATCHFIRE_LOCK_STORE |
CACHE_STORE |
the cache store whose locks coordinate several processes; off for none |
WATCHFIRE_LEASE_TTL |
30 |
seconds a lease lasts without renewal (at least 3); at least 12/7 of the longest singleton agent's shutdown timeout, and 18 with Overlap::Skip / Queue scheduled calls (see "Several processes") |
WATCHFIRE_ALERT_WEBHOOK |
empty | a URL every alert is POSTed to as JSON |
WATCHFIRE_ALERT_MAIL |
empty | comma-separated addresses every alert is mailed to (needs .mail()) |