Closed sorentwo closed 1 week ago
I am a big fan of Oban (also using Oban Pro at work), but I’m not sure how far we should go with including external libraries in the official generators, as those integrations need to be maintained. Maybe it would be better to improve extending the generators from external packages? There could be a mix oban.phx.new
or mix phx.new --plugin oban
(where the oban hex package would need to provide a specific module).
After some reflection, and some outside advice, I don't think this is a good fit. Oban shouldn't be in every Phoenix app, especially not by default. Aside from the slippery slope of "what belongs in Phoenix by default", there's too much separate education necessary to use it and understand what it is doing.
Now that I've gone through the exercise of seeing all the touch points, I'll revisit a simplified igniter based installer instead.
Maybe it would be better to improve extending the generators from external packages? There could be a mix oban.phx.new or mix phx.new --plugin oban (where the oban hex package would need to provide a specific module).
That's a nice idea. Making it possibly to auto-install commonly used packages seems helpful.
This adds Oban by default to
phx.new
with the following considerations:use Oban
, to generate a dedicatedMyApp.Oban
module for the application. This makes configuration in the application clearer and more familiar, because it matchesMyApp.Repo
. This would also allow multiple apps in an umbrella to have their own Oban instances without any name conflicts.Postgres
orSQLite3
. Creating a new project with other, currently unsupported, databases won't include Oban. This is documented in the task help.default
queue, a pruning plugin set to retain jobs for one hour, and an empty crontab to indicate that periodic jobs are available.DataCase
.Questions
MyApp.Oban
) approach alright with others? It's newer, and officially supported for several versions now, but it isn't what the installation docs prescribe.0
, rather than a timestamp just to get it working. Any thoughts or suggestions on how to get the correctly named file, or whether a different hard-coded number may work?It Works!
Here's a screenshot after running
mix phx.new my_app; mix ecto.reset; iex -S mix phx.server
and checking that Oban is up and running: