# `QueueKeeperCheck.Release`
[🔗](https://github.com/TitaniumMonkey/Queue-keeper-check/blob/v0.2.1/lib/queue_keeper_check/release.ex#L1)

Run the check from a release, outside Oban, e.g. from system cron. `mix` isn't available
in releases, so use `eval`, which loads code without starting your application (and
therefore without starting Oban):

    bin/my_app eval 'QueueKeeperCheck.Release.main(MyApp.Repo, otp_app: :my_app)'

`main/2` starts only the repo's adapter applications and the repo itself (pool of 1, or
reuses it when it is already running), prints the report and halts with:

| code | status |
|---|---|
| 0 | `:ok` |
| 1 | `:warning` |
| 2 | `:critical` |
| 3 | `:error`: a check, the repo or the configuration failed, so the result is unknown |

It never starts your application, Oban, or any process other than the repo (verified by
`dev/verify_isolation.exs`), and stops the repo again when it started it. Because it never
depends on Oban running, it keeps working when Oban itself is down. Pair it with an
outside heartbeat so you also hear when *this* stops running (see the README section
"When Oban itself is down").

Options are those of `QueueKeeperCheck.run/2`, plus `:otp_app` (to load the repo's
config), `:json` (print JSON) and `:halt` (default `true`).

# `check`

Run once and return `{report, exit_code}` without halting. Never raises: any failure
(bad options, unknown repo, database down) becomes a report with status `:error` and
exit code 3.

# `exit_code`

# `main`

Run once, print, and halt with the exit code (unless `halt: false`).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
