Installation View Source
Before continuing, be sure you have Oban up and running in your app!
Oban.Pro
is delivered as a hex package named oban_pro
, which is published
privately to our self-hosted package repository.
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, ensure hex
is up-to-date:
mix local.hex --force
Finally, 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.
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.9", 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!
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}
Finally, set the predeps
script within elixir_buildpack.config
:
hook_pre_fetch_dependencies="./bin/predeps"