2than
Different Oban Periodic Jobs Per Each Deployment Environments
Hello community.
My understanding is that only way to setup a recurring periodic job with Oban Workers is to utilize the Oban.Plugins.Cron. Documentation seems to set the configuration on the config.exs. My question is if I use the same container image to deploy to multiple environment servers (test, sandbox, production, etc), won’t this run all the periodic jobs on each the servers?
This is not a desired action in my case because each job will have a notification email info within the args data and will send out the notification even for non-production environment runs. Each environments are deployed with the same container images so will have same configurations (email address).
So far options I have come up with:
- Update the config.exs after deployment to each servers. This is not ideal as each deployment will overwrite the environment specific config.exs.
- Implement a environment value check for all the Workers to only execute on specific envrionments. For example, only call perform function if env_variable is “prod”. I question if this is a good approach to manage all Worker executions this way.
Please let me know if I am missing something here of if you need any additional info. I am open to any suggestions as I am bit stuck at this point.
First Post!
mpope
If you define the cron in each of your environment specific configuration files (config/prod.exs, config/test.exs, etc.) then they’d be isolated.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









