Scheduled jobs#
What runs on a schedule, on both deployments: a Kubernetes CronJob from the Helm chart
(Deploy on Kubernetes), or a systemd user timer on a single server
(Deploy on a single server). <fullname> is the release’s full name (scrap for a
release named scrap), shortened with a hash when it is long.
The default night, in order (times are the chart’s; each single-server timer adds up to 15 minutes of random delay). Gc looks for the backup before it deletes:
flowchart LR
classDef store fill:#e8f1ff,stroke:#4a7bd0
classDef claude fill:#fff3e0,stroke:#e08a00
B["03:30 backup"]:::store --> R["03:41 related pages"]:::claude --> G["04:30 gc"]:::store
T["Sundays 04:11 topics"]:::claude
M["1st, 03:50 monthly backup"]:::store
B -. "backup under 26 h old" .-> G
Job |
Kubernetes CronJob |
Single-server units |
Default schedule |
What it does |
Claude budget |
Deadline |
|---|---|---|---|---|---|---|
Backup |
|
|
03:30 daily, |
|
No |
Kubernetes: starts within 1 h, runs at most 1 h; single server: 1 h |
Monthly backup |
|
|
03:50 on the 1st, |
The same backup into a new run in the |
No |
Kubernetes: starts within 1 h, runs at most 1 h; single server: 1 h |
gc |
|
|
04:30 daily, |
|
No |
Kubernetes: starts within 1 h, runs at most 1 h; single server: 1 h |
Related pages |
|
|
03:41 daily, |
|
Yes |
Kubernetes: starts within 1 h, runs at most 4 h; single server: none |
Topics |
|
|
04:11 on Sundays, |
|
Yes (the call, and the syntheses) |
Kubernetes: starts within 1 h, runs at most 1 h; single server: none |
With the chart’s litestream.enabled, gc, related pages and topics need the live database, so they
are not CronJobs: the same values run them in the scrap pod’s jobs container
(The database on an emptyDir, with Litestream). The two backups stay CronJobs.
Settings#
Each chart value, its default, and what does the same on a single server. A timer drop-in is
systemctl --user edit <timer> with [Timer], an empty OnCalendar=, then the new one; a
service drop-in is systemctl --user edit <service> with [Service], an empty ExecStart=,
then the new command (both in Backup and restore, Changing the schedule and Changing
what a job does). Re-running install.sh enables again every timer whose command the image
has, so a timer turned off only with systemctl --user disable must be disabled again after
it; SCRAP_BACKUP_MONTHLY_KEEP=0 is an opt-out that install.sh keeps.
Chart value |
Default |
Single server |
|---|---|---|
|
|
|
|
|
timer drop-in on |
|
|
none: the machine’s local time |
|
|
|
|
a 20Gi claim |
|
|
|
|
|
|
timer drop-in on |
|
|
none: the machine’s local time |
|
|
|
|
unset: follows |
|
|
|
timer drop-in on |
|
|
none: the machine’s local time |
|
|
service drop-in: |
|
|
service drop-in: |
|
|
service drop-in: |
|
|
|
|
|
service drop-in: |
|
|
none: |
|
|
|
|
|
timer drop-in on |
|
|
none: the machine’s local time |
(none) |
service drop-in: |
|
|
|
|
|
|
timer drop-in on |
|
|
none: the machine’s local time |
(none) |
service drop-in: |
|
|
see |
none: the jobs share the machine |
Notes#
One budget. The Claude jobs spend from the same daily budget as photo ingest and text enrichment,
SCRAP_BUDGET_DAY_USD(ingest.budgetDayUSDin the chart, default $3 a UTC day). Each stops at a queue pause or when the day’s budget is spent, and exits non-zero then; the next run carries on.Claude jobs need ingest. The chart creates the related-pages and topics CronJobs only while
ingest.enabledis true. A single server’s timers run regardless; while ingest or enrichment is off, or no key (or seat token) is set, the command says so and succeeds.Spacing. Backup 03:30, related pages 03:41, monthly backup 03:50 on the 1st, topics Sundays 04:11, gc 04:30 (each timer with up to 15 minutes of random delay): gc comes after the backup it checks for, the two backups and gc share a lock so never overlap, and the Claude jobs usually start after the backup has its copy (nothing orders them: a slow backup may overlap).
Deadline. In the chart, a CronJob that cannot start within an hour of its time (
startingDeadlineSeconds) is skipped, and a Job is stopped after its run time (activeDeadlineSeconds). On a single server, the backup, monthly backup and gc services stop after an hour (TimeoutStartSec); the Claude ones have no limit.Finished Jobs. In the chart, each CronJob keeps its last 3 successful and 3 failed Jobs, and Kubernetes deletes any finished Job, with its pod, 7 days after it ends (
ttlSecondsAfterFinished). That includes one-off Jobs made withkubectl create job --from=cronjob/..., such as the pre-release backup. Each Deployment keeps 2 old ReplicaSets (revisionHistoryLimit).Time zone. In the chart, an empty
timeZoneuses the cluster’s clock (the controller’s, usually UTC); set an IANA name such asEurope/Londonto change it. A single server’s timers use the machine’s local time.Single-server schedules. Change one with a timer drop-in, which
install.shkeeps:systemctl --user edit scrap-backup.timer, then clearOnCalendarbefore the new one (Backup and restore, Changing the schedule). The same works for every timer.