View Source Installation

Oban.Pro is delivered as a hex package named oban_pro, which is published privately to our self-hosted package repository.

Prerequisites

  1. Ensure Oban is installed for your application. It's probably there already, but just in case, follow these instructions to get started.

  2. Ensure you're running Erlang/OTP v23.3.4.5, v24.0.4, or later. Older Erlang/OTP versions have an expired CA root certificate that doesn't work with Let's Encrypt certificates.

  3. Ensure you're running hex v1.0.0 or later, via mix local.hex --force

Authentication

Before you can pull the package into your application you need to add a new oban hex repo. First, grab the OBAN_KEY_FINGERPRINT and OBAN_LICENSE_KEY from your account page.

Then, run the following mix hex.repo command:

mix hex.repo add oban https://getoban.pro/repo \
  --fetch-public-key $OBAN_KEY_FINGERPRINT \
  --auth-key $OBAN_LICENSE_KEY

⚠️ You'll also need to authenticate on any other development machines, build servers and CI/CD instances. There are also guides to help with building Docker Images, authenticating on Gigalixir and Heroku.

Configuration

Now that you're authenticated you're ready to add oban_pro as a dependency for your application. Open mix.exs and add the following line:

{:oban_pro, "~> 0.10", repo: "oban"}

Now fetch your dependencies:

$ mix deps.get

There isn't any direct configuration for Oban.Pro. Instead, you configure Oban to run an engine or plugins directly and use the various workers. For example, to use the Lifeline plugin you'd add it to the Oban config within config.exs:

config :my_app, Oban,
  engine: Oban.Pro.Queue.SmartEngine,
  repo: MyApp.Repo,
  queues: [alpha: 10, gamma: 10, delta: 10],
  plugins: [Oban.Pro.Plugins.Lifeline]

Now you're ready to start using the smart engine, various plugins, and workers!

Deployment

Building Docker Images

Building Docker images with Pro and Web requires an additional step to add the private hex repo. Passing the fingerprint and password in as build arguments isn't secure, and you should use buildkit's secret support instead if possible.

Reference the secrets within in your Dockerfile by mounting it within a RUN command:

RUN --mount=type=secret,id=oban_key_fingerprint \
    --mount=type=secret,id=oban_license_key \
    mix hex.repo add oban https://getoban.pro/repo \
      --fetch-public-key "$(cat /run/secrets/oban_key_fingerprint)" \
      --auth-key "$(cat /run/secrets/oban_license_key)"

Then, at build time, pass the fingerprint and license through using the --secret flag:

docker build \
  --secret id=oban_key_fingerprint,env=OBAN_KEY_FINGERPRINT \
  --secret id=oban_license_key,env=OBAN_LICENSE_KEY .

Authorizing on Gigalixir

If your app runs on Gigalixir you can use a buildpack hook to authenticate with the private oban repo.

First, set your license key on Gigalixir:

gigalixir config:set OBAN_LICENSE_KEY="YOUR OBAN LICENSE KEY"
gigalixir config:set OBAN_KEY_FINGERPRINT="THE PUBLIC KEY FINGERPRINT"

Then add the hook to the end of your elixir_buildpack.config:

hook_pre_fetch_dependencies="mix hex.repo add oban https://getoban.pro/repo \
    --fetch-public-key ${OBAN_KEY_FINGERPRINT} \
    --auth-key ${OBAN_LICENSE_KEY}"

Authorizing on Heroku

If your app runs on Heroku using the Elixir Buildpack (rather than Docker) you'll need to use compilation hook to authorize hex before fetching dependencies.

First, set your license key on Heroku:

heroku config:set OBAN_LICENSE_KEY="YOUR OBAN LICENSE KEY"
heroku config:set OBAN_KEY_FINGERPRINT="THE PUBLIC KEY FINGERPRINT"

Next, add a small shell script to your application in ./bin/predeps:

#!/bin/bash

mix hex.repo add oban https://getoban.pro/repo \
    --fetch-public-key ${OBAN_KEY_FINGERPRINT} \
    --auth-key ${OBAN_LICENSE_KEY}

Make sure the prepdeps script is executable:

$ chmod +x ./bin/prepdeps

Finally, set the predeps script within elixir_buildpack.config:

hook_pre_fetch_dependencies="./bin/predeps"

Trouble installing? Have questions?

Take a look at the [troubleshooting][faq] guide to see if your issue is covered. If not, or if you need any help, stop by the #oban channel in [Elixir Slack][sla].