Skip to content
DashboardWebsite

Task Scheduler

OpenTremor Core has no scheduler of its own: no periodic loop, no cron. OpenTremor-task-scheduler is a standalone process that calls Core’s admin HTTP endpoints at intervals. It communicates with Core at runtime, without a code-level dependency. See Data Retention, Platform Admin — Deleting an organization, and Platform Admin — Retrying a failed job, Rules from ADRs, Jira, Audit Log Streaming and the backup settings in Configuration Reference for the jobs it drives.

The scheduler reads a jobs: list from its config file. Each entry has a name, HTTP method, path, and heartbeat interval in minutes. It calls {core.base_url}{path} at that interval. The seven jobs shipped today are:

jobs:
- name: retention_sweep
method: POST
path: /v1/admin/retention/run
heartbeat_minutes: 15
- name: org_purge
method: POST
path: /v1/admin/organizations/purge-pending
heartbeat_minutes: 60
- name: jobs_sweep
method: POST
path: /v1/admin/jobs/sweep
heartbeat_minutes: 15
- name: knowledge_sync
method: POST
path: /v1/admin/knowledge/sync
heartbeat_minutes: 60
- name: jira_sync
method: POST
path: /v1/admin/jira/sync
heartbeat_minutes: 1
- name: audit_push_drain
method: POST
path: /v1/admin/audit-sinks/drain
heartbeat_minutes: 1
- name: backup_tick
method: POST
path: /v1/admin/backups/tick
heartbeat_minutes: 15

heartbeat_minutes sets how often the scheduler calls each endpoint. Core controls when the underlying work runs. For example, retention and stuck-job sweeps use Core’s configured intervals; knowledge sync skips repositories synced recently; and backup ticks skip work when backups are disabled, a backup is running, or a recent failure is within its backoff period. Org purge does nothing until an organization passes its deletion grace period. Jira sync does nothing when jira.enabled is off and syncs findings whose status changed. This keeps most heartbeat calls from doing the underlying work. You can add jobs in the config without changing scheduler code.

The scheduler authenticates with Core’s bootstrap auth.api_key. A service account created with POST /v1/auth/keys is scoped to one org and cannot have is_superadmin, which the scheduler’s admin endpoints require. Core’s bootstrap key works without a database lookup and resolves as a platform superadmin. See Configuration Reference — auth.

Set OPENTREMOR_SCHEDULER_API_KEY to the target Core instance’s auth.api_key. Store it in a secret store or Kubernetes Secret in production. Do not commit it as plaintext.

The workspace’s docker-compose.dev.yaml and docker-compose.prod.yaml include a task-scheduler service connected to opentremor-core:8000. Run make up-dev at the workspace root to start it with the rest of the stack.

To run the image on its own:

Terminal window
docker build -t opentremor-task-scheduler .
docker run --rm -e CONFIG_FILE=configs/opentremor-task-scheduler.yaml \
-e OPENTREMOR_SCHEDULER_API_KEY=<core's auth.api_key> opentremor-task-scheduler

The bundled config targets http://opentremor-core:8000. On a different network, mount a config whose core.base_url reaches your Core instance. You can also set OPENTREMOR_CORE_BASE_URL to override that URL.

  • GET /healthz reports process liveness and is used by the container HEALTHCHECK.
  • GET /jobs on the scheduler itself reports each configured job’s last tick: timestamp, success status, HTTP status, and a short response summary. This shows whether the heartbeat call succeeded. Core’s GET /v1/admin/retention/status is the durable record of what a retention sweep did.