Badger
Docs / API & reference

CLI reference

All commands take the global flags below. badger help COMMAND prints the help of a command.

Global flags

FlagDescription
--config FILEConfiguration file. Default: /etc/badger/badger.toml.
--log-level LEVELdebug, info, warn or error.
-h, --helpShow help for a command.
-v, --versionPrint the version and exit.

badger migrate

Create or update the tables Badger needs. Safe to run on every deploy: migrations that already ran are skipped, and each one runs in a transaction.

badger migrate [flags]
FlagDefaultDescription
--schema NAMEbadgerSchema to create the tables in.

badger worker

Start a worker. A worker takes jobs from its queues and runs them, at most concurrency at a time. It finishes the jobs it is running before it exits on SIGTERM.

badger worker [flags]
FlagDefaultDescription
--queues LISTdefaultComma-separated queues to take jobs from.
--concurrency N10Jobs run at the same time.

badger enqueue

Add a job from the command line. ARGS is a JSON object. The job ID is printed on success.

badger enqueue [flags] KIND [ARGS]
FlagDefaultDescription
--queue NAMEdefaultQueue to add the job to.
--at TIME–Run the job no earlier than this time.
--priority N0Higher runs first.

badger jobs

List jobs.

badger jobs [flags]
FlagDefaultDescription
--state STATE–available, running, retrying, failed or done.
--queue NAME–Only jobs in this queue.
--limit N50At most N jobs.

badger retry

Run failed jobs again. The attempt counter starts over.

badger retry [flags] ID...
FlagDefaultDescription
--all-failedfalseRetry every failed job.

badger completion

Print a shell completion script. SHELL is bash, zsh or fish.

badger completion SHELL