Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for heroku node name #1078

Merged
merged 2 commits into from
May 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions lib/oban.ex
Original file line number Diff line number Diff line change
Expand Up @@ -400,11 +400,20 @@ defmodule Oban do

## Node Name

When the `node` value hasn't been configured it is generated based on the environment:
When the `node` value has not been configured it is generated based on the environment:

1. If the local node is alive (e.g. in a distributed system, or when running from a mix release)
the node name is used
2. In a Heroku environment the system environment's `DYNO` value is used
3. Otherwise, the system hostname is used

Note: When running a mix release on a Heroku node, the node is alive even if not part of a
sorentwo marked this conversation as resolved.
Show resolved Hide resolved
distributed system. In order to use the `DYNO` value, configure the node value using runtime
configuration via `config/runtime.exs:

config :my_app, Oban,
node: System.get_env("DYNO") || :inet.gethostname() |> elem(1) |> List.to_string()
sorentwo marked this conversation as resolved.
Show resolved Hide resolved

* In a distributed system the node name is used
* In a Heroku environment the system environment's `DYNO` value is used
* Otherwise, the system hostname is used
"""
@doc since: "0.1.0"
@spec start_link([option()]) :: Supervisor.on_start()
Expand Down
Loading