Scheduled jobs
sudo reportlog jobs # the list and schedules
sudo reportlog job sweep # run one now
systemctl list-timers 'reportlog-*' # when each runs next
journalctl -u reportlog-job@backup # what one said
The schedule lives in apps/api/src/jobs/registry.ts, and the timer files
in deploy/systemd/ are generated from it
(pnpm --filter @reportlog/api ops timers --write; a test fails if they
differ). All times are UTC.
| Job | When | What |
|---|---|---|
backup | daily 03:00 | Dump, check, encrypt and send off-site |
sweep | daily 03:30 | Delete expired credentials from named tables |
lists-sweep | daily 03:40 | Erase the personal half of expired list entries; the rows stay (workstream E's sweepLists) |
anchor | daily 04:00 | Timestamp the chain heads (DFN) and publish them to the transparency log (workstream D2's runAnchorJob) |
files | every minute | Re-encode and encrypt new files, sweep abandoned uploads, delete what was taken down |
anchor-watch | daily 09:00 | Check from outside the anchor that it ran; fails (and alerts) when the archive has not been anchored |
digest-hourly | hourly | Email hourly subscribers what the board published since their last email |
digest-weekly | Mondays 07:00 | The same, for weekly subscribers |
journalist-alerts | daily 08:00 | Email each journalist on the alert list how many new approved reports there are in their states (counts only) |
feedback-digest | Mondays 08:00 | Email ADMIN_EMAIL every open feedback issue, longest-untouched first |
The anchor needs git on the server and the TRANSPARENCY_LOG_* settings
in /etc/reportlog/reportlog.env (see .env.example): the checkout under
/var/lib/reportlog, and the log's address with a deploy key that has write
access. Without a remote it still timestamps, keeps the day on the server and
fails the unit. A run that refuses (a logbook gone from the list, or a
chain shorter than published) exits 2 and keeps refusing every day: that is
what deleting reports looks like, and the doctor puts it first.
anchor-watch exists because the alert below fires only when a job runs
and fails. An anchor that never runs (its timer disabled, its unit lost)
fails nothing, and the doctor notices only when somebody runs it. So every
morning this job asks the doctor's own anchor question from outside the
anchor, and fails, which sends the alert, when the newest anchor is over
ANCHOR_MAX_AGE_HOURS old, when the last run refused or published nothing,
or when the log has nowhere to go. On a day the anchor itself failed you get
two emails: the anchor's at about 04:00 and this one at about 09:00.
The two sweeps are different jobs on purpose. The first deletes rows; the second erases columns and must never delete a row. A list table in the first one's list would delete links that are meant to stay.
What the credential sweep deletes, each under the condition its owner's
code already treats as dead (SWEPT in apps/api/src/jobs/sweep.ts):
| Table | Deleted when |
|---|---|
otp_codes | past expires_at |
sessions | past expires_at |
site_access_tokens | past expires_at |
ownership_transfers | past expires_at |
organization_invites | still pending and past expires_at |
organization_invite_sends | older than 14 days |
report_submissions | never confirmed and past expires_at |
It never touches contact_keys or report_contacts (deleting a contact
key is a reporter's erasure, and the addresses are append-only), and never
a list table. A database test fails on any table with an expires_at
column that is in neither SWEPT nor NOT_SWEPT.
A job that is not built yet runs, says so and exits successfully; the
doctor lists it. A job that fails starts reportlog-alert@, which emails
OPS_ALERT_EMAIL the unit's name (never its output, which stays on the
server).
Unattended upgrades reboot the machine at 05:30 when an update needs it,
after the night's jobs (deploy/apt/52reportlog-unattended-upgrades). Daily
jobs that were due while it was off run when it comes back.